From dc0c8e30881b5b552ac0955b76e194d050565704 Mon Sep 17 00:00:00 2001 From: Master Kwoth Date: Thu, 16 Nov 2017 15:55:00 +0100 Subject: [PATCH 1/6] Fixed .defprefix, closes #1837 --- NadekoBot.Core/Modules/Administration/PrefixCommands.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NadekoBot.Core/Modules/Administration/PrefixCommands.cs b/NadekoBot.Core/Modules/Administration/PrefixCommands.cs index 617ebc30..c8a981b2 100644 --- a/NadekoBot.Core/Modules/Administration/PrefixCommands.cs +++ b/NadekoBot.Core/Modules/Administration/PrefixCommands.cs @@ -35,7 +35,7 @@ namespace NadekoBot.Modules.Administration [NadekoCommand, Usage, Description, Aliases] [OwnerOnly] - public async Task DefPrefix([Remainder]string prefix) + public async Task DefPrefix([Remainder]string prefix = null) { if (string.IsNullOrWhiteSpace(prefix)) { From 0ca82ab17cb939cd4327b4d3993057c287686080 Mon Sep 17 00:00:00 2001 From: Master Kwoth Date: Thu, 16 Nov 2017 16:20:00 +0100 Subject: [PATCH 2/6] .inrole is now paginated --- NadekoBot.Core/Modules/Utility/Utility.cs | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/NadekoBot.Core/Modules/Utility/Utility.cs b/NadekoBot.Core/Modules/Utility/Utility.cs index c5cdcc0f..6e7899f3 100644 --- a/NadekoBot.Core/Modules/Utility/Utility.cs +++ b/NadekoBot.Core/Modules/Utility/Utility.cs @@ -93,15 +93,17 @@ namespace NadekoBot.Modules.Utility { var rng = new NadekoRandom(); var usrs = (await Context.Guild.GetUsersAsync()).ToArray(); - var roleUsers = usrs.Where(u => u.RoleIds.Contains(role.Id)).Select(u => u.ToString()) + var roleUsers = usrs + .Where(u => u.RoleIds.Contains(role.Id)) + .Select(u => u.ToString()) .ToArray(); - var inroleusers = string.Join(", ", roleUsers - .OrderBy(x => rng.Next()) - .Take(50)); - var embed = new EmbedBuilder().WithOkColor() - .WithTitle("ℹ️ " + Format.Bold(GetText("inrole_list", Format.Bold(role.Name))) + $" - {roleUsers.Length}") - .WithDescription($"```css\n[{role.Name}]\n{inroleusers}```"); - await Context.Channel.EmbedAsync(embed).ConfigureAwait(false); + + await Context.Channel.SendPaginatedConfirmAsync(_client, 0, (cur) => + { + return new EmbedBuilder().WithOkColor() + .WithTitle(Format.Bold(GetText("inrole_list", Format.Bold(role.Name))) + $" - {roleUsers.Length}") + .WithDescription(string.Join("\n", roleUsers.Skip(cur * 20).Take(20))); + }, roleUsers.Length, 20).ConfigureAwait(false); } [NadekoCommand, Usage, Description, Aliases] From c49e52c2416e73759901217394cfd9ec0e84a0a0 Mon Sep 17 00:00:00 2001 From: Shikhir Arora Date: Thu, 16 Nov 2017 10:23:42 -0500 Subject: [PATCH 3/6] Change to url --- NadekoBot.Core/Common/CREmbed.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/NadekoBot.Core/Common/CREmbed.cs b/NadekoBot.Core/Common/CREmbed.cs index 1dd31996..551ac33d 100644 --- a/NadekoBot.Core/Common/CREmbed.cs +++ b/NadekoBot.Core/Common/CREmbed.cs @@ -12,7 +12,7 @@ namespace NadekoBot.Common public string PlainText { get; set; } public string Title { get; set; } public string Description { get; set; } - public string TitleURL { get; set; } + public string url { get; set; } public CREmbedFooter Footer { get; set; } public string Thumbnail { get; set; } public string Image { get; set; } @@ -27,7 +27,7 @@ namespace NadekoBot.Common public bool IsValid => !string.IsNullOrWhiteSpace(Title) || !string.IsNullOrWhiteSpace(Description) || - !string.IsNullOrWhiteSpace(TitleURL) || + !string.IsNullOrWhiteSpace(url) || !string.IsNullOrWhiteSpace(Thumbnail) || !string.IsNullOrWhiteSpace(Image) || (Footer != null && (!string.IsNullOrWhiteSpace(Footer.Text) || !string.IsNullOrWhiteSpace(Footer.IconUrl))) || @@ -41,8 +41,8 @@ namespace NadekoBot.Common embed.WithTitle(Title); if (!string.IsNullOrWhiteSpace(Description)) embed.WithDescription(Description); - if (!string.IsNullOrWhiteSpace(TitleURL)) - embed.WithUrl(TitleURL); + if (!string.IsNullOrWhiteSpace(url)) + embed.WithUrl(url); embed.WithColor(new Discord.Color(Color)); if (Footer != null) embed.WithFooter(efb => From 3ee00793ce1785287ccd28815b0aac49a0a4b194 Mon Sep 17 00:00:00 2001 From: Shikhir Arora Date: Thu, 16 Nov 2017 10:30:37 -0500 Subject: [PATCH 4/6] Check for URL correctness --- NadekoBot.Core/Common/CREmbed.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NadekoBot.Core/Common/CREmbed.cs b/NadekoBot.Core/Common/CREmbed.cs index 551ac33d..38fb8c69 100644 --- a/NadekoBot.Core/Common/CREmbed.cs +++ b/NadekoBot.Core/Common/CREmbed.cs @@ -41,7 +41,7 @@ namespace NadekoBot.Common embed.WithTitle(Title); if (!string.IsNullOrWhiteSpace(Description)) embed.WithDescription(Description); - if (!string.IsNullOrWhiteSpace(url)) + if (url != null && Uri.IsWellFormedUriString(url, UriKind.Absolute)) embed.WithUrl(url); embed.WithColor(new Discord.Color(Color)); if (Footer != null) From eac9ad018b6ee2ce01dc263087f5cf9663f6b249 Mon Sep 17 00:00:00 2001 From: Master Kwoth Date: Fri, 17 Nov 2017 04:04:04 +0100 Subject: [PATCH 5/6] Small change, version upped --- NadekoBot.Core/Common/CREmbed.cs | 8 ++++---- NadekoBot.Core/Services/Impl/StatsService.cs | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/NadekoBot.Core/Common/CREmbed.cs b/NadekoBot.Core/Common/CREmbed.cs index 38fb8c69..b790a12a 100644 --- a/NadekoBot.Core/Common/CREmbed.cs +++ b/NadekoBot.Core/Common/CREmbed.cs @@ -12,7 +12,7 @@ namespace NadekoBot.Common public string PlainText { get; set; } public string Title { get; set; } public string Description { get; set; } - public string url { get; set; } + public string Url { get; set; } public CREmbedFooter Footer { get; set; } public string Thumbnail { get; set; } public string Image { get; set; } @@ -27,7 +27,7 @@ namespace NadekoBot.Common public bool IsValid => !string.IsNullOrWhiteSpace(Title) || !string.IsNullOrWhiteSpace(Description) || - !string.IsNullOrWhiteSpace(url) || + !string.IsNullOrWhiteSpace(Url) || !string.IsNullOrWhiteSpace(Thumbnail) || !string.IsNullOrWhiteSpace(Image) || (Footer != null && (!string.IsNullOrWhiteSpace(Footer.Text) || !string.IsNullOrWhiteSpace(Footer.IconUrl))) || @@ -41,8 +41,8 @@ namespace NadekoBot.Common embed.WithTitle(Title); if (!string.IsNullOrWhiteSpace(Description)) embed.WithDescription(Description); - if (url != null && Uri.IsWellFormedUriString(url, UriKind.Absolute)) - embed.WithUrl(url); + if (Url != null && Uri.IsWellFormedUriString(Url, UriKind.Absolute)) + embed.WithUrl(Url); embed.WithColor(new Discord.Color(Color)); if (Footer != null) embed.WithFooter(efb => diff --git a/NadekoBot.Core/Services/Impl/StatsService.cs b/NadekoBot.Core/Services/Impl/StatsService.cs index ad5d5af9..b2bfc914 100644 --- a/NadekoBot.Core/Services/Impl/StatsService.cs +++ b/NadekoBot.Core/Services/Impl/StatsService.cs @@ -21,7 +21,7 @@ namespace NadekoBot.Core.Services.Impl private readonly IBotCredentials _creds; private readonly DateTime _started; - public const string BotVersion = "2.5.1"; + public const string BotVersion = "2.5.2"; public string Author => "Kwoth#2560"; public string Library => "Discord.Net"; From 940600bda6a5d39edc6143a9c5bf90b98f30ef52 Mon Sep 17 00:00:00 2001 From: Master Kwoth Date: Fri, 17 Nov 2017 11:33:13 +0100 Subject: [PATCH 6/6] .ban and .kick reasons will now show up in audit log. --- NadekoBot.Core/Modules/Administration/UserPunishCommands.cs | 4 ++-- NadekoBot.Core/Services/Impl/StatsService.cs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/NadekoBot.Core/Modules/Administration/UserPunishCommands.cs b/NadekoBot.Core/Modules/Administration/UserPunishCommands.cs index 35f5629f..6f2de5a7 100644 --- a/NadekoBot.Core/Modules/Administration/UserPunishCommands.cs +++ b/NadekoBot.Core/Modules/Administration/UserPunishCommands.cs @@ -286,7 +286,7 @@ namespace NadekoBot.Modules.Administration } } - await Context.Guild.AddBanAsync(user, 7).ConfigureAwait(false); + await Context.Guild.AddBanAsync(user, 7, msg).ConfigureAwait(false); await Context.Channel.EmbedAsync(new EmbedBuilder().WithOkColor() .WithTitle("⛔️ " + GetText("banned_user")) .AddField(efb => efb.WithName(GetText("username")).WithValue(user.ToString()).WithIsInline(true)) @@ -395,7 +395,7 @@ namespace NadekoBot.Modules.Administration catch { } } - await user.KickAsync().ConfigureAwait(false); + await user.KickAsync(msg).ConfigureAwait(false); await Context.Channel.EmbedAsync(new EmbedBuilder().WithOkColor() .WithTitle(GetText("kicked_user")) .AddField(efb => efb.WithName(GetText("username")).WithValue(user.ToString()).WithIsInline(true)) diff --git a/NadekoBot.Core/Services/Impl/StatsService.cs b/NadekoBot.Core/Services/Impl/StatsService.cs index b2bfc914..4ca20e95 100644 --- a/NadekoBot.Core/Services/Impl/StatsService.cs +++ b/NadekoBot.Core/Services/Impl/StatsService.cs @@ -21,7 +21,7 @@ namespace NadekoBot.Core.Services.Impl private readonly IBotCredentials _creds; private readonly DateTime _started; - public const string BotVersion = "2.5.2"; + public const string BotVersion = "2.5.3"; public string Author => "Kwoth#2560"; public string Library => "Discord.Net";