All .AddField calls no longer use builder

- Cleaned up convertlist and listserver embeds slightly
This commit is contained in:
Kwoth
2021-07-08 20:01:42 +02:00
parent a17d0afc7d
commit 5b4daa9dd3
20 changed files with 116 additions and 147 deletions

View File

@@ -235,14 +235,10 @@ namespace NadekoBot.Modules.Administration
.WithTitle(GetText("prot_active")); .WithTitle(GetText("prot_active"));
if (spam != null) if (spam != null)
embed.AddField(efb => efb.WithName("Anti-Spam") embed.AddField("Anti-Spam", GetAntiSpamString(spam).TrimTo(1024), true);
.WithValue(GetAntiSpamString(spam).TrimTo(1024))
.WithIsInline(true));
if (raid != null) if (raid != null)
embed.AddField(efb => efb.WithName("Anti-Raid") embed.AddField("Anti-Raid", GetAntiRaidString(raid).TrimTo(1024), true);
.WithValue(GetAntiRaidString(raid).TrimTo(1024))
.WithIsInline(true));
if (alt is not null) if (alt is not null)
embed.AddField("Anti-Alt", GetAntiAltString(alt), true); embed.AddField("Anti-Alt", GetAntiAltString(alt), true);

View File

@@ -59,12 +59,9 @@ namespace NadekoBot.Modules.Administration
await ctx.Channel.EmbedAsync(new EmbedBuilder().WithOkColor() await ctx.Channel.EmbedAsync(new EmbedBuilder().WithOkColor()
.WithTitle(GetText("scadd")) .WithTitle(GetText("scadd"))
.AddField(efb => efb.WithName(GetText("server")) .AddField(GetText("server"), cmd.GuildId is null ? $"-" : $"{cmd.GuildName}/{cmd.GuildId}", true)
.WithValue(cmd.GuildId is null ? $"-" : $"{cmd.GuildName}/{cmd.GuildId}").WithIsInline(true)) .AddField(GetText("channel"), $"{cmd.ChannelName}/{cmd.ChannelId}", true)
.AddField(efb => efb.WithName(GetText("channel")) .AddField(GetText("command_text"), cmdText, false));
.WithValue($"{cmd.ChannelName}/{cmd.ChannelId}").WithIsInline(true))
.AddField(efb => efb.WithName(GetText("command_text"))
.WithValue(cmdText).WithIsInline(false))).ConfigureAwait(false);
} }
[NadekoCommand, Aliases] [NadekoCommand, Aliases]

View File

@@ -595,12 +595,10 @@ namespace NadekoBot.Modules.Administration.Services
if (before.Nickname != after.Nickname) if (before.Nickname != after.Nickname)
{ {
embed.WithAuthor("👥 " + GetText(logChannel.Guild, "nick_change")) embed.WithAuthor("👥 " + GetText(logChannel.Guild, "nick_change"))
.AddField(efb => .AddField(GetText(logChannel.Guild, "old_nick")
efb.WithName(GetText(logChannel.Guild, "old_nick")) , $"{before.Nickname}#{before.Discriminator}")
.WithValue($"{before.Nickname}#{before.Discriminator}")) .AddField(GetText(logChannel.Guild, "new_nick")
.AddField(efb => , $"{after.Nickname}#{after.Discriminator}");
efb.WithName(GetText(logChannel.Guild, "new_nick"))
.WithValue($"{after.Nickname}#{after.Discriminator}"));
await logChannel.EmbedAsync(embed).ConfigureAwait(false); await logChannel.EmbedAsync(embed).ConfigureAwait(false);
} }
@@ -703,19 +701,14 @@ namespace NadekoBot.Modules.Administration.Services
{ {
embed.WithTitle(" " + GetText(logChannel.Guild, "ch_name_change")) embed.WithTitle(" " + GetText(logChannel.Guild, "ch_name_change"))
.WithDescription($"{after} | {after.Id}") .WithDescription($"{after} | {after.Id}")
.AddField(efb => .AddField(GetText(logChannel.Guild, "ch_old_name"), before.Name);
efb.WithName(GetText(logChannel.Guild, "ch_old_name")).WithValue(before.Name));
} }
else if (beforeTextChannel?.Topic != afterTextChannel?.Topic) else if (beforeTextChannel?.Topic != afterTextChannel?.Topic)
{ {
embed.WithTitle(" " + GetText(logChannel.Guild, "ch_topic_change")) embed.WithTitle(" " + GetText(logChannel.Guild, "ch_topic_change"))
.WithDescription($"{after} | {after.Id}") .WithDescription($"{after} | {after.Id}")
.AddField(efb => .AddField(GetText(logChannel.Guild, "old_topic") , beforeTextChannel?.Topic ?? "-")
efb.WithName(GetText(logChannel.Guild, "old_topic")) .AddField(GetText(logChannel.Guild, "new_topic"), afterTextChannel?.Topic ?? "-");
.WithValue(beforeTextChannel?.Topic ?? "-"))
.AddField(efb =>
efb.WithName(GetText(logChannel.Guild, "new_topic"))
.WithValue(afterTextChannel?.Topic ?? "-"));
} }
else else
return; return;
@@ -931,7 +924,7 @@ namespace NadekoBot.Modules.Administration.Services
.WithOkColor() .WithOkColor()
.WithTitle("❌ " + GetText(logChannel.Guild, "user_left")) .WithTitle("❌ " + GetText(logChannel.Guild, "user_left"))
.WithDescription(usr.ToString()) .WithDescription(usr.ToString())
.AddField(efb => efb.WithName("Id").WithValue(usr.Id.ToString())) .AddField("Id", usr.Id.ToString())
.WithFooter(CurrentTime(usr.Guild)); .WithFooter(CurrentTime(usr.Guild));
if (Uri.IsWellFormedUriString(usr.GetAvatarUrl(), UriKind.Absolute)) if (Uri.IsWellFormedUriString(usr.GetAvatarUrl(), UriKind.Absolute))
@@ -966,13 +959,13 @@ namespace NadekoBot.Modules.Administration.Services
.WithOkColor() .WithOkColor()
.WithTitle("✅ " + GetText(logChannel.Guild, "user_joined")) .WithTitle("✅ " + GetText(logChannel.Guild, "user_joined"))
.WithDescription($"{usr.Mention} `{usr}`") .WithDescription($"{usr.Mention} `{usr}`")
.AddField(efb => efb.WithName("Id").WithValue(usr.Id.ToString())) .AddField("Id", usr.Id.ToString())
.AddField(fb => .AddField(GetText(logChannel.Guild, "joined_server"),
fb.WithName(GetText(logChannel.Guild, "joined_server")) $"{usr.JoinedAt?.ToString("dd.MM.yyyy HH:mm" ?? "?")}",
.WithValue($"{usr.JoinedAt?.ToString("dd.MM.yyyy HH:mm") ?? "?"}").WithIsInline(true)) true)
.AddField(fb => .AddField(GetText(logChannel.Guild, "joined_discord"),
fb.WithName(GetText(logChannel.Guild, "joined_discord")) $"{usr.CreatedAt:dd.MM.yyyy HH:mm}",
.WithValue($"{usr.CreatedAt:dd.MM.yyyy HH:mm}").WithIsInline(true)) true)
.WithFooter(CurrentTime(usr.Guild)); .WithFooter(CurrentTime(usr.Guild));
if (Uri.IsWellFormedUriString(usr.GetAvatarUrl(), UriKind.Absolute)) if (Uri.IsWellFormedUriString(usr.GetAvatarUrl(), UriKind.Absolute))
@@ -1006,7 +999,7 @@ namespace NadekoBot.Modules.Administration.Services
.WithOkColor() .WithOkColor()
.WithTitle("♻️ " + GetText(logChannel.Guild, "user_unbanned")) .WithTitle("♻️ " + GetText(logChannel.Guild, "user_unbanned"))
.WithDescription(usr.ToString()) .WithDescription(usr.ToString())
.AddField(efb => efb.WithName("Id").WithValue(usr.Id.ToString())) .AddField("Id", usr.Id.ToString())
.WithFooter(CurrentTime(guild)); .WithFooter(CurrentTime(guild));
if (Uri.IsWellFormedUriString(usr.GetAvatarUrl(), UriKind.Absolute)) if (Uri.IsWellFormedUriString(usr.GetAvatarUrl(), UriKind.Absolute))
@@ -1041,7 +1034,7 @@ namespace NadekoBot.Modules.Administration.Services
.WithOkColor() .WithOkColor()
.WithTitle("🚫 " + GetText(logChannel.Guild, "user_banned")) .WithTitle("🚫 " + GetText(logChannel.Guild, "user_banned"))
.WithDescription(usr.ToString()) .WithDescription(usr.ToString())
.AddField(efb => efb.WithName("Id").WithValue(usr.Id.ToString())) .AddField("Id", usr.Id.ToString())
.WithFooter(CurrentTime(guild)); .WithFooter(CurrentTime(guild));
var avatarUrl = usr.GetAvatarUrl(); var avatarUrl = usr.GetAvatarUrl();
@@ -1090,16 +1083,15 @@ namespace NadekoBot.Modules.Administration.Services
.WithOkColor() .WithOkColor()
.WithTitle("🗑 " + GetText(logChannel.Guild, "msg_del", ((ITextChannel) msg.Channel).Name)) .WithTitle("🗑 " + GetText(logChannel.Guild, "msg_del", ((ITextChannel) msg.Channel).Name))
.WithDescription(msg.Author.ToString()) .WithDescription(msg.Author.ToString())
.AddField(efb => .AddField(GetText(logChannel.Guild, "content"),
efb.WithName(GetText(logChannel.Guild, "content")) string.IsNullOrWhiteSpace(resolvedMessage) ? "-" : resolvedMessage,
.WithValue(string.IsNullOrWhiteSpace(resolvedMessage) ? "-" : resolvedMessage) false)
.WithIsInline(false))
.AddField("Id", msg.Id.ToString(), false) .AddField("Id", msg.Id.ToString(), false)
.WithFooter(CurrentTime(channel.Guild)); .WithFooter(CurrentTime(channel.Guild));
if (msg.Attachments.Any()) if (msg.Attachments.Any())
embed.AddField(efb => embed.AddField(GetText(logChannel.Guild, "attachments"),
efb.WithName(GetText(logChannel.Guild, "attachments")) string.Join(", ", msg.Attachments.Select(a => a.Url)),
.WithValue(string.Join(", ", msg.Attachments.Select(a => a.Url))).WithIsInline(false)); false);
await logChannel.EmbedAsync(embed).ConfigureAwait(false); await logChannel.EmbedAsync(embed).ConfigureAwait(false);
} }
@@ -1146,18 +1138,19 @@ namespace NadekoBot.Modules.Administration.Services
var embed = new EmbedBuilder() var embed = new EmbedBuilder()
.WithOkColor() .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()) .WithDescription(after.Author.ToString())
.AddField(efb => .AddField(GetText(logChannel.Guild, "old_msg"),
efb.WithName(GetText(logChannel.Guild, "old_msg")) string.IsNullOrWhiteSpace(before.Content)
.WithValue(string.IsNullOrWhiteSpace(before.Content) ? "-"
? "-" : before.Resolve(userHandling: TagHandling.FullName),
: before.Resolve(userHandling: TagHandling.FullName)).WithIsInline(false)) false)
.AddField(efb => .AddField(
efb.WithName(GetText(logChannel.Guild, "new_msg")) GetText(logChannel.Guild, "new_msg"),
.WithValue(string.IsNullOrWhiteSpace(after.Content) string.IsNullOrWhiteSpace(after.Content)
? "-" ? "-"
: after.Resolve(userHandling: TagHandling.FullName)).WithIsInline(false)) : after.Resolve(userHandling: TagHandling.FullName),
false)
.AddField("Id", after.Id.ToString(), false) .AddField("Id", after.Id.ToString(), false)
.WithFooter(CurrentTime(channel.Guild)); .WithFooter(CurrentTime(channel.Guild));

View File

@@ -62,8 +62,8 @@ namespace NadekoBot.Modules.Administration
{ {
await (await user.GetOrCreateDMChannelAsync().ConfigureAwait(false)).EmbedAsync(new EmbedBuilder().WithErrorColor() await (await user.GetOrCreateDMChannelAsync().ConfigureAwait(false)).EmbedAsync(new EmbedBuilder().WithErrorColor()
.WithDescription(GetText("warned_on", ctx.Guild.ToString())) .WithDescription(GetText("warned_on", ctx.Guild.ToString()))
.AddField(efb => efb.WithName(GetText("moderator")).WithValue(ctx.User.ToString())) .AddField(GetText("moderator"), ctx.User.ToString())
.AddField(efb => efb.WithName(GetText("reason")).WithValue(reason ?? "-"))) .AddField(GetText("reason"), reason ?? "-"))
.ConfigureAwait(false); .ConfigureAwait(false);
} }
catch catch

View File

@@ -44,8 +44,8 @@ namespace NadekoBot.Modules.CustomReactions
await ctx.Channel.EmbedAsync(new EmbedBuilder().WithOkColor() await ctx.Channel.EmbedAsync(new EmbedBuilder().WithOkColor()
.WithTitle(GetText("new_cust_react")) .WithTitle(GetText("new_cust_react"))
.WithDescription($"#{(kwum)cr.Id}") .WithDescription($"#{(kwum)cr.Id}")
.AddField(efb => efb.WithName(GetText("trigger")).WithValue(key)) .AddField(GetText("trigger"), key)
.AddField(efb => efb.WithName(GetText("response")).WithValue(message.Length > 1024 ? GetText("redacted_too_long") : message)) .AddField(GetText("response"), message.Length > 1024 ? GetText("redacted_too_long") : message)
).ConfigureAwait(false); ).ConfigureAwait(false);
} }
@@ -68,8 +68,8 @@ namespace NadekoBot.Modules.CustomReactions
await ctx.Channel.EmbedAsync(new EmbedBuilder().WithOkColor() await ctx.Channel.EmbedAsync(new EmbedBuilder().WithOkColor()
.WithTitle(GetText("edited_cust_react")) .WithTitle(GetText("edited_cust_react"))
.WithDescription($"#{id}") .WithDescription($"#{id}")
.AddField(efb => efb.WithName(GetText("trigger")).WithValue(cr.Trigger)) .AddField(GetText("trigger"), cr.Trigger)
.AddField(efb => efb.WithName(GetText("response")).WithValue(message.Length > 1024 ? GetText("redacted_too_long") : message)) .AddField(GetText("response"), message.Length > 1024 ? GetText("redacted_too_long") : message)
).ConfigureAwait(false); ).ConfigureAwait(false);
} }
else else
@@ -148,8 +148,8 @@ namespace NadekoBot.Modules.CustomReactions
{ {
await ctx.Channel.EmbedAsync(new EmbedBuilder().WithOkColor() await ctx.Channel.EmbedAsync(new EmbedBuilder().WithOkColor()
.WithDescription($"#{id}") .WithDescription($"#{id}")
.AddField(efb => efb.WithName(GetText("trigger")).WithValue(found.Trigger.TrimTo(1024))) .AddField(GetText("trigger"), found.Trigger.TrimTo(1024))
.AddField(efb => efb.WithName(GetText("response")).WithValue((found.Response + "\n```css\n" + found.Response).TrimTo(1020) + "```")) .AddField(GetText("response"), (found.Response + "\n```css\n" + found.Response).TrimTo(1020) + "```")
).ConfigureAwait(false); ).ConfigureAwait(false);
} }
} }
@@ -170,8 +170,8 @@ namespace NadekoBot.Modules.CustomReactions
await ctx.Channel.EmbedAsync(new EmbedBuilder().WithOkColor() await ctx.Channel.EmbedAsync(new EmbedBuilder().WithOkColor()
.WithTitle(GetText("deleted")) .WithTitle(GetText("deleted"))
.WithDescription($"#{id}") .WithDescription($"#{id}")
.AddField(efb => efb.WithName(GetText("trigger")).WithValue(cr.Trigger.TrimTo(1024))) .AddField(GetText("trigger"), cr.Trigger.TrimTo(1024))
.AddField(efb => efb.WithName(GetText("response")).WithValue(cr.Response.TrimTo(1024)))).ConfigureAwait(false); .AddField(GetText("response"), cr.Response.TrimTo(1024))).ConfigureAwait(false);
} }
else else
{ {

View File

@@ -569,9 +569,7 @@ namespace NadekoBot.Modules.Gambling
var usrStr = x.ToString().TrimTo(20, true); var usrStr = x.ToString().TrimTo(20, true);
var j = i; var j = i;
embed.AddField(efb => efb.WithName("#" + (9 * curPage + j + 1) + " " + usrStr) embed.AddField("#" + (9 * curPage + j + 1) + " " + usrStr, n(x.CurrencyAmount) + " " + CurrencySign, true);
.WithValue(n(x.CurrencyAmount) + " " + CurrencySign)
.WithIsInline(true));
} }
return embed; return embed;

View File

@@ -87,8 +87,8 @@ namespace NadekoBot.Modules.Games.Common.Trivia
{ {
questionEmbed = new EmbedBuilder().WithOkColor() questionEmbed = new EmbedBuilder().WithOkColor()
.WithTitle(GetText("trivia_game")) .WithTitle(GetText("trivia_game"))
.AddField(eab => eab.WithName(GetText("category")).WithValue(CurrentQuestion.Category)) .AddField(GetText("category"), CurrentQuestion.Category)
.AddField(eab => eab.WithName(GetText("question")).WithValue(CurrentQuestion.Question)); .AddField(GetText("question"), CurrentQuestion.Question);
if (showHowToQuit) if (showHowToQuit)
questionEmbed.WithFooter(GetText("trivia_quit", _quitCommand)); questionEmbed.WithFooter(GetText("trivia_quit", _quitCommand));

View File

@@ -157,15 +157,11 @@ namespace NadekoBot.Modules.Games.Common
var wpm = CurrentSentence.Length / WORD_VALUE / elapsed.TotalSeconds * 60; var wpm = CurrentSentence.Length / WORD_VALUE / elapsed.TotalSeconds * 60;
finishedUserIds.Add(msg.Author.Id); finishedUserIds.Add(msg.Author.Id);
await this.Channel.EmbedAsync(new EmbedBuilder().WithOkColor() await this.Channel.EmbedAsync(new EmbedBuilder().WithOkColor()
.WithTitle($"{msg.Author} finished the race!") .WithTitle($"{msg.Author} finished the race!")
.AddField(efb => .AddField("Place", $"#{finishedUserIds.Count}", true)
efb.WithName("Place").WithValue($"#{finishedUserIds.Count}").WithIsInline(true)) .AddField("WPM", $"{wpm:F1} *[{elapsed.TotalSeconds:F2}sec]*", true)
.AddField(efb => .AddField("Errors", distance.ToString(), true));
efb.WithName("WPM").WithValue($"{wpm:F1} *[{elapsed.TotalSeconds:F2}sec]*")
.WithIsInline(true))
.AddField(efb =>
efb.WithName("Errors").WithValue(distance.ToString()).WithIsInline(true)))
.ConfigureAwait(false);
if (finishedUserIds.Count % 4 == 0) if (finishedUserIds.Count % 4 == 0)
{ {
await this.Channel.SendConfirmAsync( await this.Channel.SendConfirmAsync(

View File

@@ -89,7 +89,7 @@ namespace NadekoBot.Modules.Games
{ {
var loseEmbed = new EmbedBuilder().WithTitle($"Hangman Game ({game.TermType}) - Ended") var loseEmbed = new EmbedBuilder().WithTitle($"Hangman Game ({game.TermType}) - Ended")
.WithDescription(Format.Bold("You lose.")) .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)) .WithFooter(string.Join(" ", game.PreviousGuesses))
.WithErrorColor(); .WithErrorColor();
@@ -101,7 +101,7 @@ namespace NadekoBot.Modules.Games
var winEmbed = new EmbedBuilder().WithTitle($"Hangman Game ({game.TermType}) - Ended") var winEmbed = new EmbedBuilder().WithTitle($"Hangman Game ({game.TermType}) - Ended")
.WithDescription(Format.Bold($"{winner} Won.")) .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)) .WithFooter(string.Join(" ", game.PreviousGuesses))
.WithOkColor(); .WithOkColor();

View File

@@ -64,23 +64,20 @@ namespace NadekoBot.Modules.Help.Services
if (alias != null) if (alias != null)
str += $" **/ `{prefix + alias}`**"; str += $" **/ `{prefix + alias}`**";
var em = new EmbedBuilder() var em = new EmbedBuilder()
.AddField(fb => fb.WithName(str) .AddField(str, $"{com.RealSummary(_strings, guild?.Id, prefix)}", true);
.WithValue($"{com.RealSummary(_strings, guild?.Id, prefix)}")
.WithIsInline(true));
_dpos.TryGetOverrides(guild?.Id ?? 0, com.Name, out var overrides); _dpos.TryGetOverrides(guild?.Id ?? 0, com.Name, out var overrides);
var reqs = GetCommandRequirements(com, overrides); var reqs = GetCommandRequirements(com, overrides);
if(reqs.Any()) if(reqs.Any())
{ {
em.AddField(GetText("requires", guild), em.AddField(GetText("requires", guild), string.Join("\n", reqs));
string.Join("\n", reqs));
} }
em em
.AddField(fb => fb.WithName(GetText("usage", guild)) .AddField(GetText("usage", guild),
.WithValue(string.Join("\n", Array.ConvertAll(com.RealRemarksArr(_strings, guild?.Id, prefix), string.Join("\n", Array.ConvertAll(com.RealRemarksArr(_strings, guild?.Id, prefix),
arg => Format.Code(arg)))) arg => Format.Code(arg))),
.WithIsInline(false)) false)
.WithFooter(GetText("module", guild, com.Module.GetTopLevelModule().Name)) .WithFooter(GetText("module", guild, com.Module.GetTopLevelModule().Name))
.WithColor(Bot.OkColor); .WithColor(Bot.OkColor);

View File

@@ -162,11 +162,11 @@ namespace NadekoBot.Modules.Music
await uow.SaveChangesAsync(); await uow.SaveChangesAsync();
} }
await ctx.Channel.EmbedAsync(new EmbedBuilder().WithOkColor() await ctx.Channel.EmbedAsync(new EmbedBuilder()
.WithTitle(GetText("playlist_saved")) .WithOkColor()
.AddField(efb => efb.WithName(GetText("name")).WithValue(name)) .WithTitle(GetText("playlist_saved"))
.AddField(efb => efb.WithName(GetText("id")).WithValue(playlist.Id.ToString()))) .AddField(GetText("name"), name)
.ConfigureAwait(false); .AddField(GetText("id"), playlist.Id.ToString()));
} }

