From c5a6971dbf519acdbcf8932b3e81e63bb2e64f95 Mon Sep 17 00:00:00 2001 From: Nitix Date: Wed, 19 Oct 2016 01:03:28 +0200 Subject: [PATCH] Fix msg reason for ban and softban --- .../Modules/Administration/Administration.cs | 24 +++++++++---------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/src/NadekoBot/Modules/Administration/Administration.cs b/src/NadekoBot/Modules/Administration/Administration.cs index 2aab66e7..dc230866 100644 --- a/src/NadekoBot/Modules/Administration/Administration.cs +++ b/src/NadekoBot/Modules/Administration/Administration.cs @@ -250,18 +250,16 @@ namespace NadekoBot.Modules.Administration [NadekoCommand, Usage, Description, Aliases] [RequireContext(ContextType.Guild)] [RequirePermission(GuildPermission.BanMembers)] - public async Task Ban(IUserMessage umsg, IGuildUser user) + public async Task Ban(IUserMessage umsg, IGuildUser user, [Remainder] string msg = null) { var channel = (ITextChannel)umsg.Channel; - - var msg = ""; - - if (!string.IsNullOrWhiteSpace(msg)) + if (string.IsNullOrWhiteSpace(msg)) { - await (await user.CreateDMChannelAsync()).SendMessageAsync($"**You have been BANNED from `{channel.Guild.Name}` server.**\n" + - $"Reason: {msg}").ConfigureAwait(false); - await Task.Delay(2000).ConfigureAwait(false); // temp solution; give time for a message to be send, fu volt + msg = "No reason provided."; } + await (await user.CreateDMChannelAsync()).SendMessageAsync($"**You have been BANNED from `{channel.Guild.Name}` server.**\n" + + $"Reason: {msg}").ConfigureAwait(false); + await Task.Delay(2000).ConfigureAwait(false); // temp solution; give time for a message to be send, fu volt try { await channel.Guild.AddBanAsync(user, 7).ConfigureAwait(false); @@ -280,13 +278,13 @@ namespace NadekoBot.Modules.Administration public async Task Softban(IUserMessage umsg, IGuildUser user, [Remainder] string msg = null) { var channel = (ITextChannel)umsg.Channel; - - if (!string.IsNullOrWhiteSpace(msg)) + if (string.IsNullOrWhiteSpace(msg)) { - await user.SendMessageAsync($"**You have been SOFT-BANNED from `{channel.Guild.Name}` server.**\n" + - $"Reason: {msg}").ConfigureAwait(false); - await Task.Delay(2000).ConfigureAwait(false); // temp solution; give time for a message to be send, fu volt + msg = "No reason provided."; } + await user.SendMessageAsync($"**You have been SOFT-BANNED from `{channel.Guild.Name}` server.**\n" + + $"Reason: {msg}").ConfigureAwait(false); + await Task.Delay(2000).ConfigureAwait(false); // temp solution; give time for a message to be send, fu volt try { await channel.Guild.AddBanAsync(user, 7).ConfigureAwait(false);