Skip to content

Commit

Permalink
automod: fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
bnewbold committed Nov 29, 2023
1 parent 239cce2 commit f2880bc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions automod/event.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,13 +120,13 @@ func (e *RepoEvent) PersistAccountActions(ctx context.Context) error {
if newTakedown || len(newLabels) > 0 || len(newFlags) > 0 || len(newReports) > 0 {
if e.Engine.SlackWebhookURL != "" {
msg := fmt.Sprintf("⚠️ Automod Account Action ⚠️\n")
msg += fmt.Sprintf("`%s` / `%s` / [bsky](https://bsky.app/profile/%s) / [ozone](https://admin.prod.bsky.dev/repositories/%s)\n",
msg += fmt.Sprintf("`%s` / `%s` / <https://bsky.app/profile/%s|bsky> / <https://admin.prod.bsky.dev/repositories/%s|ozone>\n",
e.Account.Identity.DID,
e.Account.Identity.Handle,
e.Account.Identity.DID,
e.Account.Identity.DID,
)
msg += slackBody(msg, newLabels, newFlags, newReports, newTakedown)
msg = slackBody(msg, newLabels, newFlags, newReports, newTakedown)
if err := e.Engine.SendSlackMsg(ctx, msg); err != nil {
e.Logger.Error("sending slack webhook", "err", err)
}
Expand Down Expand Up @@ -262,14 +262,14 @@ func (e *RecordEvent) PersistRecordActions(ctx context.Context) error {
if newTakedown || len(newLabels) > 0 || len(newFlags) > 0 || len(newReports) > 0 {
if e.Engine.SlackWebhookURL != "" {
msg := fmt.Sprintf("⚠️ Automod Record Action ⚠️\n")
msg += fmt.Sprintf("`%s` / `%s` / [bsky](https://bsky.app/profile/%s) / [ozone](https://admin.prod.bsky.dev/repositories/%s)\n",
msg += fmt.Sprintf("`%s` / `%s` / <https://bsky.app/profile/%s|bsky> / <https://admin.prod.bsky.dev/repositories/%s|ozone>\n",
e.Account.Identity.DID,
e.Account.Identity.Handle,
e.Account.Identity.DID,
e.Account.Identity.DID,
)
msg += fmt.Sprintf("`at://%s/%s/%s`", e.Account.Identity.DID, e.Collection, e.RecordKey)
msg += slackBody(msg, newLabels, newFlags, newReports, newTakedown)
msg += fmt.Sprintf("`at://%s/%s/%s`\n", e.Account.Identity.DID, e.Collection, e.RecordKey)
msg = slackBody(msg, newLabels, newFlags, newReports, newTakedown)
if err := e.Engine.SendSlackMsg(ctx, msg); err != nil {
e.Logger.Error("sending slack webhook", "err", err)
}
Expand Down
4 changes: 2 additions & 2 deletions automod/rules/gtube.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ var gtubeString = "XJS*C4JDBQADN1.NSBN3*2IDNEN*GTUBE-STANDARD-ANTI-UBE-TEST-EMAI

func GtubePostRule(evt *automod.RecordEvent, post *appbsky.FeedPost) error {
if strings.Contains(post.Text, gtubeString) {
evt.AddRecordLabel("gtube")
evt.AddRecordLabel("spam")
}
return nil
}

func GtubeProfileRule(evt *automod.RecordEvent, profile *appbsky.ActorProfile) error {
if profile.Description != nil && strings.Contains(*profile.Description, gtubeString) {
evt.AddRecordLabel("gtube")
evt.AddRecordLabel("spam")
}
return nil
}

0 comments on commit f2880bc

Please sign in to comment.