View File

@@ -39,16 +39,14 @@ namespace NadekoBot.Modules.Permissions
var embed = new EmbedBuilder().WithOkColor(); var embed = new EmbedBuilder().WithOkColor();
if (blockedModule.Any()) if (blockedModule.Any())
embed.AddField(efb => efb embed.AddField(GetText("blocked_modules")
.WithName(GetText("blocked_modules")) , string.Join("\n", _service.BlockedModules)
.WithValue(string.Join("\n", _service.BlockedModules)) , false);
.WithIsInline(false));
if (blockedCommands.Any()) if (blockedCommands.Any())
embed.AddField(efb => efb embed.AddField(GetText("blocked_commands")
.WithName(GetText("blocked_commands")) , string.Join("\n", _service.BlockedCommands)
.WithValue(string.Join("\n", _service.BlockedCommands)) , false);
.WithIsInline(false));
await ctx.Channel.EmbedAsync(embed).ConfigureAwait(false); await ctx.Channel.EmbedAsync(embed).ConfigureAwait(false);
} }

View File

@@ -67,9 +67,7 @@ namespace NadekoBot.Modules.Searches
.WithDescription(string.IsNullOrWhiteSpace(kvp.Value.Desc) .WithDescription(string.IsNullOrWhiteSpace(kvp.Value.Desc)
? kvp.Value.ShortDesc ? kvp.Value.ShortDesc
: kvp.Value.Desc) : kvp.Value.Desc)
.AddField(efb => efb.WithName(GetText("rating")) .AddField(GetText("rating"), kvp.Value.Rating.ToString(_cultureInfo), true));
.WithValue(kvp.Value.Rating.ToString(_cultureInfo)).WithIsInline(true))
).ConfigureAwait(false);
return; return;
} }
} }

