Avoid deleting messages from the store if they're not webhooks
This commit is contained in:
		| @@ -80,7 +80,7 @@ namespace PluralKit.Bot | ||||
|  | ||||
|             .AddSingleton<IDiscordClient, DiscordShardedClient>(_ => new DiscordShardedClient(new DiscordSocketConfig | ||||
|             { | ||||
|                 MessageCacheSize = 0, | ||||
|                 MessageCacheSize = 10, | ||||
|                 ExclusiveBulkDelete = true | ||||
|             })) | ||||
|             .AddSingleton<Bot>() | ||||
|   | ||||
| @@ -273,6 +273,10 @@ namespace PluralKit.Bot | ||||
|  | ||||
|         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); | ||||
|         } | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user