From 5b4daa9dd333aeed817199370c074d8f42af4a01 Mon Sep 17 00:00:00 2001 From: Kwoth Date: Thu, 8 Jul 2021 20:01:42 +0200 Subject: [PATCH] All .AddField calls no longer use builder - Cleaned up convertlist and listserver embeds slightly --- .../Administration/ProtectionCommands.cs | 8 +- .../Modules/Administration/SelfCommands.cs | 9 +-- .../Services/LogCommandService.cs | 77 +++++++++---------- .../Administration/UserPunishCommands.cs | 4 +- .../CustomReactions/CustomReactions.cs | 16 ++-- src/NadekoBot/Modules/Gambling/Gambling.cs | 4 +- .../Modules/Games/Common/Trivia/TriviaGame.cs | 4 +- .../Modules/Games/Common/TypingGame.cs | 14 ++-- .../Modules/Games/HangmanCommands.cs | 4 +- .../Modules/Help/Services/HelpService.cs | 15 ++-- .../Modules/Music/PlaylistCommands.cs | 10 +-- .../Permissions/GlobalPermissionCommands.cs | 14 ++-- .../Modules/Searches/PokemonSearchCommands.cs | 4 +- src/NadekoBot/Modules/Searches/Searches.cs | 9 +-- .../Services/StreamNotificationService.cs | 8 +- src/NadekoBot/Modules/Utility/InfoCommands.cs | 7 +- .../Modules/Utility/PatreonCommands.cs | 11 ++- .../Modules/Utility/QuoteCommands.cs | 6 +- .../Modules/Utility/UnitConversionCommands.cs | 21 +++-- src/NadekoBot/Modules/Utility/Utility.cs | 18 ++--- 20 files changed, 116 insertions(+), 147 deletions(-) diff --git a/src/NadekoBot/Modules/Administration/ProtectionCommands.cs b/src/NadekoBot/Modules/Administration/ProtectionCommands.cs index 86253a983..b482817cc 100644 --- a/src/NadekoBot/Modules/Administration/ProtectionCommands.cs +++ b/src/NadekoBot/Modules/Administration/ProtectionCommands.cs @@ -235,14 +235,10 @@ namespace NadekoBot.Modules.Administration .WithTitle(GetText("prot_active")); if (spam != null) - embed.AddField(efb => efb.WithName("Anti-Spam") - .WithValue(GetAntiSpamString(spam).TrimTo(1024)) - .WithIsInline(true)); + embed.AddField("Anti-Spam", GetAntiSpamString(spam).TrimTo(1024), true); if (raid != null) - embed.AddField(efb => efb.WithName("Anti-Raid") - .WithValue(GetAntiRaidString(raid).TrimTo(1024)) - .WithIsInline(true)); + embed.AddField("Anti-Raid", GetAntiRaidString(raid).TrimTo(1024), true); if (alt is not null) embed.AddField("Anti-Alt", GetAntiAltString(alt), true); diff --git a/src/NadekoBot/Modules/Administration/SelfCommands.cs b/src/NadekoBot/Modules/Administration/SelfCommands.cs index 86d85d54b..b9e7d5223 100644 --- a/src/NadekoBot/Modules/Administration/SelfCommands.cs +++ b/src/NadekoBot/Modules/Administration/SelfCommands.cs @@ -59,12 +59,9 @@ namespace NadekoBot.Modules.Administration await ctx.Channel.EmbedAsync(new EmbedBuilder().WithOkColor() .WithTitle(GetText("scadd")) - .AddField(efb => efb.WithName(GetText("server")) - .WithValue(cmd.GuildId is null ? $"-" : $"{cmd.GuildName}/{cmd.GuildId}").WithIsInline(true)) - .AddField(efb => efb.WithName(GetText("channel")) - .WithValue($"{cmd.ChannelName}/{cmd.ChannelId}").WithIsInline(true)) - .AddField(efb => efb.WithName(GetText("command_text")) - .WithValue(cmdText).WithIsInline(false))).ConfigureAwait(false); + .AddField(GetText("server"), cmd.GuildId is null ? $"-" : $"{cmd.GuildName}/{cmd.GuildId}", true) + .AddField(GetText("channel"), $"{cmd.ChannelName}/{cmd.ChannelId}", true) + .AddField(GetText("command_text"), cmdText, false)); } [NadekoCommand, Aliases] diff --git a/src/NadekoBot/Modules/Administration/Services/LogCommandService.cs b/src/NadekoBot/Modules/Administration/Services/LogCommandService.cs index 272373078..52ad8ac7b 100644 --- a/src/NadekoBot/Modules/Administration/Services/LogCommandService.cs +++ b/src/NadekoBot/Modules/Administration/Services/LogCommandService.cs @@ -595,12 +595,10 @@ namespace NadekoBot.Modules.Administration.Services if (before.Nickname != after.Nickname) { embed.WithAuthor("đŸ‘Ĩ " + GetText(logChannel.Guild, "nick_change")) - .AddField(efb => - efb.WithName(GetText(logChannel.Guild, "old_nick")) - .WithValue($"{before.Nickname}#{before.Discriminator}")) - .AddField(efb => - efb.WithName(GetText(logChannel.Guild, "new_nick")) - .WithValue($"{after.Nickname}#{after.Discriminator}")); + .AddField(GetText(logChannel.Guild, "old_nick") + , $"{before.Nickname}#{before.Discriminator}") + .AddField(GetText(logChannel.Guild, "new_nick") + , $"{after.Nickname}#{after.Discriminator}"); await logChannel.EmbedAsync(embed).ConfigureAwait(false); } @@ -703,19 +701,14 @@ namespace NadekoBot.Modules.Administration.Services { embed.WithTitle("â„šī¸ " + GetText(logChannel.Guild, "ch_name_change")) .WithDescription($"{after} | {after.Id}") - .AddField(efb => - efb.WithName(GetText(logChannel.Guild, "ch_old_name")).WithValue(before.Name)); + .AddField(GetText(logChannel.Guild, "ch_old_name"), before.Name); } else if (beforeTextChannel?.Topic != afterTextChannel?.Topic) { embed.WithTitle("â„šī¸ " + GetText(logChannel.Guild, "ch_topic_change")) .WithDescription($"{after} | {after.Id}") - .AddField(efb => - efb.WithName(GetText(logChannel.Guild, "old_topic")) - .WithValue(beforeTextChannel?.Topic ?? "-")) - .AddField(efb => - efb.WithName(GetText(logChannel.Guild, "new_topic")) - .WithValue(afterTextChannel?.Topic ?? "-")); + .AddField(GetText(logChannel.Guild, "old_topic") , beforeTextChannel?.Topic ?? "-") + .AddField(GetText(logChannel.Guild, "new_topic"), afterTextChannel?.Topic ?? "-"); } else return; @@ -931,7 +924,7 @@ namespace NadekoBot.Modules.Administration.Services .WithOkColor() .WithTitle("❌ " + GetText(logChannel.Guild, "user_left")) .WithDescription(usr.ToString()) - .AddField(efb => efb.WithName("Id").WithValue(usr.Id.ToString())) + .AddField("Id", usr.Id.ToString()) .WithFooter(CurrentTime(usr.Guild)); if (Uri.IsWellFormedUriString(usr.GetAvatarUrl(), UriKind.Absolute)) @@ -966,13 +959,13 @@ namespace NadekoBot.Modules.Administration.Services .WithOkColor() .WithTitle("✅ " + GetText(logChannel.Guild, "user_joined")) .WithDescription($"{usr.Mention} `{usr}`") - .AddField(efb => efb.WithName("Id").WithValue(usr.Id.ToString())) - .AddField(fb => - fb.WithName(GetText(logChannel.Guild, "joined_server")) - .WithValue($"{usr.JoinedAt?.ToString("dd.MM.yyyy HH:mm") ?? "?"}").WithIsInline(true)) - .AddField(fb => - fb.WithName(GetText(logChannel.Guild, "joined_discord")) - .WithValue($"{usr.CreatedAt:dd.MM.yyyy HH:mm}").WithIsInline(true)) + .AddField("Id", usr.Id.ToString()) + .AddField(GetText(logChannel.Guild, "joined_server"), + $"{usr.JoinedAt?.ToString("dd.MM.yyyy HH:mm" ?? "?")}", + true) + .AddField(GetText(logChannel.Guild, "joined_discord"), + $"{usr.CreatedAt:dd.MM.yyyy HH:mm}", + true) .WithFooter(CurrentTime(usr.Guild)); if (Uri.IsWellFormedUriString(usr.GetAvatarUrl(), UriKind.Absolute)) @@ -1006,7 +999,7 @@ namespace NadekoBot.Modules.Administration.Services .WithOkColor() .WithTitle("â™ģī¸ " + GetText(logChannel.Guild, "user_unbanned")) .WithDescription(usr.ToString()) - .AddField(efb => efb.WithName("Id").WithValue(usr.Id.ToString())) + .AddField("Id", usr.Id.ToString()) .WithFooter(CurrentTime(guild)); if (Uri.IsWellFormedUriString(usr.GetAvatarUrl(), UriKind.Absolute)) @@ -1041,7 +1034,7 @@ namespace NadekoBot.Modules.Administration.Services .WithOkColor() .WithTitle("đŸšĢ " + GetText(logChannel.Guild, "user_banned")) .WithDescription(usr.ToString()) - .AddField(efb => efb.WithName("Id").WithValue(usr.Id.ToString())) + .AddField("Id", usr.Id.ToString()) .WithFooter(CurrentTime(guild)); var avatarUrl = usr.GetAvatarUrl(); @@ -1090,16 +1083,15 @@ namespace NadekoBot.Modules.Administration.Services .WithOkColor() .WithTitle("🗑 " + GetText(logChannel.Guild, "msg_del", ((ITextChannel) msg.Channel).Name)) .WithDescription(msg.Author.ToString()) - .AddField(efb => - efb.WithName(GetText(logChannel.Guild, "content")) - .WithValue(string.IsNullOrWhiteSpace(resolvedMessage) ? "-" : resolvedMessage) - .WithIsInline(false)) + .AddField(GetText(logChannel.Guild, "content"), + string.IsNullOrWhiteSpace(resolvedMessage) ? "-" : resolvedMessage, + false) .AddField("Id", msg.Id.ToString(), false) .WithFooter(CurrentTime(channel.Guild)); if (msg.Attachments.Any()) - embed.AddField(efb => - efb.WithName(GetText(logChannel.Guild, "attachments")) - .WithValue(string.Join(", ", msg.Attachments.Select(a => a.Url))).WithIsInline(false)); + embed.AddField(GetText(logChannel.Guild, "attachments"), + string.Join(", ", msg.Attachments.Select(a => a.Url)), + false); await logChannel.EmbedAsync(embed).ConfigureAwait(false); } @@ -1146,18 +1138,19 @@ namespace NadekoBot.Modules.Administration.Services var embed = new EmbedBuilder() .WithOkColor() - .WithTitle("📝 " + GetText(logChannel.Guild, "msg_update", ((ITextChannel) after.Channel).Name)) + .WithTitle("📝 " + GetText(logChannel.Guild, "msg_update", ((ITextChannel)after.Channel).Name)) .WithDescription(after.Author.ToString()) - .AddField(efb => - efb.WithName(GetText(logChannel.Guild, "old_msg")) - .WithValue(string.IsNullOrWhiteSpace(before.Content) - ? "-" - : before.Resolve(userHandling: TagHandling.FullName)).WithIsInline(false)) - .AddField(efb => - efb.WithName(GetText(logChannel.Guild, "new_msg")) - .WithValue(string.IsNullOrWhiteSpace(after.Content) - ? "-" - : after.Resolve(userHandling: TagHandling.FullName)).WithIsInline(false)) + .AddField(GetText(logChannel.Guild, "old_msg"), + string.IsNullOrWhiteSpace(before.Content) + ? "-" + : before.Resolve(userHandling: TagHandling.FullName), + false) + .AddField( + GetText(logChannel.Guild, "new_msg"), + string.IsNullOrWhiteSpace(after.Content) + ? "-" + : after.Resolve(userHandling: TagHandling.FullName), + false) .AddField("Id", after.Id.ToString(), false) .WithFooter(CurrentTime(channel.Guild)); diff --git a/src/NadekoBot/Modules/Administration/UserPunishCommands.cs b/src/NadekoBot/Modules/Administration/UserPunishCommands.cs index 40b62d89e..bb771e7c3 100644 --- a/src/NadekoBot/Modules/Administration/UserPunishCommands.cs +++ b/src/NadekoBot/Modules/Administration/UserPunishCommands.cs @@ -62,8 +62,8 @@ namespace NadekoBot.Modules.Administration { await (await user.GetOrCreateDMChannelAsync().ConfigureAwait(false)).EmbedAsync(new EmbedBuilder().WithErrorColor() .WithDescription(GetText("warned_on", ctx.Guild.ToString())) - .AddField(efb => efb.WithName(GetText("moderator")).WithValue(ctx.User.ToString())) - .AddField(efb => efb.WithName(GetText("reason")).WithValue(reason ?? "-"))) + .AddField(GetText("moderator"), ctx.User.ToString()) + .AddField(GetText("reason"), reason ?? "-")) .ConfigureAwait(false); } catch diff --git a/src/NadekoBot/Modules/CustomReactions/CustomReactions.cs b/src/NadekoBot/Modules/CustomReactions/CustomReactions.cs index 6dbf1bfca..322dec590 100644 --- a/src/NadekoBot/Modules/CustomReactions/CustomReactions.cs +++ b/src/NadekoBot/Modules/CustomReactions/CustomReactions.cs @@ -44,8 +44,8 @@ namespace NadekoBot.Modules.CustomReactions await ctx.Channel.EmbedAsync(new EmbedBuilder().WithOkColor() .WithTitle(GetText("new_cust_react")) .WithDescription($"#{(kwum)cr.Id}") - .AddField(efb => efb.WithName(GetText("trigger")).WithValue(key)) - .AddField(efb => efb.WithName(GetText("response")).WithValue(message.Length > 1024 ? GetText("redacted_too_long") : message)) + .AddField(GetText("trigger"), key) + .AddField(GetText("response"), message.Length > 1024 ? GetText("redacted_too_long") : message) ).ConfigureAwait(false); } @@ -68,8 +68,8 @@ namespace NadekoBot.Modules.CustomReactions await ctx.Channel.EmbedAsync(new EmbedBuilder().WithOkColor() .WithTitle(GetText("edited_cust_react")) .WithDescription($"#{id}") - .AddField(efb => efb.WithName(GetText("trigger")).WithValue(cr.Trigger)) - .AddField(efb => efb.WithName(GetText("response")).WithValue(message.Length > 1024 ? GetText("redacted_too_long") : message)) + .AddField(GetText("trigger"), cr.Trigger) + .AddField(GetText("response"), message.Length > 1024 ? GetText("redacted_too_long") : message) ).ConfigureAwait(false); } else @@ -148,8 +148,8 @@ namespace NadekoBot.Modules.CustomReactions { await ctx.Channel.EmbedAsync(new EmbedBuilder().WithOkColor() .WithDescription($"#{id}") - .AddField(efb => efb.WithName(GetText("trigger")).WithValue(found.Trigger.TrimTo(1024))) - .AddField(efb => efb.WithName(GetText("response")).WithValue((found.Response + "\n```css\n" + found.Response).TrimTo(1020) + "```")) + .AddField(GetText("trigger"), found.Trigger.TrimTo(1024)) + .AddField(GetText("response"), (found.Response + "\n```css\n" + found.Response).TrimTo(1020) + "```") ).ConfigureAwait(false); } } @@ -170,8 +170,8 @@ namespace NadekoBot.Modules.CustomReactions await ctx.Channel.EmbedAsync(new EmbedBuilder().WithOkColor() .WithTitle(GetText("deleted")) .WithDescription($"#{id}") - .AddField(efb => efb.WithName(GetText("trigger")).WithValue(cr.Trigger.TrimTo(1024))) - .AddField(efb => efb.WithName(GetText("response")).WithValue(cr.Response.TrimTo(1024)))).ConfigureAwait(false); + .AddField(GetText("trigger"), cr.Trigger.TrimTo(1024)) + .AddField(GetText("response"), cr.Response.TrimTo(1024))).ConfigureAwait(false); } else { diff --git a/src/NadekoBot/Modules/Gambling/Gambling.cs b/src/NadekoBot/Modules/Gambling/Gambling.cs index 505fbfc37..472beb33b 100644 --- a/src/NadekoBot/Modules/Gambling/Gambling.cs +++ b/src/NadekoBot/Modules/Gambling/Gambling.cs @@ -569,9 +569,7 @@ namespace NadekoBot.Modules.Gambling var usrStr = x.ToString().TrimTo(20, true); var j = i; - embed.AddField(efb => efb.WithName("#" + (9 * curPage + j + 1) + " " + usrStr) - .WithValue(n(x.CurrencyAmount) + " " + CurrencySign) - .WithIsInline(true)); + embed.AddField("#" + (9 * curPage + j + 1) + " " + usrStr, n(x.CurrencyAmount) + " " + CurrencySign, true); } return embed; diff --git a/src/NadekoBot/Modules/Games/Common/Trivia/TriviaGame.cs b/src/NadekoBot/Modules/Games/Common/Trivia/TriviaGame.cs index 7c484da22..37c8a3f20 100644 --- a/src/NadekoBot/Modules/Games/Common/Trivia/TriviaGame.cs +++ b/src/NadekoBot/Modules/Games/Common/Trivia/TriviaGame.cs @@ -87,8 +87,8 @@ namespace NadekoBot.Modules.Games.Common.Trivia { questionEmbed = new EmbedBuilder().WithOkColor() .WithTitle(GetText("trivia_game")) - .AddField(eab => eab.WithName(GetText("category")).WithValue(CurrentQuestion.Category)) - .AddField(eab => eab.WithName(GetText("question")).WithValue(CurrentQuestion.Question)); + .AddField(GetText("category"), CurrentQuestion.Category) + .AddField(GetText("question"), CurrentQuestion.Question); if (showHowToQuit) questionEmbed.WithFooter(GetText("trivia_quit", _quitCommand)); diff --git a/src/NadekoBot/Modules/Games/Common/TypingGame.cs b/src/NadekoBot/Modules/Games/Common/TypingGame.cs index 44ac3ddfd..5479e10d8 100644 --- a/src/NadekoBot/Modules/Games/Common/TypingGame.cs +++ b/src/NadekoBot/Modules/Games/Common/TypingGame.cs @@ -157,15 +157,11 @@ namespace NadekoBot.Modules.Games.Common var wpm = CurrentSentence.Length / WORD_VALUE / elapsed.TotalSeconds * 60; finishedUserIds.Add(msg.Author.Id); await this.Channel.EmbedAsync(new EmbedBuilder().WithOkColor() - .WithTitle($"{msg.Author} finished the race!") - .AddField(efb => - efb.WithName("Place").WithValue($"#{finishedUserIds.Count}").WithIsInline(true)) - .AddField(efb => - efb.WithName("WPM").WithValue($"{wpm:F1} *[{elapsed.TotalSeconds:F2}sec]*") - .WithIsInline(true)) - .AddField(efb => - efb.WithName("Errors").WithValue(distance.ToString()).WithIsInline(true))) - .ConfigureAwait(false); + .WithTitle($"{msg.Author} finished the race!") + .AddField("Place", $"#{finishedUserIds.Count}", true) + .AddField("WPM", $"{wpm:F1} *[{elapsed.TotalSeconds:F2}sec]*", true) + .AddField("Errors", distance.ToString(), true)); + if (finishedUserIds.Count % 4 == 0) { await this.Channel.SendConfirmAsync( diff --git a/src/NadekoBot/Modules/Games/HangmanCommands.cs b/src/NadekoBot/Modules/Games/HangmanCommands.cs index 1762b0a6d..e1f47e2f8 100644 --- a/src/NadekoBot/Modules/Games/HangmanCommands.cs +++ b/src/NadekoBot/Modules/Games/HangmanCommands.cs @@ -89,7 +89,7 @@ namespace NadekoBot.Modules.Games { var loseEmbed = new EmbedBuilder().WithTitle($"Hangman Game ({game.TermType}) - Ended") .WithDescription(Format.Bold("You lose.")) - .AddField(efb => efb.WithName("It was").WithValue(game.Term.GetWord())) + .AddField("It was", game.Term.GetWord()) .WithFooter(string.Join(" ", game.PreviousGuesses)) .WithErrorColor(); @@ -101,7 +101,7 @@ namespace NadekoBot.Modules.Games var winEmbed = new EmbedBuilder().WithTitle($"Hangman Game ({game.TermType}) - Ended") .WithDescription(Format.Bold($"{winner} Won.")) - .AddField(efb => efb.WithName("It was").WithValue(game.Term.GetWord())) + .AddField("It was", game.Term.GetWord()) .WithFooter(string.Join(" ", game.PreviousGuesses)) .WithOkColor(); diff --git a/src/NadekoBot/Modules/Help/Services/HelpService.cs b/src/NadekoBot/Modules/Help/Services/HelpService.cs index 8c8f3818a..42be959d7 100644 --- a/src/NadekoBot/Modules/Help/Services/HelpService.cs +++ b/src/NadekoBot/Modules/Help/Services/HelpService.cs @@ -64,23 +64,20 @@ namespace NadekoBot.Modules.Help.Services if (alias != null) str += $" **/ `{prefix + alias}`**"; var em = new EmbedBuilder() - .AddField(fb => fb.WithName(str) - .WithValue($"{com.RealSummary(_strings, guild?.Id, prefix)}") - .WithIsInline(true)); + .AddField(str, $"{com.RealSummary(_strings, guild?.Id, prefix)}", true); _dpos.TryGetOverrides(guild?.Id ?? 0, com.Name, out var overrides); var reqs = GetCommandRequirements(com, overrides); if(reqs.Any()) { - em.AddField(GetText("requires", guild), - string.Join("\n", reqs)); + em.AddField(GetText("requires", guild), string.Join("\n", reqs)); } em - .AddField(fb => fb.WithName(GetText("usage", guild)) - .WithValue(string.Join("\n", Array.ConvertAll(com.RealRemarksArr(_strings, guild?.Id, prefix), - arg => Format.Code(arg)))) - .WithIsInline(false)) + .AddField(GetText("usage", guild), + string.Join("\n", Array.ConvertAll(com.RealRemarksArr(_strings, guild?.Id, prefix), + arg => Format.Code(arg))), + false) .WithFooter(GetText("module", guild, com.Module.GetTopLevelModule().Name)) .WithColor(Bot.OkColor); diff --git a/src/NadekoBot/Modules/Music/PlaylistCommands.cs b/src/NadekoBot/Modules/Music/PlaylistCommands.cs index f8ad1c897..2ad911ff8 100644 --- a/src/NadekoBot/Modules/Music/PlaylistCommands.cs +++ b/src/NadekoBot/Modules/Music/PlaylistCommands.cs @@ -162,11 +162,11 @@ namespace NadekoBot.Modules.Music await uow.SaveChangesAsync(); } - await ctx.Channel.EmbedAsync(new EmbedBuilder().WithOkColor() - .WithTitle(GetText("playlist_saved")) - .AddField(efb => efb.WithName(GetText("name")).WithValue(name)) - .AddField(efb => efb.WithName(GetText("id")).WithValue(playlist.Id.ToString()))) - .ConfigureAwait(false); + await ctx.Channel.EmbedAsync(new EmbedBuilder() + .WithOkColor() + .WithTitle(GetText("playlist_saved")) + .AddField(GetText("name"), name) + .AddField(GetText("id"), playlist.Id.ToString())); } diff --git a/src/NadekoBot/Modules/Permissions/GlobalPermissionCommands.cs b/src/NadekoBot/Modules/Permissions/GlobalPermissionCommands.cs index 935b4b859..77f9dfe31 100644 --- a/src/NadekoBot/Modules/Permissions/GlobalPermissionCommands.cs +++ b/src/NadekoBot/Modules/Permissions/GlobalPermissionCommands.cs @@ -39,16 +39,14 @@ namespace NadekoBot.Modules.Permissions var embed = new EmbedBuilder().WithOkColor(); if (blockedModule.Any()) - embed.AddField(efb => efb - .WithName(GetText("blocked_modules")) - .WithValue(string.Join("\n", _service.BlockedModules)) - .WithIsInline(false)); + embed.AddField(GetText("blocked_modules") + , string.Join("\n", _service.BlockedModules) + , false); if (blockedCommands.Any()) - embed.AddField(efb => efb - .WithName(GetText("blocked_commands")) - .WithValue(string.Join("\n", _service.BlockedCommands)) - .WithIsInline(false)); + embed.AddField(GetText("blocked_commands") + , string.Join("\n", _service.BlockedCommands) + , false); await ctx.Channel.EmbedAsync(embed).ConfigureAwait(false); } diff --git a/src/NadekoBot/Modules/Searches/PokemonSearchCommands.cs b/src/NadekoBot/Modules/Searches/PokemonSearchCommands.cs index 54da8747e..05814ab6f 100644 --- a/src/NadekoBot/Modules/Searches/PokemonSearchCommands.cs +++ b/src/NadekoBot/Modules/Searches/PokemonSearchCommands.cs @@ -67,9 +67,7 @@ namespace NadekoBot.Modules.Searches .WithDescription(string.IsNullOrWhiteSpace(kvp.Value.Desc) ? kvp.Value.ShortDesc : kvp.Value.Desc) - .AddField(efb => efb.WithName(GetText("rating")) - .WithValue(kvp.Value.Rating.ToString(_cultureInfo)).WithIsInline(true)) - ).ConfigureAwait(false); + .AddField(GetText("rating"), kvp.Value.Rating.ToString(_cultureInfo), true)); return; } } diff --git a/src/NadekoBot/Modules/Searches/Searches.cs b/src/NadekoBot/Modules/Searches/Searches.cs index 877e8ae2d..7fd9ed869 100644 --- a/src/NadekoBot/Modules/Searches/Searches.cs +++ b/src/NadekoBot/Modules/Searches/Searches.cs @@ -324,11 +324,8 @@ namespace NadekoBot.Modules.Searches await ctx.Channel.EmbedAsync(new EmbedBuilder() .WithColor(Bot.OkColor) - .AddField(efb => efb.WithName(GetText("original_url")) - .WithValue($"<{query}>")) - .AddField(efb => efb.WithName(GetText("short_url")) - .WithValue($"<{shortLink}>"))) - .ConfigureAwait(false); + .AddField(GetText("original_url"), $"<{query}>") + .AddField(GetText("short_url"), $"<{shortLink}>")); } [NadekoCommand, Aliases] @@ -540,7 +537,7 @@ namespace NadekoBot.Modules.Searches .WithOkColor(); if (!string.IsNullOrWhiteSpace(data.Example)) - embed.AddField(efb => efb.WithName(GetText("example")).WithValue(data.Example)); + embed.AddField(GetText("example"), data.Example); return embed; }, col.Count, 1); diff --git a/src/NadekoBot/Modules/Searches/Services/StreamNotificationService.cs b/src/NadekoBot/Modules/Searches/Services/StreamNotificationService.cs index e61445a04..2f84c3792 100644 --- a/src/NadekoBot/Modules/Searches/Services/StreamNotificationService.cs +++ b/src/NadekoBot/Modules/Searches/Services/StreamNotificationService.cs @@ -444,12 +444,8 @@ namespace NadekoBot.Modules.Searches.Services .WithTitle(status.Name) .WithUrl(status.StreamUrl) .WithDescription(status.StreamUrl) - .AddField(efb => efb.WithName(GetText(guildId, "status")) - .WithValue(status.IsLive ? "đŸŸĸ Online" : "🔴 Offline") - .WithIsInline(true)) - .AddField(efb => efb.WithName(GetText(guildId, "viewers")) - .WithValue(status.IsLive ? status.Viewers.ToString() : "-") - .WithIsInline(true)) + .AddField(GetText(guildId, "status"), status.IsLive ? "đŸŸĸ Online" : "🔴 Offline", true) + .AddField(GetText(guildId, "viewers"), status.IsLive ? status.Viewers.ToString() : "-", true) .WithColor(status.IsLive ? Bot.OkColor : Bot.ErrorColor); if (!string.IsNullOrWhiteSpace(status.Title)) diff --git a/src/NadekoBot/Modules/Utility/InfoCommands.cs b/src/NadekoBot/Modules/Utility/InfoCommands.cs index 8aa68af6c..2ca8ff0fa 100644 --- a/src/NadekoBot/Modules/Utility/InfoCommands.cs +++ b/src/NadekoBot/Modules/Utility/InfoCommands.cs @@ -63,13 +63,12 @@ namespace NadekoBot.Modules.Utility embed.WithThumbnailUrl(guild.IconUrl); if (guild.Emotes.Any()) { - embed.AddField(fb => - fb.WithName(GetText("custom_emojis") + $"({guild.Emotes.Count})") - .WithValue(string.Join(" ", guild.Emotes + embed.AddField(GetText("custom_emojis") + $"({guild.Emotes.Count})", + string.Join(" ", guild.Emotes .Shuffle() .Take(20) .Select(e => $"{e.Name} {e.ToString()}")) - .TrimTo(1020))); + .TrimTo(1020)); } await ctx.Channel.EmbedAsync(embed).ConfigureAwait(false); } diff --git a/src/NadekoBot/Modules/Utility/PatreonCommands.cs b/src/NadekoBot/Modules/Utility/PatreonCommands.cs index 368b82abe..cca742361 100644 --- a/src/NadekoBot/Modules/Utility/PatreonCommands.cs +++ b/src/NadekoBot/Modules/Utility/PatreonCommands.cs @@ -38,12 +38,11 @@ namespace NadekoBot.Modules.Utility var helpcmd = Format.Code(Prefix + "donate"); await ctx.Channel.EmbedAsync(new EmbedBuilder().WithOkColor() .WithDescription(GetText("clpa_obsolete")) - .AddField(efb => efb.WithName(GetText("clpa_fail_already_title")).WithValue(GetText("clpa_fail_already"))) - .AddField(efb => efb.WithName(GetText("clpa_fail_wait_title")).WithValue(GetText("clpa_fail_wait"))) - .AddField(efb => efb.WithName(GetText("clpa_fail_conn_title")).WithValue(GetText("clpa_fail_conn"))) - .AddField(efb => efb.WithName(GetText("clpa_fail_sup_title")).WithValue(GetText("clpa_fail_sup", helpcmd))) - .WithFooter(GetText("clpa_next_update", rem))) - .ConfigureAwait(false); + .AddField(GetText("clpa_fail_already_title"), GetText("clpa_fail_already")) + .AddField(GetText("clpa_fail_wait_title"), GetText("clpa_fail_wait")) + .AddField(GetText("clpa_fail_conn_title"), GetText("clpa_fail_conn")) + .AddField(GetText("clpa_fail_sup_title"), GetText("clpa_fail_sup", helpcmd)) + .WithFooter(GetText("clpa_next_update", rem))); } } } diff --git a/src/NadekoBot/Modules/Utility/QuoteCommands.cs b/src/NadekoBot/Modules/Utility/QuoteCommands.cs index f157a0919..cd0d630d0 100644 --- a/src/NadekoBot/Modules/Utility/QuoteCommands.cs +++ b/src/NadekoBot/Modules/Utility/QuoteCommands.cs @@ -118,10 +118,10 @@ namespace NadekoBot.Modules.Utility await ctx.Channel.EmbedAsync(new EmbedBuilder() .WithOkColor() .WithTitle(GetText("quote_id", $"#{data.Id}")) - .AddField(efb => efb.WithName(GetText("trigger")).WithValue(data.Keyword)) - .AddField(efb => efb.WithName(GetText("response")).WithValue(data.Text.Length > 1000 + .AddField(GetText("trigger"), data.Keyword) + .AddField(GetText("response"), data.Text.Length > 1000 ? GetText("redacted_too_long") - : Format.Sanitize(data.Text))) + : Format.Sanitize(data.Text)) .WithFooter(GetText("created_by", $"{data.AuthorName} ({data.AuthorId})")) ).ConfigureAwait(false); } diff --git a/src/NadekoBot/Modules/Utility/UnitConversionCommands.cs b/src/NadekoBot/Modules/Utility/UnitConversionCommands.cs index 3d1e63b03..1afb2a28a 100644 --- a/src/NadekoBot/Modules/Utility/UnitConversionCommands.cs +++ b/src/NadekoBot/Modules/Utility/UnitConversionCommands.cs @@ -19,14 +19,19 @@ namespace NadekoBot.Modules.Utility public async Task ConvertList() { var units = _service.Units; - var res = units.GroupBy(x => x.UnitType) - .Aggregate(new EmbedBuilder().WithTitle(GetText("convertlist")) - .WithOkColor(), - (embed, g) => embed.AddField(efb => - efb.WithName(g.Key.ToTitleCase()) - .WithValue(String.Join(", ", g.Select(x => x.Triggers.FirstOrDefault()) - .OrderBy(x => x))))); - await ctx.Channel.EmbedAsync(res).ConfigureAwait(false); + + var embed = new EmbedBuilder() + .WithTitle(GetText("convertlist")) + .WithOkColor(); + + + foreach (var g in units.GroupBy(x => x.UnitType)) + { + embed.AddField(g.Key.ToTitleCase(), + String.Join(", ", g.Select(x => x.Triggers.FirstOrDefault()).OrderBy(x => x))); + } + + await ctx.Channel.EmbedAsync(embed).ConfigureAwait(false); } [NadekoCommand, Aliases] diff --git a/src/NadekoBot/Modules/Utility/Utility.cs b/src/NadekoBot/Modules/Utility/Utility.cs index d7dc508a2..0f381cb39 100644 --- a/src/NadekoBot/Modules/Utility/Utility.cs +++ b/src/NadekoBot/Modules/Utility/Utility.cs @@ -273,9 +273,9 @@ namespace NadekoBot.Modules.Utility .AddField(GetText("memory"), $"{_stats.Heap} MB", true) .AddField(GetText("owner_ids"), ownerIds, true) .AddField(GetText("uptime"), _stats.GetUptimeString("\n"), true) - .AddField(efb => efb.WithName(GetText("presence")).WithValue( + .AddField(GetText("presence"), GetText("presence_txt", - _coord.GetGuildCount(), _stats.TextChannels, _stats.VoiceChannels)).WithIsInline(true))) + _coord.GetGuildCount(), _stats.TextChannels, _stats.VoiceChannels), true)) .ConfigureAwait(false); } @@ -309,13 +309,13 @@ namespace NadekoBot.Modules.Utility return; } - await ctx.Channel.EmbedAsync(guilds.Aggregate(new EmbedBuilder().WithOkColor(), - (embed, g) => embed.AddField(efb => efb.WithName(g.Name) - .WithValue( - GetText("listservers", g.Id, g.MemberCount, - g.OwnerId)) - .WithIsInline(false)))) - .ConfigureAwait(false); + var embed = new EmbedBuilder().WithOkColor(); + foreach (var guild in guilds) + embed.AddField(guild.Name, + GetText("listservers", guild.Id, guild.MemberCount, guild.OwnerId), + false); + + await ctx.Channel.EmbedAsync(embed); }