From fc8826b37f3554fc9572fd31b243f1fe7f435601 Mon Sep 17 00:00:00 2001 From: Noi Date: Sat, 3 Dec 2022 17:21:42 -0800 Subject: [PATCH] Also cache bot messages --- Services/EntityCache/MessageCachingSubservice.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Services/EntityCache/MessageCachingSubservice.cs b/Services/EntityCache/MessageCachingSubservice.cs index 6f4f894..8346da6 100644 --- a/Services/EntityCache/MessageCachingSubservice.cs +++ b/Services/EntityCache/MessageCachingSubservice.cs @@ -21,7 +21,11 @@ class MessageCachingSubservice { } private async Task AddOrUpdateCacheItemAsync(SocketMessage arg, bool isUpdate) { - if (!Common.Utilities.IsValidUserMessage(arg, out _)) return; + //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 (((IMessage)arg).Type != MessageType.Default) return; + if (arg is SocketSystemMessage) return; using var db = new BotDatabaseContext(); CachedGuildMessage? cachedMsg = db.GuildMessageCache.Where(m => m.MessageId == (long)arg.Id).SingleOrDefault();