actually, we need to remove the most recent message, not the oldest; I'm dumb

This commit is contained in:
13xforever 2018-08-11 19:07:28 +05:00 committed by Roberto Anić Banić
parent 5205fe184c
commit 7dac7bacf2

View File

@ -31,7 +31,7 @@ namespace CompatBot.EventHandlers
await args.Message.ReactWithAsync(args.Client, DiscordEmoji.FromUnicode("😟"), "Okay (._.)").ConfigureAwait(false);
var lastBotMessages = await args.Channel.GetMessagesBeforeAsync(args.Message.Id, 20, DateTime.UtcNow.AddSeconds(-30)).ConfigureAwait(false);
if (lastBotMessages.OrderBy(m => m.CreationTimestamp).FirstOrDefault(m => m.Author.IsCurrent) is DiscordMessage msg)
if (lastBotMessages.OrderByDescending(m => m.CreationTimestamp).FirstOrDefault(m => m.Author.IsCurrent) is DiscordMessage msg)
await msg.DeleteAsync("asked to shut up").ConfigureAwait(false);
}