diff --git a/src/NadekoBot/Modules/Gambling/Commands/DiceRollCommand.cs b/src/NadekoBot/Modules/Gambling/Commands/DiceRollCommand.cs index 4894d7c0..f1c3252a 100644 --- a/src/NadekoBot/Modules/Gambling/Commands/DiceRollCommand.cs +++ b/src/NadekoBot/Modules/Gambling/Commands/DiceRollCommand.cs @@ -89,17 +89,6 @@ namespace NadekoBot.Modules.Gambling await InternallDndRoll(umsg, arg, false).ConfigureAwait(false); } - [NadekoCommand, Usage, Description, Aliases] - [RequireContext(ContextType.Guild)] - public async Task FateRoll(IUserMessage msg, string arg) - { - var channel = (ITextChannel)msg.Channel; - - int n1; - Match match; - - } - private async Task InternalRoll(IUserMessage umsg, int num, bool ordered) { var channel = (ITextChannel)umsg.Channel; diff --git a/src/NadekoBot/Modules/Searches/Commands/AnimeSearchCommands.cs b/src/NadekoBot/Modules/Searches/Commands/AnimeSearchCommands.cs index a21ea1f5..b90be209 100644 --- a/src/NadekoBot/Modules/Searches/Commands/AnimeSearchCommands.cs +++ b/src/NadekoBot/Modules/Searches/Commands/AnimeSearchCommands.cs @@ -46,7 +46,8 @@ namespace NadekoBot.Modules.Searches anilistToken = JObject.Parse(stringContent)["access_token"].ToString(); } } - catch (Exception ex) { + catch (Exception ex) + { _log.Error(ex); } }, null, TimeSpan.FromSeconds(0), TimeSpan.FromMinutes(29)); @@ -69,34 +70,15 @@ namespace NadekoBot.Modules.Searches return; } - var embed = new Discord.API.Embed() - { - Description = animeData.Synopsis, - Title = animeData.title_english, - Url = animeData.Link, - Image = new Discord.API.EmbedImage() { - Url = animeData.image_url_lge - }, - Fields = new[] { - new Discord.API.EmbedField() { - Inline = true, - Name = "Episodes", - Value = animeData.total_episodes.ToString() - }, - new Discord.API.EmbedField() { - Inline = true, - Name = "Status", - Value = animeData.AiringStatus.ToString() - }, - new Discord.API.EmbedField() { - Inline = true, - Name = "Genres", - Value = String.Join(", ", animeData.Genres) - } - }, - Color = NadekoBot.OkColor - }; - await channel.EmbedAsync(embed).ConfigureAwait(false); + var embed = new EmbedBuilder().WithColor(NadekoBot.OkColor) + .WithDescription(animeData.Synopsis.Replace("
", Environment.NewLine)) + .WithTitle(animeData.title_english) + .WithUrl(animeData.Link) + .WithImageUrl(animeData.image_url_lge) + .AddField(efb => efb.WithName("Episodes").WithValue(animeData.total_episodes.ToString()).WithIsInline(true)) + .AddField(efb => efb.WithName("Status").WithValue(animeData.AiringStatus.ToString()).WithIsInline(true)) + .AddField(efb => efb.WithName("Genres").WithValue(String.Join(", ", animeData.Genres)).WithIsInline(true)); + await channel.EmbedAsync(embed.Build()).ConfigureAwait(false); } [NadekoCommand, Usage, Description, Aliases] @@ -116,36 +98,16 @@ namespace NadekoBot.Modules.Searches return; } - var embed = new Discord.API.Embed() - { - Description = mangaData.Synopsis, - Title = mangaData.title_english, - Url = mangaData.Link, - Image = new Discord.API.EmbedImage() - { - Url = mangaData.image_url_lge - }, - Fields = new[] { - new Discord.API.EmbedField() { - Inline = true, - Name = "Chapters", - Value = mangaData.total_chapters.ToString() - }, - new Discord.API.EmbedField() { - Inline = true, - Name = "Status", - Value = mangaData.publishing_status.ToString() - }, - new Discord.API.EmbedField() { - Inline = true, - Name = "Genres", - Value = String.Join(", ", mangaData.Genres) - } - }, - Color = NadekoBot.OkColor - }; + var embed = new EmbedBuilder().WithColor(NadekoBot.OkColor) + .WithDescription(mangaData.Synopsis) + .WithTitle(mangaData.title_english) + .WithUrl(mangaData.Link) + .WithImageUrl(mangaData.image_url_lge) + .AddField(efb => efb.WithName("Episodes").WithValue(mangaData.total_chapters.ToString()).WithIsInline(true)) + .AddField(efb => efb.WithName("Status").WithValue(mangaData.publishing_status.ToString()).WithIsInline(true)) + .AddField(efb => efb.WithName("Genres").WithValue(String.Join(", ", mangaData.Genres)).WithIsInline(true)); - await channel.EmbedAsync(embed).ConfigureAwait(false); + await channel.EmbedAsync(embed.Build()).ConfigureAwait(false); } private async Task GetAnimeData(string query) @@ -165,7 +127,8 @@ namespace NadekoBot.Modules.Searches return await Task.Run(() => { try { return JsonConvert.DeserializeObject(aniData); } catch { return null; } }).ConfigureAwait(false); } } - catch (Exception ex) { + catch (Exception ex) + { _log.Warn(ex, "Failed anime search for {0}", query); return null; } diff --git a/src/NadekoBot/_Extensions/Extensions.cs b/src/NadekoBot/_Extensions/Extensions.cs index 168fb87a..439f8c1a 100644 --- a/src/NadekoBot/_Extensions/Extensions.cs +++ b/src/NadekoBot/_Extensions/Extensions.cs @@ -25,6 +25,9 @@ namespace NadekoBot.Extensions http.DefaultRequestHeaders.Add("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); } + public static EmbedBuilder WithImageUrl(this EmbedBuilder eb, string url) => + eb.WithImage(eib => eib.WithUrl(url)); + public static EmbedBuilder WithOkColor(this EmbedBuilder eb) => eb.WithColor(NadekoBot.OkColor);