this repo has no description
0
fork

Configure Feed

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

automod: Tweak conditions for repost spam detection

authored by

Foysal Ahamed and committed by
bnewbold
ec001d7b 4fff3112

+7 -5
+7 -5
automod/rules/reposts.go
··· 7 7 "github.com/bluesky-social/indigo/automod/countstore" 8 8 ) 9 9 10 - var repostDailyThreshold = 500 10 + var dailyRepostThresholdWithoutPost = 20 11 + var dailyRepostThresholdWithLowPost = 100 12 + var dailyPostThresholdWithHighRepost = 5 11 13 12 14 var _ automod.RecordRuleFunc = TooManyRepostRule 13 15 ··· 29 31 case "app.bsky.feed.repost": 30 32 c.Increment("repost", did) 31 33 // +1 to avoid potential divide by 0 issue 32 - repostCount := c.GetCount("repost", did, countstore.PeriodDay) + 1 33 - postCount := c.GetCount("post", did, countstore.PeriodDay) + 1 34 - ratio := float64(repostCount) / float64(postCount) 35 - if repostCount > repostDailyThreshold && ratio > 0.8 { 34 + repostCount := c.GetCount("repost", did, countstore.PeriodDay) 35 + postCount := c.GetCount("post", did, countstore.PeriodDay) 36 + highRepost := (repostCount >= dailyRepostThresholdWithoutPost && postCount < 1) || (repostCount >= dailyRepostThresholdWithLowPost && postCount < dailyPostThresholdWithHighRepost) 37 + if highRepost { 36 38 c.Logger.Info("high-repost-count", "reposted-today", repostCount, "posted-today", postCount) 37 39 c.AddAccountFlag("high-repost-count") 38 40 // c.ReportAccount(automod.ReportReasonSpam, fmt.Sprintf("too many reposts: %d reposts, %d posts today (so far)", repostCount, postCount))