this repo has no description
0
fork

Configure Feed

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

small rule tweaks (#489)

authored by

bnewbold and committed by
GitHub
4ee97204 76f332e9

+15 -6
+1 -1
automod/rules/mentions.go
··· 7 7 8 8 var _ automod.PostRuleFunc = DistinctMentionsRule 9 9 10 - var mentionHourlyThreshold = 20 10 + var mentionHourlyThreshold = 40 11 11 12 12 // DistinctMentionsRule looks for accounts which mention an unusually large number of distinct accounts per period. 13 13 func DistinctMentionsRule(evt *automod.RecordEvent, post *appbsky.FeedPost) error {
+14 -5
automod/rules/replies.go
··· 1 1 package rules 2 2 3 3 import ( 4 + "time" 4 5 "unicode/utf8" 5 6 6 7 appbsky "github.com/bluesky-social/indigo/api/bsky" ··· 31 32 return nil 32 33 } 33 34 35 + // triggers on the N+1 post, so 6th identical reply 34 36 var identicalReplyLimit = 5 35 37 36 38 // 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. ··· 41 43 return nil 42 44 } 43 45 44 - // short reply? ignore it 46 + // increment first. use a specific period (IncrementPeriod()) to reduce the number of counters (one per unique post text) 47 + period := automod.PeriodDay 48 + bucket := evt.Account.Identity.DID.String() + "/" + HashOfString(post.Text) 49 + evt.IncrementPeriod("reply-text", bucket, period) 50 + 51 + // don't action short replies, or accounts more than two weeks old 45 52 if utf8.RuneCountInString(post.Text) <= 10 { 46 53 return nil 47 54 } 55 + if evt.Account.Private != nil { 56 + age := time.Since(evt.Account.Private.IndexedAt) 57 + if age > 2*7*24*time.Hour { 58 + return nil 59 + } 60 + } 48 61 49 - // use a specific period (IncrementPeriod()) to reduce the number of counters (one per unique post text) 50 - period := automod.PeriodDay 51 - bucket := evt.Account.Identity.DID.String() + "/" + HashOfString(post.Text) 52 62 if evt.GetCount("reply-text", bucket, period) >= identicalReplyLimit { 53 63 evt.AddAccountFlag("multi-identical-reply") 54 64 } 55 65 56 - evt.IncrementPeriod("reply-text", bucket, period) 57 66 return nil 58 67 }