mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-12 08:40:11 +00:00
Avoid deleting messages from the store if they're not webhooks
This commit is contained in:
parent
423d23faf7
commit
aa04d2055e
2 changed files with 5 additions and 1 deletions
|
|
@ -80,7 +80,7 @@ namespace PluralKit.Bot
|
||||||
|
|
||||||
.AddSingleton<IDiscordClient, DiscordShardedClient>(_ => new DiscordShardedClient(new DiscordSocketConfig
|
.AddSingleton<IDiscordClient, DiscordShardedClient>(_ => new DiscordShardedClient(new DiscordSocketConfig
|
||||||
{
|
{
|
||||||
MessageCacheSize = 0,
|
MessageCacheSize = 10,
|
||||||
ExclusiveBulkDelete = true
|
ExclusiveBulkDelete = true
|
||||||
}))
|
}))
|
||||||
.AddSingleton<Bot>()
|
.AddSingleton<Bot>()
|
||||||
|
|
|
||||||
|
|
@ -273,6 +273,10 @@ namespace PluralKit.Bot
|
||||||
|
|
||||||
public async Task HandleMessageDeletedAsync(Cacheable<IMessage, ulong> message, ISocketMessageChannel channel)
|
public async Task HandleMessageDeletedAsync(Cacheable<IMessage, ulong> message, ISocketMessageChannel channel)
|
||||||
{
|
{
|
||||||
|
// Don't delete messages from the store if they aren't webhooks
|
||||||
|
// Non-webhook messages will never be stored anyway.
|
||||||
|
// If we're not sure (eg. message outside of cache), delete just to be sure.
|
||||||
|
if (message.HasValue && !message.Value.Author.IsWebhook) return;
|
||||||
await _messageStorage.Delete(message.Id);
|
await _messageStorage.Delete(message.Id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue