1
0
Fork 1
mirror of https://github.com/TeamOctolings/Octobot.git synced 2025-04-29 18:49:53 +03:00

Log originals of messages deleted through !clear

Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
This commit is contained in:
Octol1ttle 2023-02-02 23:01:19 +05:00
parent a97341f9a9
commit 620c706c97
Signed by: Octol1ttle
GPG key ID: B77C34313AEE1FFF
2 changed files with 12 additions and 6 deletions

View file

@ -17,9 +17,14 @@ public sealed class ClearCommand : ICommand {
var messages = await channel.GetMessagesAsync((int)(toDelete + 1)).FlattenAsync();
var user = (SocketGuildUser)cmd.Context.User;
await channel.DeleteMessagesAsync(messages, Utils.GetRequestOptions(user.ToString()!));
var msgArray = messages.ToArray();
await channel.DeleteMessagesAsync(msgArray, Utils.GetRequestOptions(user.ToString()!));
cmd.Audit(string.Format(Messages.FeedbackMessagesCleared, (toDelete + 1).ToString(),
Utils.MentionChannel(channel.Id)));
foreach (var msg in msgArray.Where(m => !m.Author.IsBot))
cmd.Audit(
string.Format(
Messages.CachedMessageDeleted, msg.Author.Mention,
Utils.MentionChannel(channel.Id),
Utils.Wrap(msg.CleanContent)));
}
}