all calls to .WithAuthor and .WithFooter no longer use their respective builders

This commit is contained in:
Kwoth
2021-07-08 02:54:55 +02:00
parent cbecd823c1
commit a17d0afc7d
12 changed files with 71 additions and 75 deletions

View File

@@ -441,7 +441,7 @@ namespace NadekoBot.Modules.Administration.Services
break;
}
var embed = new EmbedBuilder().WithAuthor(eab => eab.WithName(mutes))
var embed = new EmbedBuilder().WithAuthor(mutes)
.WithTitle($"{usr.Username}#{usr.Discriminator} | {usr.Id}")
.WithFooter(CurrentTime(usr.Guild))
.WithOkColor();
@@ -486,7 +486,7 @@ namespace NadekoBot.Modules.Administration.Services
break;
}
var embed = new EmbedBuilder().WithAuthor(eab => eab.WithName(mutes))
var embed = new EmbedBuilder().WithAuthor(mutes)
.WithTitle($"{usr.Username}#{usr.Discriminator} | {usr.Id}")
.WithFooter($"{CurrentTime(usr.Guild)}")
.WithOkColor();
@@ -541,7 +541,7 @@ namespace NadekoBot.Modules.Administration.Services
break;
}
var embed = new EmbedBuilder().WithAuthor(eab => eab.WithName($"🛡 Anti-{protection}"))
var embed = new EmbedBuilder().WithAuthor($"🛡 Anti-{protection}")
.WithTitle(GetText(logChannel.Guild, "users") + " " + punishment)
.WithDescription(string.Join("\n", users.Select(u => u.ToString())))
.WithFooter(CurrentTime(logChannel.Guild))
@@ -594,7 +594,7 @@ namespace NadekoBot.Modules.Administration.Services
.WithTitle($"{before.Username}#{before.Discriminator} | {before.Id}");
if (before.Nickname != after.Nickname)
{
embed.WithAuthor(eab => eab.WithName("👥 " + GetText(logChannel.Guild, "nick_change")))
embed.WithAuthor("👥 " + GetText(logChannel.Guild, "nick_change"))
.AddField(efb =>
efb.WithName(GetText(logChannel.Guild, "old_nick"))
.WithValue($"{before.Nickname}#{before.Discriminator}"))
@@ -609,7 +609,7 @@ namespace NadekoBot.Modules.Administration.Services
if (before.Roles.Count < after.Roles.Count)
{
var diffRoles = after.Roles.Where(r => !before.Roles.Contains(r)).Select(r => r.Name);
embed.WithAuthor(eab => eab.WithName("⚔ " + GetText(logChannel.Guild, "user_role_add")))
embed.WithAuthor("⚔ " + GetText(logChannel.Guild, "user_role_add"))
.WithDescription(string.Join(", ", diffRoles).SanitizeMentions());
await logChannel.EmbedAsync(embed).ConfigureAwait(false);
@@ -624,8 +624,7 @@ namespace NadekoBot.Modules.Administration.Services
if (diffRoles.Any())
{
embed.WithAuthor(eab =>
eab.WithName("⚔ " + GetText(logChannel.Guild, "user_role_rem")))
embed.WithAuthor("⚔ " + GetText(logChannel.Guild, "user_role_rem"))
.WithDescription(string.Join(", ", diffRoles).SanitizeMentions());
await logChannel.EmbedAsync(embed).ConfigureAwait(false);

View File

@@ -96,7 +96,7 @@ namespace NadekoBot.Modules.Games.Common
var embed = new EmbedBuilder()
.WithOkColor()
.WithDescription(Environment.NewLine + GetState())
.WithAuthor(eab => eab.WithName(GetText("vs", _users[0], _users[1])));
.WithAuthor(GetText("vs", _users[0], _users[1]));
if (!string.IsNullOrWhiteSpace(title))
embed.WithTitle(title);

View File

@@ -174,7 +174,7 @@ namespace NadekoBot.Modules.Games.Common.Trivia
ShouldStopGame = true;
await Channel.EmbedAsync(new EmbedBuilder().WithOkColor()
.WithAuthor(eab => eab.WithName("Trivia Game Ended"))
.WithAuthor("Trivia Game Ended")
.WithTitle("Final Results")
.WithDescription(GetLeaderboard())).ConfigureAwait(false);
}

View File

@@ -9,7 +9,6 @@ using NadekoBot.Common;
using NadekoBot.Common.Attributes;
using NadekoBot.Services.Database.Models;
using NadekoBot.Extensions;
using NadekoBot.Modules;
using NadekoBot.Modules.Administration.Services;
using NadekoBot.Modules.Music.Services;
@@ -18,6 +17,7 @@ namespace NadekoBot.Modules.Music
[NoPublicBot]
public sealed partial class Music : NadekoModule<IMusicService>
{
public const string MusicIconUrl = "http://i.imgur.com/nhKS3PT.png";
private readonly ILogCommandService _logService;
public Music(ILogCommandService _logService)
@@ -114,9 +114,9 @@ namespace NadekoBot.Modules.Music
{
var embed = new EmbedBuilder()
.WithOkColor()
.WithAuthor(eab => eab.WithName(GetText("queued_song") + " #" + (index + 1)).WithMusicIcon())
.WithAuthor(GetText("queued_song") + " #" + (index + 1), MusicIconUrl)
.WithDescription($"{trackInfo.PrettyName()}\n{GetText("queue")} ")
.WithFooter(ef => ef.WithText(trackInfo.Platform.ToString()));
.WithFooter(trackInfo.Platform.ToString());
if (!string.IsNullOrWhiteSpace(trackInfo.Thumbnail))
embed.WithThumbnailUrl(trackInfo.Thumbnail);
@@ -329,9 +329,8 @@ namespace NadekoBot.Modules.Music
desc = add + "\n" + desc;
var embed = new EmbedBuilder()
.WithAuthor(eab => eab
.WithName(GetText("player_queue", curPage + 1, (tracks.Count / LQ_ITEMS_PER_PAGE) + 1))
.WithMusicIcon())
.WithAuthor(GetText("player_queue", curPage + 1, (tracks.Count / LQ_ITEMS_PER_PAGE) + 1),
MusicIconUrl)
.WithDescription(desc)
.WithFooter($" {mp.PrettyVolume()} | 🎶 {tracks.Count} | ⌛ {mp.PrettyTotalTime()} ")
.WithOkColor();
@@ -432,9 +431,9 @@ namespace NadekoBot.Modules.Music
}
var embed = new EmbedBuilder()
.WithAuthor(eab => eab.WithName(GetText("removed_song") + " #" + (index)).WithMusicIcon())
.WithAuthor(GetText("removed_song") + " #" + (index), MusicIconUrl)
.WithDescription(song.PrettyName())
.WithFooter(ef => ef.WithText(song.PrettyInfo()))
.WithFooter(song.PrettyInfo())
.WithErrorColor();
await _service.SendToOutputAsync(Context.Guild.Id, embed);
@@ -616,7 +615,7 @@ 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"))
.WithAuthor(GetText("song_moved"), MusicIconUrl)
.AddField(GetText("from_position"), $"#{from + 1}", true)
.AddField(GetText("to_position"), $"#{to + 1}", true)
.WithColor(Bot.OkColor);
@@ -703,7 +702,7 @@ namespace NadekoBot.Modules.Music
return;
var embed = new EmbedBuilder().WithOkColor()
.WithAuthor(eab => eab.WithName(GetText("now_playing")).WithMusicIcon())
.WithAuthor(GetText("now_playing"), MusicIconUrl)
.WithDescription(currentTrack.PrettyName())
.WithThumbnailUrl(currentTrack.Thumbnail)
.WithFooter($"{mp.PrettyVolume()} | {mp.PrettyTotalTime()} | {currentTrack.Platform} | {currentTrack.Queuer}");

View File

@@ -62,7 +62,7 @@ namespace NadekoBot.Modules.Music
}
var embed = new EmbedBuilder()
.WithAuthor(eab => eab.WithName(GetText("playlists_page", num)).WithMusicIcon())
.WithAuthor(GetText("playlists_page", num), MusicIconUrl)
.WithDescription(string.Join("\n", playlists.Select(r =>
GetText("playlists", r.Id, r.Name, r.Author, r.Songs.Count))))
.WithOkColor();

View File

@@ -205,7 +205,7 @@ namespace NadekoBot.Modules.Music.Services
_ = lastFinishedMessage?.DeleteAsync();
var embed = new EmbedBuilder()
.WithOkColor()
.WithAuthor(eab => eab.WithName(GetText(guildId, "finished_song")).WithMusicIcon())
.WithAuthor(GetText(guildId, "finished_song"), Music.MusicIconUrl)
.WithDescription(trackInfo.PrettyName())
.WithFooter(trackInfo.PrettyTotalTime());
@@ -220,9 +220,9 @@ namespace NadekoBot.Modules.Music.Services
{
_ = lastPlayingMessage?.DeleteAsync();
var embed = new EmbedBuilder().WithOkColor()
.WithAuthor(eab => eab.WithName(GetText(guildId, "playing_song", index + 1)).WithMusicIcon())
.WithAuthor(GetText(guildId, "playing_song", index + 1), Music.MusicIconUrl)
.WithDescription(trackInfo.PrettyName())
.WithFooter(ef => ef.WithText($"{mp.PrettyVolume()} | {trackInfo.PrettyInfo()}"));
.WithFooter($"{mp.PrettyVolume()} | {trackInfo.PrettyInfo()}");
lastPlayingMessage = await SendToOutputAsync(guildId, embed);
};

View File

@@ -28,12 +28,10 @@ namespace NadekoBot.Modules.Searches
private const string _pogiURL = "https://pathofexile.gamepedia.com/api.php?action=query&prop=imageinfo&iiprop=url&format=json&titles=File:";
private const string _profileURL = "https://www.pathofexile.com/account/view-profile/";
private readonly DiscordSocketClient _client;
private readonly IHttpClientFactory _httpFactory;
public PathOfExileCommands(DiscordSocketClient client, IHttpClientFactory httpFactory)
public PathOfExileCommands(IHttpClientFactory httpFactory)
{
_client = client;
_httpFactory = httpFactory;
}
@@ -77,10 +75,10 @@ namespace NadekoBot.Modules.Searches
await ctx.SendPaginatedConfirmAsync(page, (curPage) =>
{
var embed = new EmbedBuilder()
.WithAuthor(eau => eau.WithName($"Characters on {usr}'s account")
.WithUrl($"{_profileURL}{usr}")
.WithIconUrl("https://web.poecdn.com/image/favicon/ogimage.png"))
.WithOkColor();
.WithAuthor($"Characters on {usr}'s account",
"https://web.poecdn.com/image/favicon/ogimage.png",
$"{_profileURL}{usr}")
.WithOkColor();
var tempList = characters.Skip(curPage * 9).Take(9).ToList();
@@ -131,9 +129,9 @@ namespace NadekoBot.Modules.Searches
}
var embed = new EmbedBuilder()
.WithAuthor(eau => eau.WithName($"Path of Exile Leagues")
.WithUrl("https://www.pathofexile.com")
.WithIconUrl("https://web.poecdn.com/image/favicon/ogimage.png"))
.WithAuthor($"Path of Exile Leagues",
"https://web.poecdn.com/image/favicon/ogimage.png",
"https://www.pathofexile.com")
.WithOkColor();
var sb = new System.Text.StringBuilder();
@@ -203,9 +201,10 @@ namespace NadekoBot.Modules.Searches
conversionEquivalent = float.Parse(currencyOutput["chaosEquivalent"].ToString(), System.Globalization.CultureInfo.InvariantCulture);
}
var embed = new EmbedBuilder().WithAuthor(eau => eau.WithName($"{leagueName} Currency Exchange")
.WithUrl("http://poe.ninja")
.WithIconUrl("https://web.poecdn.com/image/favicon/ogimage.png"))
var embed = new EmbedBuilder()
.WithAuthor($"{leagueName} Currency Exchange",
"https://web.poecdn.com/image/favicon/ogimage.png",
"http://poe.ninja")
.AddField("Currency Type", cleanCurrency, true)
.AddField($"{cleanConvert} Equivalent", chaosEquivalent / conversionEquivalent, true)
.WithOkColor();

View File

@@ -33,7 +33,6 @@ namespace NadekoBot.Modules.Searches
private readonly IGoogleApiService _google;
private readonly IHttpClientFactory _httpFactory;
private readonly IMemoryCache _cache;
private static readonly NadekoRandom _rng = new NadekoRandom();
private readonly GuildTimezoneService _tzSvc;
public Searches(IBotCredentials creds, IGoogleApiService google, IHttpClientFactory factory, IMemoryCache cache,
@@ -46,7 +45,6 @@ namespace NadekoBot.Modules.Searches
_tzSvc = tzSvc;
}
//for anonymasen :^)
[NadekoCommand, Aliases]
public async Task Rip([Leftover] IGuildUser usr)
{
@@ -224,9 +222,9 @@ namespace NadekoBot.Modules.Searches
var res = await _google.GetImageAsync(oterms).ConfigureAwait(false);
var embed = new EmbedBuilder()
.WithOkColor()
.WithAuthor(eab => eab.WithName(GetText("image_search_for") + " " + oterms.TrimTo(50))
.WithUrl("https://www.google.rs/search?q=" + query + "&source=lnms&tbm=isch")
.WithIconUrl("http://i.imgur.com/G46fm8J.png"))
.WithAuthor(GetText("image_search_for") + " " + oterms.TrimTo(50),
"http://i.imgur.com/G46fm8J.png",
$"https://www.google.rs/search?q={query}&source=lnms&tbm=isch")
.WithDescription(res.Link)
.WithImageUrl(res.Link)
.WithTitle(ctx.User.ToString());
@@ -254,9 +252,9 @@ namespace NadekoBot.Modules.Searches
var embed = new EmbedBuilder()
.WithOkColor()
.WithAuthor(eab => eab.WithName(GetText("image_search_for") + " " + oterms.TrimTo(50))
.WithUrl(fullQueryLink)
.WithIconUrl("http://s.imgur.com/images/logo-1200-630.jpg?"))
.WithAuthor(GetText("image_search_for") + " " + oterms.TrimTo(50),
"http://s.imgur.com/images/logo-1200-630.jpg?",
fullQueryLink)
.WithDescription(source)
.WithImageUrl(source)
.WithTitle(ctx.User.ToString());
@@ -474,7 +472,7 @@ namespace NadekoBot.Modules.Searches
var item = items[p];
return new EmbedBuilder().WithOkColor()
.WithUrl(item.Permalink)
.WithAuthor(eab => eab.WithIconUrl("http://i.imgur.com/nwERwQE.jpg").WithName(item.Word))
.WithAuthor(item.Word)
.WithDescription(item.Definition);
}, items.Length, 1).ConfigureAwait(false);
return;

View File

@@ -36,7 +36,7 @@ namespace NadekoBot.Modules.Searches
var comic = JsonConvert.DeserializeObject<XkcdComic>(res);
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"))
.WithAuthor(comic.Title,"https://xkcd.com/s/919f27.ico", $"{_xkcdUrl}/{comic.Num}")
.AddField(GetText("comic_number"), comic.Num.ToString(), true)
.AddField(GetText("date"), $"{comic.Month}/{comic.Year}", true);
var sent = await ctx.Channel.EmbedAsync(embed)
@@ -69,11 +69,13 @@ namespace NadekoBot.Modules.Searches
var res = await http.GetStringAsync($"{_xkcdUrl}/{num}/info.0.json").ConfigureAwait(false);
var comic = JsonConvert.DeserializeObject<XkcdComic>(res);
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(GetText("comic_number"), comic.Num.ToString(), true)
.AddField(GetText("date"), $"{comic.Month}/{comic.Year}", true);
var embed = new EmbedBuilder()
.WithColor(Bot.OkColor)
.WithImageUrl(comic.ImageLink)
.WithAuthor(comic.Title, "https://xkcd.com/s/919f27.ico", $"{_xkcdUrl}/{num}")
.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);