View File

@@ -324,11 +324,8 @@ namespace NadekoBot.Modules.Searches
await ctx.Channel.EmbedAsync(new EmbedBuilder() await ctx.Channel.EmbedAsync(new EmbedBuilder()
.WithColor(Bot.OkColor) .WithColor(Bot.OkColor)
.AddField(efb => efb.WithName(GetText("original_url")) .AddField(GetText("original_url"), $"<{query}>")
.WithValue($"<{query}>")) .AddField(GetText("short_url"), $"<{shortLink}>"));
.AddField(efb => efb.WithName(GetText("short_url"))
.WithValue($"<{shortLink}>")))
.ConfigureAwait(false);
} }
[NadekoCommand, Aliases] [NadekoCommand, Aliases]
@@ -540,7 +537,7 @@ namespace NadekoBot.Modules.Searches
.WithOkColor(); .WithOkColor();
if (!string.IsNullOrWhiteSpace(data.Example)) if (!string.IsNullOrWhiteSpace(data.Example))
embed.AddField(efb => efb.WithName(GetText("example")).WithValue(data.Example)); embed.AddField(GetText("example"), data.Example);
return embed; return embed;
}, col.Count, 1); }, col.Count, 1);

View File

@@ -444,12 +444,8 @@ namespace NadekoBot.Modules.Searches.Services
.WithTitle(status.Name) .WithTitle(status.Name)
.WithUrl(status.StreamUrl) .WithUrl(status.StreamUrl)
.WithDescription(status.StreamUrl) .WithDescription(status.StreamUrl)
.AddField(efb => efb.WithName(GetText(guildId, "status")) .AddField(GetText(guildId, "status"), status.IsLive ? "🟢 Online" : "🔴 Offline", true)
.WithValue(status.IsLive ? "🟢 Online" : "🔴 Offline") .AddField(GetText(guildId, "viewers"), status.IsLive ? status.Viewers.ToString() : "-", true)
.WithIsInline(true))
.AddField(efb => efb.WithName(GetText(guildId, "viewers"))
.WithValue(status.IsLive ? status.Viewers.ToString() : "-")
.WithIsInline(true))
.WithColor(status.IsLive ? Bot.OkColor : Bot.ErrorColor); .WithColor(status.IsLive ? Bot.OkColor : Bot.ErrorColor);
if (!string.IsNullOrWhiteSpace(status.Title)) if (!string.IsNullOrWhiteSpace(status.Title))

