diff --git a/Modules/ModLogs/ModLogs_Messages.cs b/Modules/ModLogs/ModLogs_Messages.cs index c6859e2..7f1714b 100644 --- a/Modules/ModLogs/ModLogs_Messages.cs +++ b/Modules/ModLogs/ModLogs_Messages.cs @@ -13,6 +13,7 @@ internal partial class ModLogs { private async Task HandleDelete(Cacheable argMsg, Cacheable argChannel) { const int MaxPreviewLength = 750; if (argChannel.Value is not SocketTextChannel channel) return; + var conf = GetGuildState(channel.Guild.Id); if ((conf?.LogMessageDeletions ?? false) == false) return; var reportChannel = conf?.ReportingChannel?.FindChannelIn(channel.Guild, true); @@ -71,6 +72,7 @@ internal partial class ModLogs { var channel = (SocketTextChannel)newMsg.Channel; var conf = GetGuildState(channel.Guild.Id); + if (newMsg.Author.IsBot || newMsg.Author.IsWebhook) return; var reportChannel = conf?.ReportingChannel?.FindChannelIn(channel.Guild, true); if (reportChannel == null) return; if (reportChannel.Id == channel.Id) { diff --git a/Services/EntityCache/MessageCachingSubservice.cs b/Services/EntityCache/MessageCachingSubservice.cs index 8346da6..5c54f1a 100644 --- a/Services/EntityCache/MessageCachingSubservice.cs +++ b/Services/EntityCache/MessageCachingSubservice.cs @@ -17,13 +17,14 @@ class MessageCachingSubservice { // This event is fired also when a link preview embed is added to a message. In those situations, the message's edited timestamp // remains null, in addition to having other unusual and unexpected properties. We are not interested in these. if (!arg2.EditedTimestamp.HasValue) return Task.CompletedTask; + if (arg2.Author.IsBot || arg2.Author.IsWebhook) return Task.CompletedTask; // we don't log these anyway, so don't pass them on return AddOrUpdateCacheItemAsync(arg2, true); } private async Task AddOrUpdateCacheItemAsync(SocketMessage arg, bool isUpdate) { //if (!Common.Utilities.IsValidUserMessage(arg, out _)) return; if (arg.Channel is not SocketTextChannel) return; - if (arg.Author.IsWebhook) return; // do get bot messages, don't get webhooks + if (arg.Author.IsBot || arg.Author.IsWebhook) return; // do not get messages from an automated source if (((IMessage)arg).Type != MessageType.Default) return; if (arg is SocketSystemMessage) return;