···7788var _ automod.PostRuleFunc = DistinctMentionsRule
991010-var mentionHourlyThreshold = 20
1010+var mentionHourlyThreshold = 40
11111212// DistinctMentionsRule looks for accounts which mention an unusually large number of distinct accounts per period.
1313func DistinctMentionsRule(evt *automod.RecordEvent, post *appbsky.FeedPost) error {
+14-5
automod/rules/replies.go
···11package rules
2233import (
44+ "time"
45 "unicode/utf8"
5667 appbsky "github.com/bluesky-social/indigo/api/bsky"
···3132 return nil
3233}
33343535+// triggers on the N+1 post, so 6th identical reply
3436var identicalReplyLimit = 5
35373638// Looks for accounts posting the exact same text multiple times. Does not currently count the number of distinct accounts replied to, just counts replies at all.
···4143 return nil
4244 }
43454444- // short reply? ignore it
4646+ // increment first. use a specific period (IncrementPeriod()) to reduce the number of counters (one per unique post text)
4747+ period := automod.PeriodDay
4848+ bucket := evt.Account.Identity.DID.String() + "/" + HashOfString(post.Text)
4949+ evt.IncrementPeriod("reply-text", bucket, period)
5050+5151+ // don't action short replies, or accounts more than two weeks old
4552 if utf8.RuneCountInString(post.Text) <= 10 {
4653 return nil
4754 }
5555+ if evt.Account.Private != nil {
5656+ age := time.Since(evt.Account.Private.IndexedAt)
5757+ if age > 2*7*24*time.Hour {
5858+ return nil
5959+ }
6060+ }
48614949- // use a specific period (IncrementPeriod()) to reduce the number of counters (one per unique post text)
5050- period := automod.PeriodDay
5151- bucket := evt.Account.Identity.DID.String() + "/" + HashOfString(post.Text)
5262 if evt.GetCount("reply-text", bucket, period) >= identicalReplyLimit {
5363 evt.AddAccountFlag("multi-identical-reply")
5464 }
55655656- evt.IncrementPeriod("reply-text", bucket, period)
5766 return nil
5867}