Skip to content

Commit

Permalink
add debug logging for non-spam detection details
Browse files Browse the repository at this point in the history
  • Loading branch information
umputun committed Dec 11, 2023
1 parent 67b7034 commit 46b54cc
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions app/bot/spam.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ func (s *SpamFilter) OnMessage(msg Message) (response Response) {
return Response{Text: spamRespMsg, Send: true, ReplyTo: msg.ID, BanInterval: PermanentBanDuration,
DeleteReplyTo: true, User: User{Username: msg.From.Username, ID: msg.From.ID, DisplayName: msg.From.DisplayName},
}
} else {

Check warning on line 84 in app/bot/spam.go

View workflow job for this annotation

GitHub Actions / build

indent-error-flow: if block ends with a return statement, so drop this else and outdent its block (revive)
log.Printf("[DEBUG] user %s is not a spammer, %+v", displayUsername, checkResults)
}
return Response{} // not a spam
}
Expand Down
2 changes: 1 addition & 1 deletion app/bot/spam_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func TestSpamFilter_OnMessage(t *testing.T) {
if msg == "spam" {
return true, []lib.CheckResult{{Name: "something", Spam: true, Details: "some spam"}}
}
return false, nil
return false, []lib.CheckResult{{Name: "already approved", Spam: false, Details: "some ham"}}
},
}

Expand Down

0 comments on commit 46b54cc

Please sign in to comment.