this repo has no description
0
fork

Configure Feed

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

add `IdenticalReplyPostSameParentRule` to automod (#746)

adds a spam label to accounts that are under 24 hours doing this,
otherwise just reports. maybe too hasty on the label, can adjust. (note
our client really doesn't make it easy to make an identical post
multiple times in a row like this, where even failures will usually
close the composer anyway, so its likely to be intentional). same could
probably be applied for same author but with a maybe higher limit

authored by

bnewbold and committed by
GitHub
2462d586 a4f38639

+36
+1
automod/rules/all.go
··· 20 20 ReplySingleBadWordPostRule, 21 21 AggressivePromotionRule, 22 22 IdenticalReplyPostRule, 23 + IdenticalReplyPostSameParentRule, 23 24 DistinctMentionsRule, 24 25 YoungAccountDistinctMentionsRule, 25 26 MisleadingLinkUnicodeReversalPostRule,
+35
automod/rules/replies.go
··· 78 78 return nil 79 79 } 80 80 81 + // Similar to above rule but only counts replies to the same post. More aggressively applies a spam label to new accounts that are less than a day old. 82 + var identicalReplySameParentLimit = 3 83 + var identicalReplySameParentMaxAge = 24 * time.Hour 84 + var identicalReplySameParentMaxPosts int64 = 50 85 + var _ automod.PostRuleFunc = IdenticalReplyPostSameParentRule 86 + 87 + func IdenticalReplyPostSameParentRule(c *automod.RecordContext, post *appbsky.FeedPost) error { 88 + if post.Reply == nil || IsSelfThread(c, post) { 89 + return nil 90 + } 91 + 92 + if ParentOrRootIsFollower(c, post) { 93 + return nil 94 + } 95 + 96 + postCount := c.Account.PostsCount 97 + if AccountIsOlderThan(&c.AccountContext, identicalReplySameParentMaxAge) || postCount >= identicalReplySameParentMaxPosts { 98 + return nil 99 + } 100 + 101 + period := countstore.PeriodHour 102 + bucket := c.Account.Identity.DID.String() + "/" + post.Reply.Parent.Uri + "/" + HashOfString(post.Text) 103 + c.IncrementPeriod("reply-text-same-post", bucket, period) 104 + 105 + count := c.GetCount("reply-text-same-post", bucket, period) 106 + if count >= identicalReplySameParentLimit { 107 + c.AddAccountFlag("multi-identical-reply-same-post") 108 + c.ReportAccount(automod.ReportReasonSpam, fmt.Sprintf("possible spam (%d identical reply-posts to same post today)", count)) 109 + c.AddAccountLabel("spam") 110 + c.Notify("slack") 111 + } 112 + 113 + return nil 114 + } 115 + 81 116 // TODO: bumping temporarily 82 117 // var youngReplyAccountLimit = 12 83 118 var youngReplyAccountLimit = 30