diff --git a/src/VahterBanBot/Bot.fs b/src/VahterBanBot/Bot.fs index 324ebee..591db81 100644 --- a/src/VahterBanBot/Bot.fs +++ b/src/VahterBanBot/Bot.fs @@ -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}" @@ -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