this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

more quick anti-spam rules (#605)

authored by

bnewbold and committed by
GitHub
a1c27210 61ad81b4

+44 -2
+2
automod/rules/all.go
··· 23 23 DistinctMentionsRule, 24 24 YoungAccountDistinctMentionsRule, 25 25 MisleadingLinkUnicodeReversalPostRule, 26 + SimpleBotPostRule, 26 27 }, 27 28 ProfileRules: []automod.ProfileRuleFunc{ 28 29 GtubeProfileRule, ··· 41 42 NewAccountRule, 42 43 BadWordHandleRule, 43 44 BadWordDIDRule, 45 + NewAccountBotEmailRule, 44 46 }, 45 47 BlobRules: []automod.BlobRuleFunc{ 46 48 //BlobVerifyRule,
+1 -1
automod/rules/identity.go
··· 20 20 21 21 did := c.Account.Identity.DID.String() 22 22 age := time.Since(c.Account.Private.IndexedAt) 23 - if age > 2*time.Hour { 23 + if age > 4*time.Hour { 24 24 return nil 25 25 } 26 26 exists := c.GetCount("acct/exists", did, countstore.PeriodTotal)
+41 -1
automod/rules/quick.go
··· 3 3 import ( 4 4 "fmt" 5 5 "strings" 6 + "time" 6 7 7 8 appbsky "github.com/bluesky-social/indigo/api/bsky" 8 9 "github.com/bluesky-social/indigo/automod" 9 10 ) 10 11 11 - var botLinkStrings = []string{"ainna13762491"} 12 + var botLinkStrings = []string{"ainna13762491", "LINK押して", "→ https://tiny.one/"} 13 + var botSpamTLDs = []string{".today", ".life"} 14 + var botSpamStrings = []string{"515-9719"} 12 15 13 16 var _ automod.ProfileRuleFunc = BotLinkProfileRule 14 17 ··· 25 28 } 26 29 return nil 27 30 } 31 + 32 + var _ automod.PostRuleFunc = SimpleBotPostRule 33 + 34 + func SimpleBotPostRule(c *automod.RecordContext, post *appbsky.FeedPost) error { 35 + for _, str := range botSpamStrings { 36 + if strings.Contains(post.Text, str) { 37 + // NOTE: reporting the *account* not individual posts 38 + c.AddAccountFlag("post-bot-string") 39 + c.ReportAccount(automod.ReportReasonSpam, fmt.Sprintf("possible bot based on string in post: %s", str)) 40 + c.Notify("slack") 41 + } 42 + } 43 + return nil 44 + } 45 + 46 + var _ automod.IdentityRuleFunc = NewAccountBotEmailRule 47 + 48 + func NewAccountBotEmailRule(c *automod.AccountContext) error { 49 + // need access to IndexedAt for this rule 50 + if c.Account.Private == nil || c.Account.Identity == nil { 51 + return nil 52 + } 53 + 54 + age := time.Since(c.Account.Private.IndexedAt) 55 + if age > 1*time.Hour { 56 + return nil 57 + } 58 + 59 + for _, tld := range botSpamTLDs { 60 + if strings.HasSuffix(c.Account.Private.Email, tld) { 61 + c.AddAccountFlag("new-suspicious-email") 62 + c.ReportAccount(automod.ReportReasonSpam, fmt.Sprintf("possible bot based on email domain TLD: %s", tld)) 63 + c.Notify("slack") 64 + } 65 + } 66 + return nil 67 + }