From 65c8f42e50823355b94abcc0baf2c2c84a1d7e98 Mon Sep 17 00:00:00 2001 From: FloatingMilkshake Date: Sat, 16 Mar 2024 03:51:59 +0100 Subject: [PATCH] /track: ignore presence sensing in dbots #ultimate-shitposting probably not the best way to do things, but it avoids ratelimit spam that i don't care to deal with another way --- Helpers/KeywordTrackingHelpers.cs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/Helpers/KeywordTrackingHelpers.cs b/Helpers/KeywordTrackingHelpers.cs index 01b1d5c..b5c44b9 100644 --- a/Helpers/KeywordTrackingHelpers.cs +++ b/Helpers/KeywordTrackingHelpers.cs @@ -13,8 +13,14 @@ public static async Task KeywordCheck(DiscordMessage message, bool isEdit = fals if (message.Channel.IsPrivate) return; - await Task.Delay(30000); - var messagesAfter30Sec = await message.Channel.GetMessagesAfterAsync(message.Id); + // Wait 30 seconds in case the user sends a message; if they do, ignore + // Do not fetch messages if we are in dbots #ultimate-shitposting, it causes too many ratelimits + IReadOnlyList messagesAfter30Sec = default; + if (message.Channel.Id != 119222314964353025) + { + await Task.Delay(30000); + messagesAfter30Sec = await message.Channel.GetMessagesAfterAsync(message.Id); + } var fields = await Program.Db.HashGetAllAsync("keywords"); @@ -84,8 +90,7 @@ public static async Task KeywordCheck(DiscordMessage message, bool isEdit = fals if (fieldValue.GuildId != default && fieldValue.GuildId != message.Channel.Guild.Id) continue; - // Wait 30 seconds in case the user sends a message; if they do, ignore - //var messagesAfter30Sec = await message.Channel.GetMessagesAfterAsync(message.Id); + // After waiting 30 seconds, if the user has sent a message, ignore if (messagesAfter30Sec.Any(x => x.Author.Id == fieldValue.UserId)) continue;