mirror of
https://github.com/TeamOctolings/Octobot.git
synced 2025-01-31 09:09:00 +03:00
Log originals of messages deleted through !clear
Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
This commit is contained in:
parent
a97341f9a9
commit
620c706c97
2 changed files with 12 additions and 6 deletions
|
@ -86,7 +86,8 @@ public sealed class CommandProcessor {
|
|||
}
|
||||
|
||||
private void SendFeedbacks(bool reply = true) {
|
||||
if (reply && _stackedReplyMessage.Length > 0)
|
||||
var hasReply = _stackedReplyMessage.Length > 0;
|
||||
if (reply && hasReply)
|
||||
_ = Context.Message.ReplyAsync(_stackedReplyMessage.ToString(), false, null, AllowedMentions.None);
|
||||
|
||||
var data = GuildData.Get(Context.Guild);
|
||||
|
@ -94,7 +95,7 @@ public sealed class CommandProcessor {
|
|||
var systemChannel = data.PublicFeedbackChannel;
|
||||
if (_stackedPrivateFeedback.Length > 0
|
||||
&& adminChannel is not null
|
||||
&& adminChannel.Id != Context.Message.Channel.Id) {
|
||||
&& (adminChannel.Id != Context.Message.Channel.Id || !hasReply)) {
|
||||
_ = Utils.SilentSendAsync(adminChannel, _stackedPrivateFeedback.ToString());
|
||||
_stackedPrivateFeedback.Clear();
|
||||
}
|
||||
|
@ -102,7 +103,7 @@ public sealed class CommandProcessor {
|
|||
if (_stackedPublicFeedback.Length > 0
|
||||
&& systemChannel is not null
|
||||
&& systemChannel.Id != adminChannel?.Id
|
||||
&& systemChannel.Id != Context.Message.Channel.Id) {
|
||||
&& (systemChannel.Id != Context.Message.Channel.Id || !hasReply)) {
|
||||
_ = Utils.SilentSendAsync(systemChannel, _stackedPublicFeedback.ToString());
|
||||
_stackedPublicFeedback.Clear();
|
||||
}
|
||||
|
|
|
@ -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)));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue