this repo has no description
0
fork

Configure Feed

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

automod polish (#544)

branch collecting tweaks that have been temporarily deployed in prod

authored by

bnewbold and committed by
GitHub
55d7254c 5c640bb2

+21 -17
+2 -3
automod/engine/effects.go
··· 9 9 // time period within which automod will not re-report an account for the same reasonType 10 10 ReportDupePeriod = 1 * 24 * time.Hour 11 11 // number of reports automod can file per day, for all subjects and types combined (circuit breaker) 12 - QuotaModReportDay = 50 12 + QuotaModReportDay = 2000 13 13 // number of takedowns automod can action per day, for all subjects combined (circuit breaker) 14 - QuotaModTakedownDay = 10 14 + QuotaModTakedownDay = 200 15 15 ) 16 16 17 17 type CounterRef struct { ··· 115 115 if comment == "" { 116 116 comment = "(reporting without comment)" 117 117 } 118 - comment = "[automod] " + comment 119 118 for _, v := range e.AccountReports { 120 119 if v.ReasonType == reason { 121 120 return
+1 -1
automod/engine/engine.go
··· 16 16 ) 17 17 18 18 const ( 19 - recordEventTimeout = 20 * time.Second 19 + recordEventTimeout = 30 * time.Second 20 20 identityEventTimeout = 10 * time.Second 21 21 notificationEventTimeout = 5 * time.Second 22 22 )
+3
automod/rules/hashtags.go
··· 1 1 package rules 2 2 3 3 import ( 4 + "fmt" 5 + 4 6 appbsky "github.com/bluesky-social/indigo/api/bsky" 5 7 "github.com/bluesky-social/indigo/automod" 6 8 "github.com/bluesky-social/indigo/automod/keyword" ··· 12 14 tag = NormalizeHashtag(tag) 13 15 if c.InSet("bad-hashtags", tag) || c.InSet("bad-words", tag) { 14 16 c.AddRecordFlag("bad-hashtag") 17 + c.ReportRecord(automod.ReportReasonRude, fmt.Sprintf("possible bad word in hashtags: %s", tag)) 15 18 c.Notify("slack") 16 19 break 17 20 }
+7 -7
automod/rules/keyword.go
··· 16 16 if word != "" && word != "faggot" && word != "tranny" { 17 17 c.AddRecordFlag("bad-word-text") 18 18 c.ReportRecord(automod.ReportReasonRude, fmt.Sprintf("possible bad word in post text or alttext: %s", word)) 19 - c.Notify("slack") 19 + //c.Notify("slack") 20 20 break 21 21 } 22 22 // de-pluralize ··· 24 24 if c.InSet("worst-words", tok) { 25 25 c.AddRecordFlag("bad-word-text") 26 26 c.ReportRecord(automod.ReportReasonRude, fmt.Sprintf("possible bad word in post text or alttext: %s", tok)) 27 - c.Notify("slack") 27 + //c.Notify("slack") 28 28 break 29 29 } 30 30 } ··· 39 39 if word != "" { 40 40 c.AddRecordFlag("bad-word-name") 41 41 c.ReportRecord(automod.ReportReasonRude, fmt.Sprintf("possible bad word in display name: %s", word)) 42 - c.Notify("slack") 42 + //c.Notify("slack") 43 43 } 44 44 } 45 45 for _, tok := range ExtractTextTokensProfile(profile) { ··· 48 48 if c.InSet("worst-words", tok) { 49 49 c.AddRecordFlag("bad-word-text") 50 50 c.ReportRecord(automod.ReportReasonRude, fmt.Sprintf("possible bad word in profile description: %s", tok)) 51 - c.Notify("slack") 51 + //c.Notify("slack") 52 52 break 53 53 } 54 54 } ··· 68 68 if c.InSet("bad-words", tok) || keyword.SlugIsExplicitSlur(tok) != "" { 69 69 c.AddRecordFlag("reply-single-bad-word") 70 70 c.ReportRecord(automod.ReportReasonRude, fmt.Sprintf("bad single-word reply: %s", tok)) 71 - c.Notify("slack") 71 + //c.Notify("slack") 72 72 } 73 73 } 74 74 return nil ··· 175 175 if word != "" { 176 176 c.AddAccountFlag("bad-word-handle") 177 177 c.ReportAccount(automod.ReportReasonRude, fmt.Sprintf("possible bad word in handle (username): %s", word)) 178 - c.Notify("slack") 178 + //c.Notify("slack") 179 179 return nil 180 180 } 181 181 ··· 184 184 if c.InSet("bad-words", tok) { 185 185 c.AddAccountFlag("bad-word-handle") 186 186 c.ReportAccount(automod.ReportReasonRude, fmt.Sprintf("possible bad word in handle (username): %s", tok)) 187 - c.Notify("slack") 187 + //c.Notify("slack") 188 188 break 189 189 } 190 190 }
+8 -6
automod/rules/replies.go
··· 47 47 return nil 48 48 } 49 49 50 - // increment first. use a specific period (IncrementPeriod()) to reduce the number of counters (one per unique post text) 51 - period := countstore.PeriodDay 52 - bucket := c.Account.Identity.DID.String() + "/" + HashOfString(post.Text) 53 - c.IncrementPeriod("reply-text", bucket, period) 54 - 55 50 // don't action short replies, or accounts more than two weeks old 56 51 if utf8.RuneCountInString(post.Text) <= 10 { 57 52 return nil ··· 63 58 } 64 59 } 65 60 66 - if c.GetCount("reply-text", bucket, period) >= identicalReplyLimit { 61 + // increment before read. use a specific period (IncrementPeriod()) to reduce the number of counters (one per unique post text) 62 + period := countstore.PeriodDay 63 + bucket := c.Account.Identity.DID.String() + "/" + HashOfString(post.Text) 64 + c.IncrementPeriod("reply-text", bucket, period) 65 + 66 + count := c.GetCount("reply-text", bucket, period) 67 + if count >= identicalReplyLimit { 67 68 c.AddAccountFlag("multi-identical-reply") 69 + //c.ReportAccount(automod.ReportReasonRude, fmt.Sprintf("possible spam (young account, %d identical reply-posts today)", tag)) 68 70 c.Notify("slack") 69 71 } 70 72