Skip to content

Commit

Permalink
automod: report bad-rules (not just flag)
Browse files Browse the repository at this point in the history
  • Loading branch information
bnewbold committed Dec 18, 2023
1 parent 6075bea commit 39d60b4
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions automod/rules/keyword.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package rules

import (
"fmt"

appbsky "github.com/bluesky-social/indigo/api/bsky"
"github.com/bluesky-social/indigo/automod"
)
Expand All @@ -9,6 +11,7 @@ func KeywordPostRule(evt *automod.RecordEvent, post *appbsky.FeedPost) error {
for _, tok := range ExtractTextTokensPost(post) {
if evt.InSet("bad-words", tok) {
evt.AddRecordFlag("bad-word")
evt.ReportRecord(automod.ReportReasonRude, fmt.Sprintf("bad-word: %s", tok))
break
}
}
Expand All @@ -19,6 +22,7 @@ func KeywordProfileRule(evt *automod.RecordEvent, profile *appbsky.ActorProfile)
for _, tok := range ExtractTextTokensProfile(profile) {
if evt.InSet("bad-words", tok) {
evt.AddRecordFlag("bad-word")
evt.ReportRecord(automod.ReportReasonRude, fmt.Sprintf("bad-word: %s", tok))
break
}
}
Expand Down

0 comments on commit 39d60b4

Please sign in to comment.