From d26ce79b70a57178996099024526ba1e91ff70cb 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: Tue, 10 Jun 2025 19:23:49 -0400 Subject: [PATCH 1/2] chore: adding configuration file This is a configuration file required by Rider to ensure pre-released versions of .NET are not used. Not sure how standard this file is but it doesn't hurt anything. --- src/global.json | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 src/global.json diff --git a/src/global.json b/src/global.json new file mode 100644 index 0000000..eafb435 --- /dev/null +++ b/src/global.json @@ -0,0 +1,6 @@ +{ + "sdk": { + "rollForward": "latestMajor", + "allowPrerelease": false + } +} \ No newline at end of file From a8bd751cc6a1cbb9f35306bddefd6f69ebc3fe29 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: Tue, 10 Jun 2025 19:25:12 -0400 Subject: [PATCH 2/2] Revert "feat: joining more chats for more data" This reverts commit 7216e11269d8d306fea5984ad66637ca13cb52e7. This was better in theory than practice. The joining of channels got so backed up that it took 17 minutes to finish the first loop of joins. Meaning anyone that goes live between 0-17 minutes of the application starting up will not be joined until the 17 minutes is over. --- .../Services/MainService.cs | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/src/Nullinside.Api.TwitchBot/Services/MainService.cs b/src/Nullinside.Api.TwitchBot/Services/MainService.cs index f9cf143..5859b05 100644 --- a/src/Nullinside.Api.TwitchBot/Services/MainService.cs +++ b/src/Nullinside.Api.TwitchBot/Services/MainService.cs @@ -180,22 +180,13 @@ protected override Task ExecuteAsync(CancellationToken stoppingToken) { // Join all the channels we're a mod in. Why do we limit it to channels we are a mod in? Twitch changed // its chat limits so that "verified bots" like us don't get special treatment anymore. The only thing // that skips the chat limits is if it's a channel you're a mod in. - var bannedUsers = (await GetBannedUsers(db, stoppingToken)) - .Where(u => !string.IsNullOrWhiteSpace(u.TwitchId)) - .Select(u => u.TwitchId!.Trim()) - .ToHashSet(); - var allModdedAndNotBannedUsers = moddedChannels - .Where(m => !bannedUsers.Contains(m.broadcaster_id)); - var joinChannels = usersWithBotEnabled - .Select(u => u.TwitchUsername) - .Concat(allModdedAndNotBannedUsers.Select(j => j.broadcaster_login)); - foreach (var channel in joinChannels) { - if (string.IsNullOrWhiteSpace(channel)) { + foreach (User channel in usersWithBotEnabled) { + if (string.IsNullOrWhiteSpace(channel.TwitchUsername)) { continue; } - await _client.AddMessageCallback(channel, OnTwitchMessageReceived); - await _client.AddBannedCallback(channel, OnTwitchBanReceived); + await _client.AddMessageCallback(channel.TwitchUsername, OnTwitchMessageReceived); + await _client.AddBannedCallback(channel.TwitchUsername, OnTwitchBanReceived); } } @@ -299,7 +290,7 @@ orderby user.TwitchLastScanned /// The database. /// The stopping token. /// The list of users with the bot enabled. - private async Task> GetBannedUsers(INullinsideContext db, CancellationToken stoppingToken) { + private async Task?> GetBannedUsers(INullinsideContext db, CancellationToken stoppingToken) { return await (from user in db.Users orderby user.TwitchLastScanned