View File

@@ -63,13 +63,12 @@ namespace NadekoBot.Modules.Utility
embed.WithThumbnailUrl(guild.IconUrl); embed.WithThumbnailUrl(guild.IconUrl);
if (guild.Emotes.Any()) if (guild.Emotes.Any())
{ {
embed.AddField(fb => embed.AddField(GetText("custom_emojis") + $"({guild.Emotes.Count})",
fb.WithName(GetText("custom_emojis") + $"({guild.Emotes.Count})") string.Join(" ", guild.Emotes
.WithValue(string.Join(" ", guild.Emotes
.Shuffle() .Shuffle()
.Take(20) .Take(20)
.Select(e => $"{e.Name} {e.ToString()}")) .Select(e => $"{e.Name} {e.ToString()}"))
.TrimTo(1020))); .TrimTo(1020));
} }
await ctx.Channel.EmbedAsync(embed).ConfigureAwait(false); await ctx.Channel.EmbedAsync(embed).ConfigureAwait(false);
} }

View File

@@ -38,12 +38,11 @@ namespace NadekoBot.Modules.Utility
var helpcmd = Format.Code(Prefix + "donate"); var helpcmd = Format.Code(Prefix + "donate");
await ctx.Channel.EmbedAsync(new EmbedBuilder().WithOkColor() await ctx.Channel.EmbedAsync(new EmbedBuilder().WithOkColor()
.WithDescription(GetText("clpa_obsolete")) .WithDescription(GetText("clpa_obsolete"))
.AddField(efb => efb.WithName(GetText("clpa_fail_already_title")).WithValue(GetText("clpa_fail_already"))) .AddField(GetText("clpa_fail_already_title"), GetText("clpa_fail_already"))
.AddField(efb => efb.WithName(GetText("clpa_fail_wait_title")).WithValue(GetText("clpa_fail_wait"))) .AddField(GetText("clpa_fail_wait_title"), GetText("clpa_fail_wait"))
.AddField(efb => efb.WithName(GetText("clpa_fail_conn_title")).WithValue(GetText("clpa_fail_conn"))) .AddField(GetText("clpa_fail_conn_title"), GetText("clpa_fail_conn"))
.AddField(efb => efb.WithName(GetText("clpa_fail_sup_title")).WithValue(GetText("clpa_fail_sup", helpcmd))) .AddField(GetText("clpa_fail_sup_title"), GetText("clpa_fail_sup", helpcmd))
.WithFooter(GetText("clpa_next_update", rem))) .WithFooter(GetText("clpa_next_update", rem)));
.ConfigureAwait(false);
} }
} }
} }

