diff --git a/src/Nullinside.Api.TwitchBot.Tests/ChatRules/BestCheapViewersTests.cs b/src/Nullinside.Api.TwitchBot.Tests/ChatRules/BestCheapViewersTests.cs index 705974f..07e6cf1 100644 --- a/src/Nullinside.Api.TwitchBot.Tests/ChatRules/BestCheapViewersTests.cs +++ b/src/Nullinside.Api.TwitchBot.Tests/ChatRules/BestCheapViewersTests.cs @@ -14,6 +14,7 @@ public class BestCheapViewersTests : AChatRuleUnitTestBase { /// /// The string that should fail. [Test] + [TestCase("Best\u036e vie\u0350wers \u0337on ***")] [TestCase("Best viewers on ***")] [TestCase("Best viewers on ***")] [TestCase("Best vie̮wers on ***")] diff --git a/src/Nullinside.Api.TwitchBot.Tests/ChatRules/DoghypeTests.cs b/src/Nullinside.Api.TwitchBot.Tests/ChatRules/DoghypeTests.cs index 8f8508b..d628e34 100644 --- a/src/Nullinside.Api.TwitchBot.Tests/ChatRules/DoghypeTests.cs +++ b/src/Nullinside.Api.TwitchBot.Tests/ChatRules/DoghypeTests.cs @@ -14,6 +14,8 @@ public class DogehypeTests : AChatRuleUnitTestBase { /// /// The string that should fail. [Test] + [TestCase("Visit dogehype dot com and watch your channel grow today! @5MGxTnYl")] + [TestCase("Visit dogehype dot com today and climb the Twitch rankings with ease! Whether you're just starting out or looking to take your stream to the next level, DogeHype has the tools you need to succeed. @gqznceDC")] [TestCase("Visit dogehype .biz com today and climb the Twitch rankings with ease! Whether you're just starting out or looking to take your stream to the next level, DogeHype has the tools you need to succeed. @Axxq7ntz")] public async Task TestKnownStrings(string badString) { var rule = new Dogehype(); diff --git a/src/Nullinside.Api.TwitchBot.Tests/ChatRules/NezhnaTests.cs b/src/Nullinside.Api.TwitchBot.Tests/ChatRules/NezhnaTests.cs index c5906f1..e2c3f2d 100644 --- a/src/Nullinside.Api.TwitchBot.Tests/ChatRules/NezhnaTests.cs +++ b/src/Nullinside.Api.TwitchBot.Tests/ChatRules/NezhnaTests.cs @@ -14,6 +14,8 @@ public class NezhnaTests : AChatRuleUnitTestBase { /// /// The string that should fail. [Test] + [TestCase("Visit nezhna .com and watch your channel grow today! @gG6SC5d3")] + [TestCase("Visit nezhna dot com to boost your viewers and climb the Twitch rankings. Join thousands of successful streamers now! @0tlVpgrw")] [TestCase("Visit nezhna dot com com to boost your viewers and climb the Twitch rankings. Join thousands of successful streamers now! @7xgkq3EK")] public async Task TestKnownStrings(string badString) { var rule = new Nezhna(); diff --git a/src/Nullinside.Api.TwitchBot/ChatRules/Nezhna.cs b/src/Nullinside.Api.TwitchBot/ChatRules/Nezhna.cs index 4ac302a..4548584 100644 --- a/src/Nullinside.Api.TwitchBot/ChatRules/Nezhna.cs +++ b/src/Nullinside.Api.TwitchBot/ChatRules/Nezhna.cs @@ -10,7 +10,7 @@ namespace Nullinside.Api.TwitchBot.ChatRules; /// Handles the "nezhna dot com" bots. /// public class Nezhna : AChatRule { - private const string SPAM = "Visit nezhna dot com com to boost your viewers and climb the Twitch rankings. Join thousands of successful streamers now!"; + private const string SPAM = "nezhna"; /// public override bool ShouldRun(TwitchUserConfig config) { @@ -24,11 +24,7 @@ public override async Task Handle(string channelId, ITwitchApiProxy botPro return true; } - // The number of spaces per message may chance, so normalize that and lowercase it for comparison. - string normalized = string.Join(' ', message.Message.Split(" ").Where(s => !string.IsNullOrWhiteSpace(s))) - .ToLowerInvariant(); - - if (normalized.StartsWith(SPAM, StringComparison.InvariantCultureIgnoreCase)) { + if (message.Message.Contains(SPAM, StringComparison.InvariantCultureIgnoreCase)) { await BanAndLog(channelId, botProxy, new[] { (message.UserId, message.Username) }, "[Bot] Spam (Nezhna)", db, stoppingToken); return false;