Also cache bot messages
This commit is contained in:
parent
12f8359b90
commit
fc8826b37f
1 changed files with 5 additions and 1 deletions
|
@ -21,7 +21,11 @@ class MessageCachingSubservice {
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task AddOrUpdateCacheItemAsync(SocketMessage arg, bool isUpdate) {
|
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();
|
using var db = new BotDatabaseContext();
|
||||||
CachedGuildMessage? cachedMsg = db.GuildMessageCache.Where(m => m.MessageId == (long)arg.Id).SingleOrDefault();
|
CachedGuildMessage? cachedMsg = db.GuildMessageCache.Where(m => m.MessageId == (long)arg.Id).SingleOrDefault();
|
||||||
|
|
Loading…
Reference in a new issue