diff --git a/src/NadekoBot/Common/CREmbed.cs b/src/NadekoBot/Common/CREmbed.cs index fe01df507..524166d4f 100644 --- a/src/NadekoBot/Common/CREmbed.cs +++ b/src/NadekoBot/Common/CREmbed.cs @@ -66,7 +66,7 @@ namespace NadekoBot.Common foreach (var f in Fields) { if (!string.IsNullOrWhiteSpace(f.Name) && !string.IsNullOrWhiteSpace(f.Value)) - embed.AddField(efb => efb.WithName(f.Name).WithValue(f.Value).WithIsInline(f.Inline)); + embed.AddField(f.Name, f.Value, f.Inline); } return embed; diff --git a/src/NadekoBot/Modules/Administration/Services/LogCommandService.cs b/src/NadekoBot/Modules/Administration/Services/LogCommandService.cs index f66afa39c..d7d28d512 100644 --- a/src/NadekoBot/Modules/Administration/Services/LogCommandService.cs +++ b/src/NadekoBot/Modules/Administration/Services/LogCommandService.cs @@ -260,16 +260,16 @@ namespace NadekoBot.Modules.Administration.Services { embed.WithTitle("πŸ‘₯ " + GetText(g, "username_changed")) .WithDescription($"{before.Username}#{before.Discriminator} | {before.Id}") - .AddField(fb => fb.WithName("Old Name").WithValue($"{before.Username}").WithIsInline(true)) - .AddField(fb => fb.WithName("New Name").WithValue($"{after.Username}").WithIsInline(true)) - .WithFooter(fb => fb.WithText(CurrentTime(g))) + .AddField("Old Name", $"{before.Username}", true) + .AddField("New Name", $"{after.Username}", true) + .WithFooter(CurrentTime(g)) .WithOkColor(); } else if (before.AvatarId != after.AvatarId) { embed.WithTitle("πŸ‘₯" + GetText(g, "avatar_changed")) .WithDescription($"{before.Username}#{before.Discriminator} | {before.Id}") - .WithFooter(fb => fb.WithText(CurrentTime(g))) + .WithFooter(CurrentTime(g)) .WithOkColor(); var bav = before.RealAvatarUrl(); @@ -443,7 +443,7 @@ namespace NadekoBot.Modules.Administration.Services var embed = new EmbedBuilder().WithAuthor(eab => eab.WithName(mutes)) .WithTitle($"{usr.Username}#{usr.Discriminator} | {usr.Id}") - .WithFooter(fb => fb.WithText(CurrentTime(usr.Guild))) + .WithFooter(CurrentTime(usr.Guild)) .WithOkColor(); await logChannel.EmbedAsync(embed).ConfigureAwait(false); @@ -488,7 +488,7 @@ namespace NadekoBot.Modules.Administration.Services var embed = new EmbedBuilder().WithAuthor(eab => eab.WithName(mutes)) .WithTitle($"{usr.Username}#{usr.Discriminator} | {usr.Id}") - .WithFooter(fb => fb.WithText($"{CurrentTime(usr.Guild)}")) + .WithFooter($"{CurrentTime(usr.Guild)}") .WithOkColor(); if (!string.IsNullOrWhiteSpace(reason)) @@ -544,7 +544,7 @@ namespace NadekoBot.Modules.Administration.Services var embed = new EmbedBuilder().WithAuthor(eab => eab.WithName($"πŸ›‘ Anti-{protection}")) .WithTitle(GetText(logChannel.Guild, "users") + " " + punishment) .WithDescription(string.Join("\n", users.Select(u => u.ToString()))) - .WithFooter(fb => fb.WithText(CurrentTime(logChannel.Guild))) + .WithFooter(CurrentTime(logChannel.Guild)) .WithOkColor(); await logChannel.EmbedAsync(embed).ConfigureAwait(false); @@ -590,7 +590,7 @@ namespace NadekoBot.Modules.Administration.Services .ConfigureAwait(false)) != null) { var embed = new EmbedBuilder().WithOkColor() - .WithFooter(efb => efb.WithText(CurrentTime(before.Guild))) + .WithFooter(CurrentTime(before.Guild)) .WithTitle($"{before.Username}#{before.Discriminator} | {before.Id}"); if (before.Nickname != after.Nickname) { @@ -695,7 +695,7 @@ namespace NadekoBot.Modules.Administration.Services return; var embed = new EmbedBuilder().WithOkColor() - .WithFooter(efb => efb.WithText(CurrentTime(before.Guild))); + .WithFooter(CurrentTime(before.Guild)); var beforeTextChannel = cbefore as ITextChannel; var afterTextChannel = cafter as ITextChannel; @@ -761,7 +761,7 @@ namespace NadekoBot.Modules.Administration.Services .WithOkColor() .WithTitle("πŸ†• " + title) .WithDescription($"{ch.Name} | {ch.Id}") - .WithFooter(efb => efb.WithText(CurrentTime(ch.Guild)))).ConfigureAwait(false); + .WithFooter(CurrentTime(ch.Guild))).ConfigureAwait(false); } catch { @@ -800,7 +800,7 @@ namespace NadekoBot.Modules.Administration.Services .WithOkColor() .WithTitle("πŸ†• " + title) .WithDescription($"{ch.Name} | {ch.Id}") - .WithFooter(efb => efb.WithText(CurrentTime(ch.Guild)))).ConfigureAwait(false); + .WithFooter(CurrentTime(ch.Guild))).ConfigureAwait(false); } catch (Exception) { @@ -933,7 +933,7 @@ namespace NadekoBot.Modules.Administration.Services .WithTitle("❌ " + GetText(logChannel.Guild, "user_left")) .WithDescription(usr.ToString()) .AddField(efb => efb.WithName("Id").WithValue(usr.Id.ToString())) - .WithFooter(efb => efb.WithText(CurrentTime(usr.Guild))); + .WithFooter(CurrentTime(usr.Guild)); if (Uri.IsWellFormedUriString(usr.GetAvatarUrl(), UriKind.Absolute)) embed.WithThumbnailUrl(usr.GetAvatarUrl()); @@ -974,7 +974,7 @@ namespace NadekoBot.Modules.Administration.Services .AddField(fb => fb.WithName(GetText(logChannel.Guild, "joined_discord")) .WithValue($"{usr.CreatedAt:dd.MM.yyyy HH:mm}").WithIsInline(true)) - .WithFooter(efb => efb.WithText(CurrentTime(usr.Guild))); + .WithFooter(CurrentTime(usr.Guild)); if (Uri.IsWellFormedUriString(usr.GetAvatarUrl(), UriKind.Absolute)) embed.WithThumbnailUrl(usr.GetAvatarUrl()); @@ -1008,7 +1008,7 @@ namespace NadekoBot.Modules.Administration.Services .WithTitle("♻️ " + GetText(logChannel.Guild, "user_unbanned")) .WithDescription(usr.ToString()) .AddField(efb => efb.WithName("Id").WithValue(usr.Id.ToString())) - .WithFooter(efb => efb.WithText(CurrentTime(guild))); + .WithFooter(CurrentTime(guild)); if (Uri.IsWellFormedUriString(usr.GetAvatarUrl(), UriKind.Absolute)) embed.WithThumbnailUrl(usr.GetAvatarUrl()); @@ -1043,7 +1043,7 @@ namespace NadekoBot.Modules.Administration.Services .WithTitle("🚫 " + GetText(logChannel.Guild, "user_banned")) .WithDescription(usr.ToString()) .AddField(efb => efb.WithName("Id").WithValue(usr.Id.ToString())) - .WithFooter(efb => efb.WithText(CurrentTime(guild))); + .WithFooter(CurrentTime(guild)); var avatarUrl = usr.GetAvatarUrl(); @@ -1095,8 +1095,8 @@ namespace NadekoBot.Modules.Administration.Services efb.WithName(GetText(logChannel.Guild, "content")) .WithValue(string.IsNullOrWhiteSpace(resolvedMessage) ? "-" : resolvedMessage) .WithIsInline(false)) - .AddField(efb => efb.WithName("Id").WithValue(msg.Id.ToString()).WithIsInline(false)) - .WithFooter(efb => efb.WithText(CurrentTime(channel.Guild))); + .AddField("Id", msg.Id.ToString(), false) + .WithFooter(CurrentTime(channel.Guild)); if (msg.Attachments.Any()) embed.AddField(efb => efb.WithName(GetText(logChannel.Guild, "attachments")) @@ -1159,8 +1159,8 @@ namespace NadekoBot.Modules.Administration.Services .WithValue(string.IsNullOrWhiteSpace(after.Content) ? "-" : after.Resolve(userHandling: TagHandling.FullName)).WithIsInline(false)) - .AddField(efb => efb.WithName("Id").WithValue(after.Id.ToString()).WithIsInline(false)) - .WithFooter(efb => efb.WithText(CurrentTime(channel.Guild))); + .AddField("Id", after.Id.ToString(), false) + .WithFooter(CurrentTime(channel.Guild)); await logChannel.EmbedAsync(embed).ConfigureAwait(false); } diff --git a/src/NadekoBot/Modules/Administration/UserPunishCommands.cs b/src/NadekoBot/Modules/Administration/UserPunishCommands.cs index 53293c9ea..40b62d89e 100644 --- a/src/NadekoBot/Modules/Administration/UserPunishCommands.cs +++ b/src/NadekoBot/Modules/Administration/UserPunishCommands.cs @@ -445,9 +445,9 @@ namespace NadekoBot.Modules.Administration await _mute.TimedBan(Context.Guild, user, time.Time, ctx.User.ToString() + " | " + msg).ConfigureAwait(false); var toSend = new EmbedBuilder().WithOkColor() .WithTitle("⛔️ " + GetText("banned_user")) - .AddField(efb => efb.WithName(GetText("username")).WithValue(user.ToString()).WithIsInline(true)) - .AddField(efb => efb.WithName("ID").WithValue(user.Id.ToString()).WithIsInline(true)) - .AddField(efb => efb.WithName(GetText("duration")).WithValue($"{time.Time.Days}d {time.Time.Hours}h {time.Time.Minutes}m").WithIsInline(true)); + .AddField(GetText("username"), user.ToString(), true) + .AddField("ID", user.Id.ToString(), true) + .AddField(GetText("duration"), $"{time.Time.Days}d {time.Time.Hours}h {time.Time.Minutes}m", true); if (dmFailed) { @@ -472,7 +472,7 @@ namespace NadekoBot.Modules.Administration await ctx.Channel.EmbedAsync(new EmbedBuilder().WithOkColor() .WithTitle("⛔️ " + GetText("banned_user")) - .AddField(efb => efb.WithName("ID").WithValue(userId.ToString()).WithIsInline(true))) + .AddField("ID", userId.ToString(), true)) .ConfigureAwait(false); } else @@ -512,8 +512,8 @@ namespace NadekoBot.Modules.Administration var toSend = new EmbedBuilder().WithOkColor() .WithTitle("⛔️ " + GetText("banned_user")) - .AddField(efb => efb.WithName(GetText("username")).WithValue(user.ToString()).WithIsInline(true)) - .AddField(efb => efb.WithName("ID").WithValue(user.Id.ToString()).WithIsInline(true)); + .AddField(GetText("username"), user.ToString(), true) + .AddField("ID", user.Id.ToString(), true); if (dmFailed) { @@ -690,8 +690,8 @@ namespace NadekoBot.Modules.Administration var toSend = new EmbedBuilder().WithOkColor() .WithTitle("☣ " + GetText("sb_user")) - .AddField(efb => efb.WithName(GetText("username")).WithValue(user.ToString()).WithIsInline(true)) - .AddField(efb => efb.WithName("ID").WithValue(user.Id.ToString()).WithIsInline(true)); + .AddField(GetText("username"), user.ToString(), true) + .AddField("ID", user.Id.ToString(), true); if (dmFailed) { @@ -745,8 +745,8 @@ namespace NadekoBot.Modules.Administration var toSend = new EmbedBuilder().WithOkColor() .WithTitle(GetText("kicked_user")) - .AddField(efb => efb.WithName(GetText("username")).WithValue(user.ToString()).WithIsInline(true)) - .AddField(efb => efb.WithName("ID").WithValue(user.Id.ToString()).WithIsInline(true)); + .AddField(GetText("username"), user.ToString(), true) + .AddField("ID", user.Id.ToString(), true); if (dmFailed) { diff --git a/src/NadekoBot/Modules/Gambling/ShopCommands.cs b/src/NadekoBot/Modules/Gambling/ShopCommands.cs index adc621aeb..64b53dd81 100644 --- a/src/NadekoBot/Modules/Gambling/ShopCommands.cs +++ b/src/NadekoBot/Modules/Gambling/ShopCommands.cs @@ -174,9 +174,9 @@ namespace NadekoBot.Modules.Gambling await (await ctx.User.GetOrCreateDMChannelAsync().ConfigureAwait(false)) .EmbedAsync(new EmbedBuilder().WithOkColor() .WithTitle(GetText("shop_purchase", ctx.Guild.Name)) - .AddField(efb => efb.WithName(GetText("item")).WithValue(item.Text).WithIsInline(false)) - .AddField(efb => efb.WithName(GetText("price")).WithValue(entry.Price.ToString()).WithIsInline(true)) - .AddField(efb => efb.WithName(GetText("name")).WithValue(entry.Name).WithIsInline(true))) + .AddField(GetText("item"), item.Text, false) + .AddField(GetText("price"), entry.Price.ToString(), true) + .AddField(GetText("name"), entry.Name, true)) .ConfigureAwait(false); await _cs.AddAsync(entry.AuthorId, @@ -433,17 +433,17 @@ namespace NadekoBot.Modules.Gambling var embed = new EmbedBuilder().WithOkColor(); if (entry.Type == ShopEntryType.Role) - return embed.AddField(efb => efb.WithName(GetText("name")).WithValue(GetText("shop_role", Format.Bold(ctx.Guild.GetRole(entry.RoleId)?.Name ?? "MISSING_ROLE"))).WithIsInline(true)) - .AddField(efb => efb.WithName(GetText("price")).WithValue(entry.Price.ToString()).WithIsInline(true)) - .AddField(efb => efb.WithName(GetText("type")).WithValue(entry.Type.ToString()).WithIsInline(true)); + return embed.AddField(GetText("name"), GetText("shop_role", Format.Bold(ctx.Guild.GetRole(entry.RoleId)?.Name ?? "MISSING_ROLE")), true) + .AddField(GetText("price"), entry.Price.ToString(), true) + .AddField(GetText("type"), entry.Type.ToString(), true); else if (entry.Type == ShopEntryType.List) - return embed.AddField(efb => efb.WithName(GetText("name")).WithValue(entry.Name).WithIsInline(true)) - .AddField(efb => efb.WithName(GetText("price")).WithValue(entry.Price.ToString()).WithIsInline(true)) - .AddField(efb => efb.WithName(GetText("type")).WithValue(GetText("random_unique_item")).WithIsInline(true)); + return embed.AddField(GetText("name"), entry.Name, true) + .AddField(GetText("price"), entry.Price.ToString(), true) + .AddField(GetText("type"), GetText("random_unique_item"), true); //else if (entry.Type == ShopEntryType.Infinite_List) - // return embed.AddField(efb => efb.WithName(GetText("name")).WithValue(GetText("shop_role", Format.Bold(entry.RoleName))).WithIsInline(true)) - // .AddField(efb => efb.WithName(GetText("price")).WithValue(entry.Price.ToString()).WithIsInline(true)) - // .AddField(efb => efb.WithName(GetText("type")).WithValue(entry.Type.ToString()).WithIsInline(true)); + // return embed.AddField(GetText("name"), GetText("shop_role", Format.Bold(entry.RoleName)), true) + // .AddField(GetText("price"), entry.Price.ToString(), true) + // .AddField(GetText("type"), entry.Type.ToString(), true); else return null; } diff --git a/src/NadekoBot/Modules/Gambling/SlotCommands.cs b/src/NadekoBot/Modules/Gambling/SlotCommands.cs index 8030fcf23..4606c644c 100644 --- a/src/NadekoBot/Modules/Gambling/SlotCommands.cs +++ b/src/NadekoBot/Modules/Gambling/SlotCommands.cs @@ -101,9 +101,9 @@ namespace NadekoBot.Modules.Gambling var embed = new EmbedBuilder() .WithOkColor() .WithTitle("Slot Stats") - .AddField(efb => efb.WithName("Total Bet").WithValue(bet.ToString()).WithIsInline(true)) - .AddField(efb => efb.WithName("Paid Out").WithValue(paid.ToString()).WithIsInline(true)) - .WithFooter(efb => efb.WithText($"Payout Rate: {paid * 1.0 / bet * 100:f4}%")); + .AddField("Total Bet", bet.ToString(), true) + .AddField("Paid Out", paid.ToString(), true) + .WithFooter($"Payout Rate: {paid * 1.0 / bet * 100:f4}%"); await ctx.Channel.EmbedAsync(embed).ConfigureAwait(false); } diff --git a/src/NadekoBot/Modules/Gambling/WaifuClaimCommands.cs b/src/NadekoBot/Modules/Gambling/WaifuClaimCommands.cs index c590c69e1..49e2deee5 100644 --- a/src/NadekoBot/Modules/Gambling/WaifuClaimCommands.cs +++ b/src/NadekoBot/Modules/Gambling/WaifuClaimCommands.cs @@ -229,7 +229,7 @@ namespace NadekoBot.Modules.Gambling foreach (var w in waifus) { var j = i++; - embed.AddField(efb => efb.WithName("#" + ((page * 9) + j + 1) + " - " + w.Price + CurrencySign).WithValue(w.ToString()).WithIsInline(false)); + embed.AddField("#" + ((page * 9) + j + 1) + " - " + w.Price + CurrencySign, w.ToString(), false); } await ctx.Channel.EmbedAsync(embed); diff --git a/src/NadekoBot/Modules/Games/AcropobiaCommands.cs b/src/NadekoBot/Modules/Games/AcropobiaCommands.cs index aecb017a4..1a52f46f9 100644 --- a/src/NadekoBot/Modules/Games/AcropobiaCommands.cs +++ b/src/NadekoBot/Modules/Games/AcropobiaCommands.cs @@ -83,7 +83,7 @@ namespace NadekoBot.Modules.Games var embed = new EmbedBuilder().WithOkColor() .WithTitle(GetText("acrophobia")) .WithDescription(GetText("acro_started", Format.Bold(string.Join(".", game.StartingLetters)))) - .WithFooter(efb => efb.WithText(GetText("acro_started_footer", game.Opts.SubmissionTime))); + .WithFooter(GetText("acro_started_footer", game.Opts.SubmissionTime)); return ctx.Channel.EmbedAsync(embed); } @@ -108,7 +108,7 @@ namespace NadekoBot.Modules.Games .WithDescription( GetText("acro_winner_only", Format.Bold(submissions.First().Key.UserName))) - .WithFooter(efb => efb.WithText(submissions.First().Key.Input))) + .WithFooter(submissions.First().Key.Input)) .ConfigureAwait(false); return; } @@ -122,7 +122,7 @@ namespace NadekoBot.Modules.Games $@"-- {submissions.Aggregate("", (agg, cur) => agg + $"`{++i}.` **{cur.Key.Input}**\n")} --")) - .WithFooter(efb => efb.WithText(GetText("acro_vote"))); + .WithFooter(GetText("acro_vote")); await ctx.Channel.EmbedAsync(embed).ConfigureAwait(false); } @@ -140,7 +140,7 @@ $@"-- .WithTitle(GetText("acrophobia")) .WithDescription(GetText("acro_winner", Format.Bold(winner.Key.UserName), Format.Bold(winner.Value.ToString()))) - .WithFooter(efb => efb.WithText(winner.Key.Input)); + .WithFooter(winner.Key.Input); await ctx.Channel.EmbedAsync(embed).ConfigureAwait(false); } diff --git a/src/NadekoBot/Modules/Games/Common/TicTacToe.cs b/src/NadekoBot/Modules/Games/Common/TicTacToe.cs index b41f36edc..ae89c1d08 100644 --- a/src/NadekoBot/Modules/Games/Common/TicTacToe.cs +++ b/src/NadekoBot/Modules/Games/Common/TicTacToe.cs @@ -104,12 +104,12 @@ namespace NadekoBot.Modules.Games.Common if (_winner is null) { if (_phase == Phase.Ended) - embed.WithFooter(efb => efb.WithText(GetText("ttt_no_moves"))); + embed.WithFooter(GetText("ttt_no_moves")); else - embed.WithFooter(efb => efb.WithText(GetText("ttt_users_move", _users[_curUserIndex]))); + embed.WithFooter(GetText("ttt_users_move", _users[_curUserIndex])); } else - embed.WithFooter(efb => efb.WithText(GetText("ttt_has_won", _winner))); + embed.WithFooter(GetText("ttt_has_won", _winner)); return embed; } diff --git a/src/NadekoBot/Modules/Games/Common/Trivia/TriviaGame.cs b/src/NadekoBot/Modules/Games/Common/Trivia/TriviaGame.cs index e6d30e647..d172594f2 100644 --- a/src/NadekoBot/Modules/Games/Common/Trivia/TriviaGame.cs +++ b/src/NadekoBot/Modules/Games/Common/Trivia/TriviaGame.cs @@ -125,7 +125,7 @@ namespace NadekoBot.Modules.Games.Common.Trivia if (!_options.NoHint) try { - await questionMessage.ModifyAsync(m => m.Embed = questionEmbed.WithFooter(efb => efb.WithText(CurrentQuestion.GetHint())).Build()) + await questionMessage.ModifyAsync(m => m.Embed = questionEmbed.WithFooter(CurrentQuestion.GetHint()).Build()) .ConfigureAwait(false); } catch (HttpException ex) when (ex.HttpCode == System.Net.HttpStatusCode.NotFound || ex.HttpCode == System.Net.HttpStatusCode.Forbidden) diff --git a/src/NadekoBot/Modules/Games/Games.cs b/src/NadekoBot/Modules/Games/Games.cs index 6084ae0f0..9e4b570c0 100644 --- a/src/NadekoBot/Modules/Games/Games.cs +++ b/src/NadekoBot/Modules/Games/Games.cs @@ -50,7 +50,7 @@ namespace NadekoBot.Modules.Games var res = _service.GetEightballResponse(ctx.User.Id, question); await ctx.Channel.EmbedAsync(new EmbedBuilder().WithColor(Bot.OkColor) .WithDescription(ctx.User.ToString()) - .AddField(efb => efb.WithName("❓ " + GetText("question")).WithValue(question).WithIsInline(false)) + .AddField("❓ " + GetText("question"), question, false) .AddField("🎱 " + GetText("8ball"), res, false)); } @@ -80,9 +80,9 @@ namespace NadekoBot.Modules.Games text: Format.Bold($"{ctx.User.Mention} Girl Rating For {usr}"), embed: new EmbedBuilder() .WithOkColor() - .AddField(efb => efb.WithName("Hot").WithValue(gr.Hot.ToString("F2")).WithIsInline(true)) - .AddField(efb => efb.WithName("Crazy").WithValue(gr.Crazy.ToString("F2")).WithIsInline(true)) - .AddField(efb => efb.WithName("Advice").WithValue(gr.Advice).WithIsInline(false)) + .AddField("Hot", gr.Hot.ToString("F2"), true) + .AddField("Crazy", gr.Crazy.ToString("F2"), true) + .AddField("Advice", gr.Advice, false) .Build()).ConfigureAwait(false); } } diff --git a/src/NadekoBot/Modules/Games/HangmanCommands.cs b/src/NadekoBot/Modules/Games/HangmanCommands.cs index 7cd1e77f2..1762b0a6d 100644 --- a/src/NadekoBot/Modules/Games/HangmanCommands.cs +++ b/src/NadekoBot/Modules/Games/HangmanCommands.cs @@ -90,7 +90,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())) - .WithFooter(efb => efb.WithText(string.Join(" ", game.PreviousGuesses))) + .WithFooter(string.Join(" ", game.PreviousGuesses)) .WithErrorColor(); if (Uri.IsWellFormedUriString(game.Term.ImageUrl, UriKind.Absolute)) @@ -102,7 +102,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())) - .WithFooter(efb => efb.WithText(string.Join(" ", game.PreviousGuesses))) + .WithFooter(string.Join(" ", game.PreviousGuesses)) .WithOkColor(); if (Uri.IsWellFormedUriString(game.Term.ImageUrl, UriKind.Absolute)) diff --git a/src/NadekoBot/Modules/Games/PollCommands.cs b/src/NadekoBot/Modules/Games/PollCommands.cs index f28229ab4..a1dedb019 100644 --- a/src/NadekoBot/Modules/Games/PollCommands.cs +++ b/src/NadekoBot/Modules/Games/PollCommands.cs @@ -116,7 +116,7 @@ namespace NadekoBot.Modules.Games } return eb.WithDescription(sb.ToString()) - .WithFooter(efb => efb.WithText(GetText("x_votes_cast", totalVotesCast))) + .WithFooter(GetText("x_votes_cast", totalVotesCast)) .WithOkColor(); } } diff --git a/src/NadekoBot/Modules/Help/Services/HelpService.cs b/src/NadekoBot/Modules/Help/Services/HelpService.cs index 97fc6cc74..8c8f3818a 100644 --- a/src/NadekoBot/Modules/Help/Services/HelpService.cs +++ b/src/NadekoBot/Modules/Help/Services/HelpService.cs @@ -81,7 +81,7 @@ namespace NadekoBot.Modules.Help.Services .WithValue(string.Join("\n", Array.ConvertAll(com.RealRemarksArr(_strings, guild?.Id, prefix), arg => Format.Code(arg)))) .WithIsInline(false)) - .WithFooter(efb => efb.WithText(GetText("module", guild, com.Module.GetTopLevelModule().Name))) + .WithFooter(GetText("module", guild, com.Module.GetTopLevelModule().Name)) .WithColor(Bot.OkColor); var opt = ((NadekoOptionsAttribute)com.Attributes.FirstOrDefault(x => x is NadekoOptionsAttribute))?.OptionType; diff --git a/src/NadekoBot/Modules/Music/Music.cs b/src/NadekoBot/Modules/Music/Music.cs index b1ed07020..e28951dad 100644 --- a/src/NadekoBot/Modules/Music/Music.cs +++ b/src/NadekoBot/Modules/Music/Music.cs @@ -617,8 +617,8 @@ namespace NadekoBot.Modules.Music var embed = new EmbedBuilder() .WithTitle(track.Title.TrimTo(65)) .WithAuthor(eab => eab.WithName(GetText("song_moved")).WithIconUrl("https://cdn.discordapp.com/attachments/155726317222887425/258605269972549642/music1.png")) - .AddField(fb => fb.WithName(GetText("from_position")).WithValue($"#{from + 1}").WithIsInline(true)) - .AddField(fb => fb.WithName(GetText("to_position")).WithValue($"#{to + 1}").WithIsInline(true)) + .AddField(GetText("from_position"), $"#{from + 1}", true) + .AddField(GetText("to_position"), $"#{to + 1}", true) .WithColor(Bot.OkColor); if (Uri.IsWellFormedUriString(track.Url, UriKind.Absolute)) diff --git a/src/NadekoBot/Modules/Nsfw/Nsfw.cs b/src/NadekoBot/Modules/Nsfw/Nsfw.cs index 294784ea4..440bd1cba 100644 --- a/src/NadekoBot/Modules/Nsfw/Nsfw.cs +++ b/src/NadekoBot/Modules/Nsfw/Nsfw.cs @@ -445,7 +445,7 @@ namespace NadekoBot.Modules.NSFW { var embed = new EmbedBuilder().WithOkColor() .WithDescription($"{ctx.User} [{tag ?? "url"}]({imgObj}) ") - .WithFooter(efb => efb.WithText(type.ToString())); + .WithFooter(type.ToString()); if (Uri.IsWellFormedUriString(imgObj.FileUrl, UriKind.Absolute)) embed.WithImageUrl(imgObj.FileUrl); diff --git a/src/NadekoBot/Modules/Searches/AnimeSearchCommands.cs b/src/NadekoBot/Modules/Searches/AnimeSearchCommands.cs index fbd22bf7a..5f052ccce 100644 --- a/src/NadekoBot/Modules/Searches/AnimeSearchCommands.cs +++ b/src/NadekoBot/Modules/Searches/AnimeSearchCommands.cs @@ -36,10 +36,10 @@ namespace NadekoBot.Modules.Searches .WithTitle(novelData.Title) .WithUrl(novelData.Link) .WithImageUrl(novelData.ImageUrl) - .AddField(efb => efb.WithName(GetText("authors")).WithValue(string.Join("\n", novelData.Authors)).WithIsInline(true)) - .AddField(efb => efb.WithName(GetText("status")).WithValue(novelData.Status).WithIsInline(true)) - .AddField(efb => efb.WithName(GetText("genres")).WithValue(string.Join(" ", novelData.Genres.Any() ? novelData.Genres : new[] { "none" })).WithIsInline(true)) - .WithFooter(efb => efb.WithText(GetText("score") + " " + novelData.Score)); + .AddField(GetText("authors"), string.Join("\n", novelData.Authors), true) + .AddField(GetText("status"), novelData.Status, true) + .AddField(GetText("genres"), string.Join(" ", novelData.Genres.Any() ? novelData.Genres : new[] { "none" }), true) + .WithFooter(GetText("score" + " " + novelData.Score)); await ctx.Channel.EmbedAsync(embed).ConfigureAwait(false); } @@ -84,19 +84,19 @@ namespace NadekoBot.Modules.Searches var embed = new EmbedBuilder() .WithOkColor() .WithTitle(GetText("mal_profile", name)) - .AddField(efb => efb.WithName("πŸ’š " + GetText("watching")).WithValue(stats[0]).WithIsInline(true)) - .AddField(efb => efb.WithName("πŸ’™ " + GetText("completed")).WithValue(stats[1]).WithIsInline(true)); + .AddField("πŸ’š " + GetText("watching"), stats[0], true) + .AddField("πŸ’™ " + GetText("completed"), stats[1], true); if (info.Count < 3) - embed.AddField(efb => efb.WithName("πŸ’› " + GetText("on_hold")).WithValue(stats[2]).WithIsInline(true)); + embed.AddField("πŸ’› " + GetText("on_hold"), stats[2], true); embed - .AddField(efb => efb.WithName("πŸ’” " + GetText("dropped")).WithValue(stats[3]).WithIsInline(true)) - .AddField(efb => efb.WithName("βšͺ " + GetText("plan_to_watch")).WithValue(stats[4]).WithIsInline(true)) - .AddField(efb => efb.WithName("πŸ• " + daysAndMean[0][0]).WithValue(daysAndMean[0][1]).WithIsInline(true)) - .AddField(efb => efb.WithName("πŸ“Š " + daysAndMean[1][0]).WithValue(daysAndMean[1][1]).WithIsInline(true)) - .AddField(efb => efb.WithName(MalInfoToEmoji(info[0].Item1) + " " + info[0].Item1).WithValue(info[0].Item2.TrimTo(20)).WithIsInline(true)) - .AddField(efb => efb.WithName(MalInfoToEmoji(info[1].Item1) + " " + info[1].Item1).WithValue(info[1].Item2.TrimTo(20)).WithIsInline(true)); + .AddField("πŸ’” " + GetText("dropped"), stats[3], true) + .AddField("βšͺ " + GetText("plan_to_watch"), stats[4], true) + .AddField("πŸ• " + daysAndMean[0][0], daysAndMean[0][1], true) + .AddField("πŸ“Š " + daysAndMean[1][0], daysAndMean[1][1], true) + .AddField(MalInfoToEmoji(info[0].Item1) + " " + info[0].Item1, info[0].Item2.TrimTo(20), true) + .AddField(MalInfoToEmoji(info[1].Item1) + " " + info[1].Item1, info[1].Item2.TrimTo(20), true); if (info.Count > 2) - embed.AddField(efb => efb.WithName(MalInfoToEmoji(info[2].Item1) + " " + info[2].Item1).WithValue(info[2].Item2.TrimTo(20)).WithIsInline(true)); + embed.AddField(MalInfoToEmoji(info[2].Item1) + " " + info[2].Item1, info[2].Item2.TrimTo(20), true); embed .WithDescription($@" @@ -156,10 +156,10 @@ namespace NadekoBot.Modules.Searches .WithTitle(animeData.TitleEnglish) .WithUrl(animeData.Link) .WithImageUrl(animeData.ImageUrlLarge) - .AddField(efb => efb.WithName(GetText("episodes")).WithValue(animeData.TotalEpisodes.ToString()).WithIsInline(true)) - .AddField(efb => efb.WithName(GetText("status")).WithValue(animeData.AiringStatus.ToString()).WithIsInline(true)) - .AddField(efb => efb.WithName(GetText("genres")).WithValue(string.Join(",\n", animeData.Genres.Any() ? animeData.Genres : new[] { "none" })).WithIsInline(true)) - .WithFooter(efb => efb.WithText(GetText("score") + " " + animeData.AverageScore + " / 100")); + .AddField(GetText("episodes"), animeData.TotalEpisodes.ToString(), true) + .AddField(GetText("status"), animeData.AiringStatus.ToString(), true) + .AddField(GetText("genres"), string.Join(",\n", animeData.Genres.Any() ? animeData.Genres : new[] { "none" }), true) + .WithFooter(GetText("score" + " " + animeData.AverageScore + " / 100")); await ctx.Channel.EmbedAsync(embed).ConfigureAwait(false); } @@ -184,10 +184,10 @@ namespace NadekoBot.Modules.Searches .WithTitle(mangaData.TitleEnglish) .WithUrl(mangaData.Link) .WithImageUrl(mangaData.ImageUrlLge) - .AddField(efb => efb.WithName(GetText("chapters")).WithValue(mangaData.TotalChapters.ToString()).WithIsInline(true)) - .AddField(efb => efb.WithName(GetText("status")).WithValue(mangaData.PublishingStatus.ToString()).WithIsInline(true)) - .AddField(efb => efb.WithName(GetText("genres")).WithValue(string.Join(",\n", mangaData.Genres.Any() ? mangaData.Genres : new[] { "none" })).WithIsInline(true)) - .WithFooter(efb => efb.WithText(GetText("score") + " " + mangaData.AverageScore + " / 100")); + .AddField(GetText("chapters"), mangaData.TotalChapters.ToString(), true) + .AddField(GetText("status"), mangaData.PublishingStatus.ToString(), true) + .AddField(GetText("genres"), string.Join(",\n", mangaData.Genres.Any() ? mangaData.Genres : new[] { "none" }), true) + .WithFooter(GetText("score" + " " + mangaData.AverageScore + " / 100")); await ctx.Channel.EmbedAsync(embed).ConfigureAwait(false); } diff --git a/src/NadekoBot/Modules/Searches/PathOfExileCommands.cs b/src/NadekoBot/Modules/Searches/PathOfExileCommands.cs index f81a5315f..13798dabb 100644 --- a/src/NadekoBot/Modules/Searches/PathOfExileCommands.cs +++ b/src/NadekoBot/Modules/Searches/PathOfExileCommands.cs @@ -206,8 +206,8 @@ namespace NadekoBot.Modules.Searches var embed = new EmbedBuilder().WithAuthor(eau => eau.WithName($"{leagueName} Currency Exchange") .WithUrl("http://poe.ninja") .WithIconUrl("https://web.poecdn.com/image/favicon/ogimage.png")) - .AddField(efb => efb.WithName("Currency Type").WithValue(cleanCurrency).WithIsInline(true)) - .AddField(efb => efb.WithName($"{cleanConvert} Equivalent").WithValue(chaosEquivalent / conversionEquivalent).WithIsInline(true)) + .AddField("Currency Type", cleanCurrency, true) + .AddField($"{cleanConvert} Equivalent", chaosEquivalent / conversionEquivalent, true) .WithOkColor(); await ctx.Channel.EmbedAsync(embed).ConfigureAwait(false); diff --git a/src/NadekoBot/Modules/Searches/PokemonSearchCommands.cs b/src/NadekoBot/Modules/Searches/PokemonSearchCommands.cs index 5bb1ded02..54da8747e 100644 --- a/src/NadekoBot/Modules/Searches/PokemonSearchCommands.cs +++ b/src/NadekoBot/Modules/Searches/PokemonSearchCommands.cs @@ -43,9 +43,9 @@ namespace NadekoBot.Modules.Searches .WithTitle(kvp.Key.ToTitleCase()) .WithDescription(p.BaseStats.ToString()) .WithThumbnailUrl($"https://assets.pokemon.com/assets/cms2/img/pokedex/detail/{p.Id.ToString("000")}.png") - .AddField(efb => efb.WithName(GetText("types")).WithValue(string.Join("\n", p.Types)).WithIsInline(true)) - .AddField(efb => efb.WithName(GetText("height_weight")).WithValue(GetText("height_weight_val", p.HeightM, p.WeightKg)).WithIsInline(true)) - .AddField(efb => efb.WithName(GetText("abilities")).WithValue(string.Join("\n", p.Abilities.Select(a => a.Value))).WithIsInline(true))).ConfigureAwait(false); + .AddField(GetText("types"), string.Join("\n", p.Types), true) + .AddField(GetText("height_weight"), GetText("height_weight_val", p.HeightM, p.WeightKg), true) + .AddField(GetText("abilities"), string.Join("\n", p.Abilities.Select(a => a.Value)), true)).ConfigureAwait(false); return; } } diff --git a/src/NadekoBot/Modules/Searches/Searches.cs b/src/NadekoBot/Modules/Searches/Searches.cs index d2dad9496..025c317ae 100644 --- a/src/NadekoBot/Modules/Searches/Searches.cs +++ b/src/NadekoBot/Modules/Searches/Searches.cs @@ -91,17 +91,17 @@ namespace NadekoBot.Modules.Searches sunset = sunset.ToOffset(tz.GetUtcOffset(sunset)); var timezone = $"UTC{sunrise:zzz}"; - embed.AddField(fb => fb.WithName("🌍 " + Format.Bold(GetText("location"))).WithValue($"[{data.Name + ", " + data.Sys.Country}](https://openweathermap.org/city/{data.Id})").WithIsInline(true)) - .AddField(fb => fb.WithName("πŸ“ " + Format.Bold(GetText("latlong"))).WithValue($"{data.Coord.Lat}, {data.Coord.Lon}").WithIsInline(true)) - .AddField(fb => fb.WithName("☁ " + Format.Bold(GetText("condition"))).WithValue(string.Join(", ", data.Weather.Select(w => w.Main))).WithIsInline(true)) - .AddField(fb => fb.WithName("πŸ˜“ " + Format.Bold(GetText("humidity"))).WithValue($"{data.Main.Humidity}%").WithIsInline(true)) - .AddField(fb => fb.WithName("πŸ’¨ " + Format.Bold(GetText("wind_speed"))).WithValue(data.Wind.Speed + " m/s").WithIsInline(true)) - .AddField(fb => fb.WithName("🌑 " + Format.Bold(GetText("temperature"))).WithValue($"{data.Main.Temp:F1}Β°C / {f(data.Main.Temp):F1}Β°F").WithIsInline(true)) - .AddField(fb => fb.WithName("πŸ”† " + Format.Bold(GetText("min_max"))).WithValue($"{data.Main.TempMin:F1}Β°C - {data.Main.TempMax:F1}Β°C\n{f(data.Main.TempMin):F1}Β°F - {f(data.Main.TempMax):F1}Β°F").WithIsInline(true)) - .AddField(fb => fb.WithName("πŸŒ„ " + Format.Bold(GetText("sunrise"))).WithValue($"{sunrise:HH:mm} {timezone}").WithIsInline(true)) - .AddField(fb => fb.WithName("πŸŒ‡ " + Format.Bold(GetText("sunset"))).WithValue($"{sunset:HH:mm} {timezone}").WithIsInline(true)) + embed.AddField("🌍 " + Format.Bold(GetText("location")), $"[{data.Name + ", " + data.Sys.Country}](https://openweathermap.org/city/{data.Id})", true) + .AddField("πŸ“ " + Format.Bold(GetText("latlong")), $"{data.Coord.Lat}, {data.Coord.Lon}", true) + .AddField("☁ " + Format.Bold(GetText("condition")), string.Join(", ", data.Weather.Select(w => w.Main)), true) + .AddField("πŸ˜“ " + Format.Bold(GetText("humidity")), $"{data.Main.Humidity}%", true) + .AddField("πŸ’¨ " + Format.Bold(GetText("wind_speed")), data.Wind.Speed + " m/s", true) + .AddField("🌑 " + Format.Bold(GetText("temperature")), $"{data.Main.Temp:F1}Β°C / {f(data.Main.Temp):F1}Β°F", true) + .AddField("πŸ”† " + Format.Bold(GetText("min_max")), $"{data.Main.TempMin:F1}Β°C - {data.Main.TempMax:F1}Β°C\n{f(data.Main.TempMin):F1}Β°F - {f(data.Main.TempMax):F1}Β°F", true) + .AddField("πŸŒ„ " + Format.Bold(GetText("sunrise")), $"{sunrise:HH:mm} {timezone}", true) + .AddField("πŸŒ‡ " + Format.Bold(GetText("sunset")), $"{sunset:HH:mm} {timezone}", true) .WithOkColor() - .WithFooter(efb => efb.WithText("Powered by openweathermap.org").WithIconUrl($"http://openweathermap.org/img/w/{data.Weather[0].Icon}.png")); + .WithFooter("Powered by openweathermap.org", $"http://openweathermap.org/img/w/{data.Weather[0].Icon}.png"); } await ctx.Channel.EmbedAsync(embed).ConfigureAwait(false); } @@ -186,9 +186,9 @@ namespace NadekoBot.Modules.Searches .WithTitle(movie.Title) .WithUrl($"http://www.imdb.com/title/{movie.ImdbId}/") .WithDescription(movie.Plot.TrimTo(1000)) - .AddField(efb => efb.WithName("Rating").WithValue(movie.ImdbRating).WithIsInline(true)) - .AddField(efb => efb.WithName("Genre").WithValue(movie.Genre).WithIsInline(true)) - .AddField(efb => efb.WithName("Year").WithValue(movie.Year).WithIsInline(true)) + .AddField("Rating", movie.ImdbRating, true) + .AddField("Genre", movie.Genre, true) + .AddField("Year", movie.Year, true) .WithImageUrl(movie.Poster)).ConfigureAwait(false); } @@ -359,7 +359,7 @@ namespace NadekoBot.Modules.Searches .WithAuthor(ctx.User.ToString(), iconUrl: "http://i.imgur.com/G46fm8J.png") .WithTitle(ctx.User.ToString()) - .WithFooter(efb => efb.WithText(data.TotalResults)) + .WithFooter(data.TotalResults) .WithDescription($"{GetText("search_for")} **{query}**\n\n" +descStr) .WithOkColor(); @@ -416,9 +416,9 @@ namespace NadekoBot.Modules.Searches .WithTitle(card.Name) .WithDescription(card.Description) .WithImageUrl(card.ImageUrl) - .AddField(efb => efb.WithName(GetText("store_url")).WithValue(card.StoreUrl).WithIsInline(true)) - .AddField(efb => efb.WithName(GetText("cost")).WithValue(card.ManaCost).WithIsInline(true)) - .AddField(efb => efb.WithName(GetText("types")).WithValue(card.Types).WithIsInline(true)); + .AddField(GetText("store_url"), card.StoreUrl, true) + .AddField(GetText("cost"), card.ManaCost, true) + .AddField(GetText("types"), card.Types, true); await ctx.Channel.EmbedAsync(embed).ConfigureAwait(false); } @@ -661,8 +661,8 @@ namespace NadekoBot.Modules.Searches } await ctx.Channel.EmbedAsync(new EmbedBuilder().WithOkColor() - .AddField(efb => efb.WithName("Username").WithValue(usr.ToString()).WithIsInline(false)) - .AddField(efb => efb.WithName("Avatar Url").WithValue(avatarUrl).WithIsInline(false)) + .AddField("Username", usr.ToString(), false) + .AddField("Avatar Url", avatarUrl, false) .WithThumbnailUrl(avatarUrl.ToString()), ctx.User.Mention).ConfigureAwait(false); } @@ -758,10 +758,10 @@ namespace NadekoBot.Modules.Searches // .WithTitle(gameData.Name) // .WithUrl(gameData.Link) // .WithImageUrl(gameData.HeaderImage) - // .AddField(efb => efb.WithName(GetText("genres")).WithValue(gameData.TotalEpisodes.ToString()).WithIsInline(true)) - // .AddField(efb => efb.WithName(GetText("price")).WithValue(gameData.IsFree ? GetText("FREE") : game).WithIsInline(true)) - // .AddField(efb => efb.WithName(GetText("links")).WithValue(gameData.GetGenresString()).WithIsInline(true)) - // .WithFooter(efb => efb.WithText(GetText("recommendations", gameData.TotalRecommendations))); + // .AddField(GetText("genres"), gameData.TotalEpisodes.ToString(), true) + // .AddField(GetText("price"), gameData.IsFree ? GetText("FREE") : game, true) + // .AddField(GetText("links"), gameData.GetGenresString(), true) + // .WithFooter(GetText("recommendations", gameData.TotalRecommendations)); await ctx.Channel.SendMessageAsync($"https://store.steampowered.com/app/{appId}").ConfigureAwait(false); } @@ -779,7 +779,7 @@ namespace NadekoBot.Modules.Searches await channel.EmbedAsync(new EmbedBuilder().WithOkColor() .WithDescription($"{umsg.Author.Mention} [{tag ?? "url"}]({imgObj.FileUrl})") .WithImageUrl(imgObj.FileUrl) - .WithFooter(efb => efb.WithText(type.ToString()))).ConfigureAwait(false); + .WithFooter(type.ToString())).ConfigureAwait(false); } public async Task ValidateQuery(IMessageChannel ch, string query) diff --git a/src/NadekoBot/Modules/Searches/XkcdCommands.cs b/src/NadekoBot/Modules/Searches/XkcdCommands.cs index d87d48995..60a3c0a63 100644 --- a/src/NadekoBot/Modules/Searches/XkcdCommands.cs +++ b/src/NadekoBot/Modules/Searches/XkcdCommands.cs @@ -37,14 +37,14 @@ namespace NadekoBot.Modules.Searches var embed = new EmbedBuilder().WithColor(Bot.OkColor) .WithImageUrl(comic.ImageLink) .WithAuthor(eab => eab.WithName(comic.Title).WithUrl($"{_xkcdUrl}/{comic.Num}").WithIconUrl("https://xkcd.com/s/919f27.ico")) - .AddField(efb => efb.WithName(GetText("comic_number")).WithValue(comic.Num.ToString()).WithIsInline(true)) - .AddField(efb => efb.WithName(GetText("date")).WithValue($"{comic.Month}/{comic.Year}").WithIsInline(true)); + .AddField(GetText("comic_number"), comic.Num.ToString(), true) + .AddField(GetText("date"), $"{comic.Month}/{comic.Year}", true); var sent = await ctx.Channel.EmbedAsync(embed) .ConfigureAwait(false); await Task.Delay(10000).ConfigureAwait(false); - await sent.ModifyAsync(m => m.Embed = embed.AddField(efb => efb.WithName("Alt").WithValue(comic.Alt.ToString()).WithIsInline(false)).Build()).ConfigureAwait(false); + await sent.ModifyAsync(m => m.Embed = embed.AddField("Alt", comic.Alt.ToString(), false).Build()).ConfigureAwait(false); } } catch (HttpRequestException) @@ -72,14 +72,14 @@ namespace NadekoBot.Modules.Searches var embed = new EmbedBuilder().WithColor(Bot.OkColor) .WithImageUrl(comic.ImageLink) .WithAuthor(eab => eab.WithName(comic.Title).WithUrl($"{_xkcdUrl}/{num}").WithIconUrl("https://xkcd.com/s/919f27.ico")) - .AddField(efb => efb.WithName(GetText("comic_number")).WithValue(comic.Num.ToString()).WithIsInline(true)) - .AddField(efb => efb.WithName(GetText("date")).WithValue($"{comic.Month}/{comic.Year}").WithIsInline(true)); + .AddField(GetText("comic_number"), comic.Num.ToString(), true) + .AddField(GetText("date"), $"{comic.Month}/{comic.Year}", true); var sent = await ctx.Channel.EmbedAsync(embed) .ConfigureAwait(false); await Task.Delay(10000).ConfigureAwait(false); - await sent.ModifyAsync(m => m.Embed = embed.AddField(efb => efb.WithName("Alt").WithValue(comic.Alt.ToString()).WithIsInline(false)).Build()).ConfigureAwait(false); + await sent.ModifyAsync(m => m.Embed = embed.AddField("Alt", comic.Alt.ToString(), false).Build()).ConfigureAwait(false); } } catch (HttpRequestException) diff --git a/src/NadekoBot/Modules/Utility/InfoCommands.cs b/src/NadekoBot/Modules/Utility/InfoCommands.cs index cecb64e0a..ed250334f 100644 --- a/src/NadekoBot/Modules/Utility/InfoCommands.cs +++ b/src/NadekoBot/Modules/Utility/InfoCommands.cs @@ -49,15 +49,15 @@ namespace NadekoBot.Modules.Utility var embed = new EmbedBuilder() .WithAuthor(eab => eab.WithName(GetText("server_info"))) .WithTitle(guild.Name) - .AddField(fb => fb.WithName(GetText("id")).WithValue(guild.Id.ToString()).WithIsInline(true)) - .AddField(fb => fb.WithName(GetText("owner")).WithValue(ownername.ToString()).WithIsInline(true)) - .AddField(fb => fb.WithName(GetText("members")).WithValue(guild.MemberCount.ToString()).WithIsInline(true)) - .AddField(fb => fb.WithName(GetText("text_channels")).WithValue(textchn.ToString()).WithIsInline(true)) - .AddField(fb => fb.WithName(GetText("voice_channels")).WithValue(voicechn.ToString()).WithIsInline(true)) - .AddField(fb => fb.WithName(GetText("created_at")).WithValue($"{createdAt:dd.MM.yyyy HH:mm}").WithIsInline(true)) - .AddField(fb => fb.WithName(GetText("region")).WithValue(guild.VoiceRegionId.ToString()).WithIsInline(true)) - .AddField(fb => fb.WithName(GetText("roles")).WithValue((guild.Roles.Count - 1).ToString()).WithIsInline(true)) - .AddField(fb => fb.WithName(GetText("features")).WithValue(features).WithIsInline(true)) + .AddField(GetText("id"), guild.Id.ToString(), true) + .AddField(GetText("owner"), ownername.ToString(), true) + .AddField(GetText("members"), guild.MemberCount.ToString(), true) + .AddField(GetText("text_channels"), textchn.ToString(), true) + .AddField(GetText("voice_channels"), voicechn.ToString(), true) + .AddField(GetText("created_at"), $"{createdAt:dd.MM.yyyy HH:mm}", true) + .AddField(GetText("region"), guild.VoiceRegionId.ToString(), true) + .AddField(GetText("roles"), (guild.Roles.Count - 1).ToString(), true) + .AddField(GetText("features"), features, true) .WithColor(Bot.OkColor); if (Uri.IsWellFormedUriString(guild.IconUrl, UriKind.Absolute)) embed.WithThumbnailUrl(guild.IconUrl); @@ -86,9 +86,9 @@ namespace NadekoBot.Modules.Utility var embed = new EmbedBuilder() .WithTitle(ch.Name) .WithDescription(ch.Topic?.SanitizeMentions(true)) - .AddField(fb => fb.WithName(GetText("id")).WithValue(ch.Id.ToString()).WithIsInline(true)) - .AddField(fb => fb.WithName(GetText("created_at")).WithValue($"{createdAt:dd.MM.yyyy HH:mm}").WithIsInline(true)) - .AddField(fb => fb.WithName(GetText("users")).WithValue(usercount.ToString()).WithIsInline(true)) + .AddField(GetText("id"), ch.Id.ToString(), true) + .AddField(GetText("created_at"), $"{createdAt:dd.MM.yyyy HH:mm}", true) + .AddField(GetText("users"), usercount.ToString(), true) .WithColor(Bot.OkColor); await ctx.Channel.EmbedAsync(embed).ConfigureAwait(false); } @@ -103,15 +103,15 @@ namespace NadekoBot.Modules.Utility return; var embed = new EmbedBuilder() - .AddField(fb => fb.WithName(GetText("name")).WithValue($"**{user.Username}**#{user.Discriminator}").WithIsInline(true)); + .AddField(GetText("name"), $"**{user.Username}**#{user.Discriminator}", true); if (!string.IsNullOrWhiteSpace(user.Nickname)) { - embed.AddField(fb => fb.WithName(GetText("nickname")).WithValue(user.Nickname).WithIsInline(true)); + embed.AddField(GetText("nickname"), user.Nickname, true); } - embed.AddField(fb => fb.WithName(GetText("id")).WithValue(user.Id.ToString()).WithIsInline(true)) - .AddField(fb => fb.WithName(GetText("joined_server")).WithValue($"{user.JoinedAt?.ToString("dd.MM.yyyy HH:mm") ?? "?"}").WithIsInline(true)) - .AddField(fb => fb.WithName(GetText("joined_discord")).WithValue($"{user.CreatedAt:dd.MM.yyyy HH:mm}").WithIsInline(true)) - .AddField(fb => fb.WithName(GetText("roles")).WithValue($"**({user.RoleIds.Count - 1})** - {string.Join("\n", user.GetRoles().Take(10).Where(r => r.Id != r.Guild.EveryoneRole.Id).Select(r => r.Name)).SanitizeMentions(true)}").WithIsInline(true)) + embed.AddField(GetText("id"), user.Id.ToString(), true) + .AddField(GetText("joined_server"), $"{user.JoinedAt?.ToString("dd.MM.yyyy HH:mm") ?? "?"}", true) + .AddField(GetText("joined_discord"), $"{user.CreatedAt:dd.MM.yyyy HH:mm}", true) + .AddField(GetText("roles"), $"**({user.RoleIds.Count - 1})** - {string.Join("\n", user.GetRoles().Take(10).Where(r => r.Id != r.Guild.EveryoneRole.Id).Select(r => r.Name)).SanitizeMentions(true)}", true) .WithColor(Bot.OkColor); var av = user.RealAvatarUrl(); diff --git a/src/NadekoBot/Modules/Utility/PatreonCommands.cs b/src/NadekoBot/Modules/Utility/PatreonCommands.cs index 7a9c08d54..368b82abe 100644 --- a/src/NadekoBot/Modules/Utility/PatreonCommands.cs +++ b/src/NadekoBot/Modules/Utility/PatreonCommands.cs @@ -42,7 +42,7 @@ namespace NadekoBot.Modules.Utility .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(efb => efb.WithText(GetText("clpa_next_update", rem)))) + .WithFooter(GetText("clpa_next_update", rem))) .ConfigureAwait(false); } } diff --git a/src/NadekoBot/Modules/Utility/Utility.cs b/src/NadekoBot/Modules/Utility/Utility.cs index 35552b49d..9214e723f 100644 --- a/src/NadekoBot/Modules/Utility/Utility.cs +++ b/src/NadekoBot/Modules/Utility/Utility.cs @@ -264,14 +264,14 @@ namespace NadekoBot.Modules.Utility .WithAuthor(eab => eab.WithName($"NadekoBot v{StatsService.BotVersion}") .WithUrl("http://nadekobot.readthedocs.io/en/latest/") .WithIconUrl("https://nadeko-pictures.nyc3.digitaloceanspaces.com/other/avatar.png")) - .AddField(efb => efb.WithName(GetText("author")).WithValue(_stats.Author).WithIsInline(true)) - .AddField(efb => efb.WithName(GetText("botid")).WithValue(_client.CurrentUser.Id.ToString()).WithIsInline(true)) - .AddField(efb => efb.WithName(GetText("shard")).WithValue($"#{_client.ShardId} / {_creds.TotalShards}").WithIsInline(true)) - .AddField(efb => efb.WithName(GetText("commands_ran")).WithValue(_stats.CommandsRan.ToString()).WithIsInline(true)) - .AddField(efb => efb.WithName(GetText("messages")).WithValue($"{_stats.MessageCounter} ({_stats.MessagesPerSecond:F2}/sec)").WithIsInline(true)) - .AddField(efb => efb.WithName(GetText("memory")).WithValue($"{_stats.Heap} MB").WithIsInline(true)) - .AddField(efb => efb.WithName(GetText("owner_ids")).WithValue(ownerIds).WithIsInline(true)) - .AddField(efb => efb.WithName(GetText("uptime")).WithValue(_stats.GetUptimeString("\n")).WithIsInline(true)) + .AddField(GetText("author"), _stats.Author, true) + .AddField(GetText("botid"), _client.CurrentUser.Id.ToString(), true) + .AddField(GetText("shard"), $"#{_client.ShardId} / {_creds.TotalShards}", true) + .AddField(GetText("commands_ran"), _stats.CommandsRan.ToString(), true) + .AddField(GetText("messages"), $"{_stats.MessageCounter} ({_stats.MessagesPerSecond:F2}/sec)", true) + .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( GetText("presence_txt", _coord.GetGuildCount(), _stats.TextChannels, _stats.VoiceChannels)).WithIsInline(true))).ConfigureAwait(false); diff --git a/src/NadekoBot/Services/IEmbedBuilderProvider.cs b/src/NadekoBot/Services/IEmbedBuilderProvider.cs new file mode 100644 index 000000000..668f79a9c --- /dev/null +++ b/src/NadekoBot/Services/IEmbedBuilderProvider.cs @@ -0,0 +1,46 @@ +ο»Ώusing System; +using Discord; + +namespace NadekoBot.Services +{ + public interface IEmbedBuilderProvider + { + public IEmbedBuilder Create(); + } + + public interface IEmbedBuilder + { + public IEmbedBuilder WithDescription(string desc); + public IEmbedBuilder WithTitle(string title); + public IEmbedBuilder AddField(string title, object value, bool isInline = false); + public IEmbedBuilder WithFooter(string text, string iconUrl = null); + } + + public class DiscordEmbedBuilderWrapper : IEmbedBuilder + { + private EmbedBuilder _embed; + + public DiscordEmbedBuilderWrapper() + { + _embed = new EmbedBuilder(); + } + + public IEmbedBuilder WithDescription(string desc) + => Wrap(_embed.WithDescription(desc)); + + public IEmbedBuilder WithTitle(string title) + => Wrap(_embed.WithTitle(title)); + + public IEmbedBuilder AddField(string title, object value, bool isInline = false) + => Wrap(_embed.AddField(title, value, isInline)); + + public IEmbedBuilder WithFooter(string text, string iconUrl = null) + => Wrap(_embed.WithFooter(text, iconUrl)); + + private IEmbedBuilder Wrap(EmbedBuilder eb) + { + _embed = eb; + return this; + } + } +} \ No newline at end of file diff --git a/src/NadekoBot/_Extensions/Extensions.cs b/src/NadekoBot/_Extensions/Extensions.cs index df111f933..85429cc59 100644 --- a/src/NadekoBot/_Extensions/Extensions.cs +++ b/src/NadekoBot/_Extensions/Extensions.cs @@ -170,9 +170,9 @@ namespace NadekoBot.Extensions public static EmbedBuilder AddPaginatedFooter(this EmbedBuilder embed, int curPage, int? lastPage) { if (lastPage != null) - return embed.WithFooter(efb => efb.WithText($"{curPage + 1} / {lastPage + 1}")); + return embed.WithFooter($"{curPage + 1} / {lastPage + 1}"); else - return embed.WithFooter(efb => efb.WithText(curPage.ToString())); + return embed.WithFooter(curPage.ToString()); } public static EmbedBuilder WithOkColor(this EmbedBuilder eb) => diff --git a/src/NadekoBot/_Extensions/IMessageChannelExtensions.cs b/src/NadekoBot/_Extensions/IMessageChannelExtensions.cs index 85766757f..1ee01182f 100644 --- a/src/NadekoBot/_Extensions/IMessageChannelExtensions.cs +++ b/src/NadekoBot/_Extensions/IMessageChannelExtensions.cs @@ -21,7 +21,7 @@ namespace NadekoBot.Extensions if (url != null && Uri.IsWellFormedUriString(url, UriKind.Absolute)) eb.WithUrl(url); if (!string.IsNullOrWhiteSpace(footer)) - eb.WithFooter(efb => efb.WithText(footer)); + eb.WithFooter(footer); return ch.SendMessageAsync("", embed: eb.Build()); } @@ -38,7 +38,7 @@ namespace NadekoBot.Extensions if (url != null && Uri.IsWellFormedUriString(url, UriKind.Absolute)) eb.WithUrl(url); if (!string.IsNullOrWhiteSpace(footer)) - eb.WithFooter(efb => efb.WithText(footer)); + eb.WithFooter(footer); return ch.SendMessageAsync("", embed: eb.Build()); }