this repo has no description
0
fork

Configure Feed

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

automod: basic trivial harassment rule (#667)

authored by

bnewbold and committed by
GitHub
5321bc31 8d9799f7

+33
+1
automod/rules/all.go
··· 25 25 MisleadingLinkUnicodeReversalPostRule, 26 26 SimpleBotPostRule, 27 27 HarassmentTargetInteractionPostRule, 28 + HarassmentTrivialPostRule, 28 29 }, 29 30 ProfileRules: []automod.ProfileRuleFunc{ 30 31 GtubeProfileRule,
+32
automod/rules/harassment.go
··· 7 7 appbsky "github.com/bluesky-social/indigo/api/bsky" 8 8 "github.com/bluesky-social/indigo/atproto/syntax" 9 9 "github.com/bluesky-social/indigo/automod" 10 + "github.com/bluesky-social/indigo/automod/countstore" 10 11 ) 11 12 12 13 var _ automod.PostRuleFunc = HarassmentTargetInteractionPostRule ··· 59 60 } 60 61 return nil 61 62 } 63 + 64 + var _ automod.PostRuleFunc = HarassmentTrivialPostRule 65 + 66 + // looks for new accounts, which frequently post the same type of content 67 + func HarassmentTrivialPostRule(c *automod.RecordContext, post *appbsky.FeedPost) error { 68 + if c.Account.Private == nil || c.Account.Identity == nil { 69 + return nil 70 + } 71 + // TODO: helper for account age; and use public info for this (not private) 72 + age := time.Since(c.Account.Private.IndexedAt) 73 + if age > 7*24*time.Hour { 74 + return nil 75 + } 76 + 77 + // only posts with dumb pattern 78 + if post.Text != "F" { 79 + return nil 80 + } 81 + 82 + did := c.Account.Identity.DID.String() 83 + c.Increment("trivial-harassing", did) 84 + count := c.GetCount("trivial-harassing", did, countstore.PeriodDay) 85 + 86 + if count > 5 { 87 + //c.AddRecordFlag("trivial-harassing-post") 88 + c.ReportAccount(automod.ReportReasonOther, fmt.Sprintf("possible targetted harassment (also labeled; remove label if this isn't harassment!)")) 89 + c.AddAccountLabel("!hide") 90 + c.Notify("slack") 91 + } 92 + return nil 93 + }