View File

@@ -47,7 +47,7 @@ namespace NadekoBot.Modules.Utility
if (string.IsNullOrWhiteSpace(features))
features = "-";
var embed = new EmbedBuilder()
.WithAuthor(eab => eab.WithName(GetText("server_info")))
.WithAuthor(GetText("server_info"))
.WithTitle(guild.Name)
.AddField(GetText("id"), guild.Id.ToString(), true)
.AddField(GetText("owner"), ownername.ToString(), true)
@@ -145,8 +145,7 @@ namespace NadekoBot.Modules.Utility
await ctx.Channel.EmbedAsync(new EmbedBuilder()
.WithTitle(GetText("activity_page", page + 1))
.WithOkColor()
.WithFooter(efb => efb.WithText(GetText("activity_users_total",
CmdHandler.UserMessagesSent.Count)))
.WithFooter(GetText("activity_users_total", CmdHandler.UserMessagesSent.Count))
.WithDescription(str.ToString())).ConfigureAwait(false);
}
}

View File

@@ -260,21 +260,23 @@ namespace NadekoBot.Modules.Utility
ownerIds = "-";
await ctx.Channel.EmbedAsync(
new EmbedBuilder().WithOkColor()
.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(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);
new EmbedBuilder().WithOkColor()
.WithAuthor($"NadekoBot v{StatsService.BotVersion}",
"https://nadeko-pictures.nyc3.digitaloceanspaces.com/other/avatar.png",
"https://nadekobot.readthedocs.io/en/latest/")
.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);
}
[NadekoCommand, Aliases]