Skip to content

Commit

Permalink
/track: ignore presence sensing in dbots #ultimate-shitposting
Browse files Browse the repository at this point in the history
probably not the best way to do things, but it avoids ratelimit spam that i don't care to deal with another way
  • Loading branch information
FloatingMilkshake committed Mar 16, 2024
1 parent 0393024 commit 65c8f42
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions Helpers/KeywordTrackingHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<DiscordMessage> 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");

Expand Down Expand Up @@ -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;

Expand Down

0 comments on commit 65c8f42

Please sign in to comment.