From 90164e57ea378aff154b97e278d87e72a559ac38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=E2=96=88=E2=96=88=E2=96=88=E2=96=88=E2=96=88?= Date: Sun, 9 Feb 2025 16:30:31 -0500 Subject: [PATCH 1/2] feat: Updated logic for discord scam detection --- .../ChatRules/BestCheapViewersTests.cs | 4 ++++ src/Nullinside.Api.TwitchBot/ChatRules/Discord.cs | 8 +++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/Nullinside.Api.TwitchBot.Tests/ChatRules/BestCheapViewersTests.cs b/src/Nullinside.Api.TwitchBot.Tests/ChatRules/BestCheapViewersTests.cs index 40141a0..4984d8a 100644 --- a/src/Nullinside.Api.TwitchBot.Tests/ChatRules/BestCheapViewersTests.cs +++ b/src/Nullinside.Api.TwitchBot.Tests/ChatRules/BestCheapViewersTests.cs @@ -15,6 +15,10 @@ public class BestCheapViewersTests : AChatRuleUnitTestBase { /// /// The string that should fail. [Test] + [TestCase("B͐est vi̯ewers o͎n on streamboo .com ( remove the space ) @9F3Wnft0")] + [TestCase("Ch̚eͅap viewers on *** @STGPMoLg")] + [TestCase("C̭heap viewe͌rs on̆ *** @R1QXrXPM")] + [TestCase("C̭heap viewe͌rs on̆ vwrpro.ru @8v2JcQFL")] [TestCase("C\u032dheap viewe\u034crs on\u0306 vwrpro.ru @8v2JcQFL")] [TestCase("Ch\u031ae\u0345ap viewers on *** @STGPMoLg")] [TestCase("Best\u036e vie\u0350wers \u0337on ***")] diff --git a/src/Nullinside.Api.TwitchBot/ChatRules/Discord.cs b/src/Nullinside.Api.TwitchBot/ChatRules/Discord.cs index 54708d5..ca037d1 100644 --- a/src/Nullinside.Api.TwitchBot/ChatRules/Discord.cs +++ b/src/Nullinside.Api.TwitchBot/ChatRules/Discord.cs @@ -13,9 +13,11 @@ namespace Nullinside.Api.TwitchBot.ChatRules; /// public class Discord : AChatRule { private readonly string[] KNOWN_PHRASES = [ - "add me on discord", - "my username is", - "my discord username is", + "add me", + "message me", + "chat with me", + "my discord username", + "my username", "connect on discord" ]; From 437477563178c0d24126d80d358ec43ce56f9738 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=E2=96=88=E2=96=88=E2=96=88=E2=96=88=E2=96=88?= Date: Sun, 9 Feb 2025 16:34:42 -0500 Subject: [PATCH 2/2] feat: Improve the logging of chat messages with exceptions Adding in the chatter's username, id, and message to the exception logging for failing to process chat messages closes #63 --- .../ChatRules/TwitchChatMessageMonitorConsumer.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Nullinside.Api.TwitchBot/ChatRules/TwitchChatMessageMonitorConsumer.cs b/src/Nullinside.Api.TwitchBot/ChatRules/TwitchChatMessageMonitorConsumer.cs index 239d002..f36ef69 100644 --- a/src/Nullinside.Api.TwitchBot/ChatRules/TwitchChatMessageMonitorConsumer.cs +++ b/src/Nullinside.Api.TwitchBot/ChatRules/TwitchChatMessageMonitorConsumer.cs @@ -4,6 +4,8 @@ using Microsoft.EntityFrameworkCore; +using Mysqlx.Expr; + using Nullinside.Api.Common.Twitch; using Nullinside.Api.Model; using Nullinside.Api.Model.Ddl; @@ -160,7 +162,7 @@ private async void MainLoop() { } } catch (Exception e) { - LOG.Error($"{channel}: Failed to evaluate rule", e); + LOG.Error($"{channel}: Failed to evaluate rule on {message.Username}({message.UserId}): {message.Message}", e); } } }