Skip to content

Commit

Permalink
Update MessageDelete to state a message was deleted if not cached
Browse files Browse the repository at this point in the history
  • Loading branch information
SimplyJpk committed Jan 4, 2024
1 parent 25429fb commit c42a53b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions DiscordBot/Services/ModerationService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ public ModerationService(DiscordSocketClient client, BotSettings settings, ILogg

private async Task MessageDeleted(Cacheable<IMessage, ulong> message, Cacheable<IMessageChannel, ulong> channel)
{
if (message.HasValue == false)
{
await _loggingService.LogChannelAndFile($"An uncached Message snowflake:`{message.Id}` was deleted from channel <#{(await channel.GetOrDownloadAsync()).Id}>");
return;
}

if (message.Value.Author.IsBot || channel.Id == _settings.BotAnnouncementChannel.Id)
return;
// Check the author is even in the guild
Expand Down

0 comments on commit c42a53b

Please sign in to comment.