this repo has no description
0
fork

Configure Feed

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

automod: quick anti-bot rule (#598)

authored by

bnewbold and committed by
GitHub
a262ba41 c54b106c

+35 -9
+1
automod/rules/all.go
··· 27 27 ProfileRules: []automod.ProfileRuleFunc{ 28 28 GtubeProfileRule, 29 29 BadWordProfileRule, 30 + BotLinkProfileRule, 30 31 }, 31 32 RecordRules: []automod.RecordRuleFunc{ 32 33 InteractionChurnRule,
-2
automod/rules/hashtags.go
··· 19 19 if c.InSet("bad-hashtags", tag) || c.InSet("bad-words", tag) { 20 20 c.AddRecordFlag("bad-hashtag") 21 21 c.ReportRecord(automod.ReportReasonRude, fmt.Sprintf("possible bad word in hashtags: %s", tag)) 22 - c.Notify("slack") 23 22 break 24 23 } 25 24 word := keyword.SlugContainsExplicitSlur(keyword.Slugify(tag)) 26 25 if word != "" { 27 26 c.AddAccountFlag("bad-hashtag") 28 27 c.ReportRecord(automod.ReportReasonRude, fmt.Sprintf("possible bad word in hashtags: %s", word)) 29 - c.Notify("slack") 30 28 break 31 29 } 32 30 }
+2 -2
automod/rules/interaction.go
··· 43 43 if created > interactionDailyThreshold && c.Account.FollowsCount > 2000 && followRatio < 0.1 { 44 44 c.Logger.Info("bulk-follower", "created-today", created) 45 45 c.AddAccountFlag("bulk-follower") 46 - //c.ReportAccount(automod.ReportReasonSpam, fmt.Sprintf("many follows: %d follows today (so far)", created)) 47 - c.Notify("slack") 46 + c.ReportAccount(automod.ReportReasonSpam, fmt.Sprintf("bulk following: %d follows today (so far)", created)) 47 + //c.Notify("slack") 48 48 } 49 49 } 50 50 return nil
+2 -2
automod/rules/mentions.go
··· 90 90 91 91 count := c.GetCountDistinct("young-mention", did, countstore.PeriodHour) + newMentions 92 92 if count >= youngMentionAccountLimit { 93 - c.AddAccountFlag("young-distinct-account-mention") 94 - c.ReportAccount(automod.ReportReasonRude, fmt.Sprintf("possible spam (young account, mentioned %d distinct accounts in past hour)", count)) 93 + c.AddAccountFlag("new-account-distinct-account-mention") 94 + c.ReportAccount(automod.ReportReasonRude, fmt.Sprintf("possible spam (new account, mentioned %d distinct accounts in past hour)", count)) 95 95 c.Notify("slack") 96 96 } 97 97
+27
automod/rules/quick.go
··· 1 + package rules 2 + 3 + import ( 4 + "fmt" 5 + "strings" 6 + 7 + appbsky "github.com/bluesky-social/indigo/api/bsky" 8 + "github.com/bluesky-social/indigo/automod" 9 + ) 10 + 11 + var botLinkStrings = []string{"ainna13762491"} 12 + 13 + var _ automod.ProfileRuleFunc = BotLinkProfileRule 14 + 15 + func BotLinkProfileRule(c *automod.RecordContext, profile *appbsky.ActorProfile) error { 16 + if profile.Description != nil { 17 + for _, str := range botLinkStrings { 18 + if strings.Contains(*profile.Description, str) { 19 + c.AddAccountFlag("profile-bot-string") 20 + c.AddAccountLabel("spam") 21 + c.ReportAccount(automod.ReportReasonSpam, fmt.Sprintf("possible bot based on link in profile: %s", str)) 22 + c.Notify("slack") 23 + } 24 + } 25 + } 26 + return nil 27 + }
+3 -3
automod/rules/replies.go
··· 72 72 count := c.GetCount("reply-text", bucket, period) 73 73 if count >= identicalReplyLimit { 74 74 c.AddAccountFlag("multi-identical-reply") 75 - c.ReportAccount(automod.ReportReasonRude, fmt.Sprintf("possible spam (young account, %d identical reply-posts today)", count)) 75 + c.ReportAccount(automod.ReportReasonRude, fmt.Sprintf("possible spam (new account, %d identical reply-posts today)", count)) 76 76 c.Notify("slack") 77 77 } 78 78 ··· 121 121 // NOTE: won't include the increment from this event 122 122 count := c.GetCountDistinct("young-reply-to", did, countstore.PeriodHour) 123 123 if count >= youngReplyAccountLimit { 124 - c.AddAccountFlag("young-distinct-account-reply") 125 - c.ReportAccount(automod.ReportReasonRude, fmt.Sprintf("possible spam (young account, reply-posts to %d distinct accounts in past hour)", count)) 124 + c.AddAccountFlag("new-account-distinct-account-reply") 125 + c.ReportAccount(automod.ReportReasonRude, fmt.Sprintf("possible spam (new account, reply-posts to %d distinct accounts in past hour)", count)) 126 126 c.Notify("slack") 127 127 } 128 128