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

@@ -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);
}

View File

@@ -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)));
}
}
}

View File

@@ -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);
}

View File

@@ -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]

View File

@@ -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);
}