Skip to content

Commit 98e00cd

Browse files
Merge pull request #58 from nullinside-development-group/feature/UpdateBotRules
Adding bot messages and test messages
2 parents 8843b93 + feffbf6 commit 98e00cd

File tree

4 files changed

+7
-6
lines changed

4 files changed

+7
-6
lines changed

src/Nullinside.Api.TwitchBot.Tests/ChatRules/BestCheapViewersTests.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ public class BestCheapViewersTests : AChatRuleUnitTestBase<BestCheapViewers> {
1414
/// </summary>
1515
/// <param name="badString">The string that should fail.</param>
1616
[Test]
17+
[TestCase("Best\u036e vie\u0350wers \u0337on ***")]
1718
[TestCase("Best viewers on ***")]
1819
[TestCase("Best viewers on ***")]
1920
[TestCase("Best vie̮wers on ***")]

src/Nullinside.Api.TwitchBot.Tests/ChatRules/DoghypeTests.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ public class DogehypeTests : AChatRuleUnitTestBase<Dogehype> {
1414
/// </summary>
1515
/// <param name="badString">The string that should fail.</param>
1616
[Test]
17+
[TestCase("Visit dogehype dot com and watch your channel grow today! @5MGxTnYl")]
18+
[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")]
1719
[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")]
1820
public async Task TestKnownStrings(string badString) {
1921
var rule = new Dogehype();

src/Nullinside.Api.TwitchBot.Tests/ChatRules/NezhnaTests.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ public class NezhnaTests : AChatRuleUnitTestBase<Nezhna> {
1414
/// </summary>
1515
/// <param name="badString">The string that should fail.</param>
1616
[Test]
17+
[TestCase("Visit nezhna .com and watch your channel grow today! @gG6SC5d3")]
18+
[TestCase("Visit nezhna dot com to boost your viewers and climb the Twitch rankings. Join thousands of successful streamers now! @0tlVpgrw")]
1719
[TestCase("Visit nezhna dot com com to boost your viewers and climb the Twitch rankings. Join thousands of successful streamers now! @7xgkq3EK")]
1820
public async Task TestKnownStrings(string badString) {
1921
var rule = new Nezhna();

src/Nullinside.Api.TwitchBot/ChatRules/Nezhna.cs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ namespace Nullinside.Api.TwitchBot.ChatRules;
1010
/// Handles the "nezhna dot com" bots.
1111
/// </summary>
1212
public class Nezhna : AChatRule {
13-
private const string SPAM = "Visit nezhna dot com com to boost your viewers and climb the Twitch rankings. Join thousands of successful streamers now!";
13+
private const string SPAM = "nezhna";
1414

1515
/// <inheritdoc />
1616
public override bool ShouldRun(TwitchUserConfig config) {
@@ -24,11 +24,7 @@ public override async Task<bool> Handle(string channelId, ITwitchApiProxy botPro
2424
return true;
2525
}
2626

27-
// The number of spaces per message may chance, so normalize that and lowercase it for comparison.
28-
string normalized = string.Join(' ', message.Message.Split(" ").Where(s => !string.IsNullOrWhiteSpace(s)))
29-
.ToLowerInvariant();
30-
31-
if (normalized.StartsWith(SPAM, StringComparison.InvariantCultureIgnoreCase)) {
27+
if (message.Message.Contains(SPAM, StringComparison.InvariantCultureIgnoreCase)) {
3228
await BanAndLog(channelId, botProxy, new[] { (message.UserId, message.Username) },
3329
"[Bot] Spam (Nezhna)", db, stoppingToken);
3430
return false;

0 commit comments

Comments
 (0)