diff --git a/CommandProcessor.cs b/CommandProcessor.cs index 38e1430..428f271 100644 --- a/CommandProcessor.cs +++ b/CommandProcessor.cs @@ -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(); } diff --git a/Commands/ClearCommand.cs b/Commands/ClearCommand.cs index 141cc9a..b24af71 100644 --- a/Commands/ClearCommand.cs +++ b/Commands/ClearCommand.cs @@ -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))); } }