View File

@@ -118,10 +118,10 @@ namespace NadekoBot.Modules.Utility
await ctx.Channel.EmbedAsync(new EmbedBuilder() await ctx.Channel.EmbedAsync(new EmbedBuilder()
.WithOkColor() .WithOkColor()
.WithTitle(GetText("quote_id", $"#{data.Id}")) .WithTitle(GetText("quote_id", $"#{data.Id}"))
.AddField(efb => efb.WithName(GetText("trigger")).WithValue(data.Keyword)) .AddField(GetText("trigger"), data.Keyword)
.AddField(efb => efb.WithName(GetText("response")).WithValue(data.Text.Length > 1000 .AddField(GetText("response"), data.Text.Length > 1000
? GetText("redacted_too_long") ? GetText("redacted_too_long")
: Format.Sanitize(data.Text))) : Format.Sanitize(data.Text))
.WithFooter(GetText("created_by", $"{data.AuthorName} ({data.AuthorId})")) .WithFooter(GetText("created_by", $"{data.AuthorName} ({data.AuthorId})"))
).ConfigureAwait(false); ).ConfigureAwait(false);
} }

View File

@@ -19,14 +19,19 @@ namespace NadekoBot.Modules.Utility
public async Task ConvertList() public async Task ConvertList()
{ {
var units = _service.Units; var units = _service.Units;
var res = units.GroupBy(x => x.UnitType)
.Aggregate(new EmbedBuilder().WithTitle(GetText("convertlist")) var embed = new EmbedBuilder()
.WithOkColor(), .WithTitle(GetText("convertlist"))
(embed, g) => embed.AddField(efb => .WithOkColor();
efb.WithName(g.Key.ToTitleCase())
.WithValue(String.Join(", ", g.Select(x => x.Triggers.FirstOrDefault())
.OrderBy(x => x))))); foreach (var g in units.GroupBy(x => x.UnitType))
await ctx.Channel.EmbedAsync(res).ConfigureAwait(false); {
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] [NadekoCommand, Aliases]

View File

@@ -273,9 +273,9 @@ namespace NadekoBot.Modules.Utility
.AddField(GetText("memory"), $"{_stats.Heap} MB", true) .AddField(GetText("memory"), $"{_stats.Heap} MB", true)
.AddField(GetText("owner_ids"), ownerIds, true) .AddField(GetText("owner_ids"), ownerIds, true)
.AddField(GetText("uptime"), _stats.GetUptimeString("\n"), true) .AddField(GetText("uptime"), _stats.GetUptimeString("\n"), true)
.AddField(efb => efb.WithName(GetText("presence")).WithValue( .AddField(GetText("presence"),
GetText("presence_txt", GetText("presence_txt",
_coord.GetGuildCount(), _stats.TextChannels, _stats.VoiceChannels)).WithIsInline(true))) _coord.GetGuildCount(), _stats.TextChannels, _stats.VoiceChannels), true))
.ConfigureAwait(false); .ConfigureAwait(false);
} }
@@ -309,13 +309,13 @@ namespace NadekoBot.Modules.Utility
return; return;
} }
await ctx.Channel.EmbedAsync(guilds.Aggregate(new EmbedBuilder().WithOkColor(), var embed = new EmbedBuilder().WithOkColor();
(embed, g) => embed.AddField(efb => efb.WithName(g.Name) foreach (var guild in guilds)
.WithValue( embed.AddField(guild.Name,
GetText("listservers", g.Id, g.MemberCount, GetText("listservers", guild.Id, guild.MemberCount, guild.OwnerId),
g.OwnerId)) false);
.WithIsInline(false))))
.ConfigureAwait(false); await ctx.Channel.EmbedAsync(embed);
} }