Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ Add combo hashtag rule #736

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions automod/rules/hashtags.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ import (

// looks for specific hashtags from known lists
func BadHashtagsPostRule(c *automod.RecordContext, post *appbsky.FeedPost) error {
// In cases where we have a soft signaling hashtag that are problematic in combination with other hashtags
// we'd want to check the record contains the combination before taking any action
potentiallyBadHashtags := []string{}
potentiallyBadHashtagCombo := []string{}

for _, tag := range ExtractHashtagsPost(post) {
tag = NormalizeHashtag(tag)
// skip some bad-word hashtags which frequently false-positive
Expand All @@ -19,6 +24,16 @@ func BadHashtagsPostRule(c *automod.RecordContext, post *appbsky.FeedPost) error
if c.InSet("bad-hashtags", tag) || c.InSet("bad-words", tag) {
c.AddRecordFlag("bad-hashtag")
c.ReportRecord(automod.ReportReasonRude, fmt.Sprintf("possible bad word in hashtags: %s", tag))

if c.InSet("potentially-bad-hashtags", tag) {
potentiallyBadHashtags = append(potentiallyBadHashtags, tag)
break
}
if c.InSet("potentially-bad-hashtag-combos", tag) {
potentiallyBadHashtagCombo = append(potentiallyBadHashtagCombo, tag)
break
}

break
}
word := keyword.SlugContainsExplicitSlur(keyword.Slugify(tag))
Expand All @@ -28,6 +43,13 @@ func BadHashtagsPostRule(c *automod.RecordContext, post *appbsky.FeedPost) error
break
}
}

if len(potentiallyBadHashtagCombo) > 0 && len(potentiallyBadHashtags) > 0 {
c.AddRecordFlag("bad-hashtag-combo")
c.ReportRecord(automod.ReportReasonRude, fmt.Sprintf("bad hashtag combo: %s %s. account will be taken down", potentiallyBadHashtagCombo, potentiallyBadHashtags))
c.TakedownAccount()
}

return nil
}

Expand Down
Loading