Skip to content

Commit

Permalink
fix nre (#12)
Browse files Browse the repository at this point in the history
* fix nre

* remove bad tags

* add spammer tags
  • Loading branch information
zawodskoj authored Jun 13, 2024
1 parent c0929db commit ea38d2c
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/VahterBanBot/Bot.fs
Original file line number Diff line number Diff line change
Expand Up @@ -392,8 +392,8 @@ let warnSpamDetection
score = task {
use banOnReplyActivity = botActivity.StartActivity("warnSpamDetection")
%banOnReplyActivity
.SetTag("targetId", message.ReplyToMessage.From.Id)
.SetTag("targetUsername", message.ReplyToMessage.From.Username)
.SetTag("spammerId", message.From.Id)
.SetTag("spammerUsername", message.From.Username)

let logMsg = $"Detected spam (score: {score}) in {prependUsername message.Chat.Username} ({message.Chat.Id}) from {prependUsername message.From.Username} ({message.From.Id}) with text:\n{message.Text}"

Expand Down Expand Up @@ -489,10 +489,11 @@ let onUpdate

// if message is not a command from authorized user, just save it ID to DB
else
let spamScore = calcSpamScore message.Text
if message.Text <> null then
let spamScore = calcSpamScore message.Text

if spamScore >= 100 then
do! warnSpamDetection botClient botConfig message logger spamScore
if spamScore >= 100 then
do! warnSpamDetection botClient botConfig message logger spamScore

use _ =
botActivity
Expand Down

0 comments on commit ea38d2c

Please sign in to comment.