From 41795aa13f0a806caf8cb7acb6e29d7653fb1d51 Mon Sep 17 00:00:00 2001 From: runebaas Date: Thu, 24 Sep 2020 18:29:21 +0200 Subject: [PATCH] Small wording tweaks to the !anime and !manga commands. They also no long need their description html decoded. --- src/Bot/Commands/Integrations/Mal.cs | 63 +++++++++++++--------------- 1 file changed, 28 insertions(+), 35 deletions(-) diff --git a/src/Bot/Commands/Integrations/Mal.cs b/src/Bot/Commands/Integrations/Mal.cs index f44d04e..ffc8dd7 100644 --- a/src/Bot/Commands/Integrations/Mal.cs +++ b/src/Bot/Commands/Integrations/Mal.cs @@ -2,7 +2,6 @@ using System.Linq; using System.Threading; using System.Threading.Tasks; -using System.Web; using Discord; using Discord.Commands; using Geekbot.Core; @@ -32,22 +31,19 @@ namespace Geekbot.Bot.Commands.Integrations var anime = results.Results.FirstOrDefault(); if (anime != null) { - var eb = new EmbedBuilder(); - - var description = HttpUtility.HtmlDecode(anime.Description) - .Replace("
", "") - .Replace("[i]", "*") - .Replace("[/i]", "*"); - - eb.Title = anime.Title; - eb.Description = description; - eb.ImageUrl = anime.ImageURL; - eb.AddInlineField("Premiered", FormatDate(anime.StartDate)); - eb.AddInlineField("Ended", anime.Airing ? "Present" : FormatDate(anime.EndDate)); - eb.AddInlineField("Episodes", anime.Episodes); - eb.AddInlineField("MAL Score", anime.Score); - eb.AddInlineField("Type", anime.Type); - eb.AddField("MAL Link", $"https://myanimelist.net/anime/{anime.MalId}"); + var eb = new EmbedBuilder + { + Title = anime.Title, + Description = anime.Description, + ImageUrl = anime.ImageURL + }; + + eb.AddInlineField("Premiere", FormatDate(anime.StartDate)) + .AddInlineField("Ended", anime.Airing ? "-" : FormatDate(anime.EndDate)) + .AddInlineField("Episodes", anime.Episodes) + .AddInlineField("MAL Score", anime.Score) + .AddInlineField("Type", anime.Type) + .AddField("MAL Link", $"https://myanimelist.net/anime/{anime.MalId}"); await ReplyAsync("", false, eb.Build()); } @@ -72,23 +68,20 @@ namespace Geekbot.Bot.Commands.Integrations var manga = results.Results.FirstOrDefault(); if (manga != null) { - var eb = new EmbedBuilder(); - - var description = HttpUtility.HtmlDecode(manga.Description) - .Replace("
", "") - .Replace("[i]", "*") - .Replace("[/i]", "*"); - - eb.Title = manga.Title; - eb.Description = description; - eb.ImageUrl = manga.ImageURL; - eb.AddInlineField("Premiered", FormatDate(manga.StartDate)); - eb.AddInlineField("Ended", manga.Publishing ? "Present" : FormatDate(manga.EndDate)); - eb.AddInlineField("Volumes", manga.Volumes); - eb.AddInlineField("Chapters", manga.Chapters); - eb.AddInlineField("MAL Score", manga.Score); - eb.AddField("MAL Link", $"https://myanimelist.net/manga/{manga.MalId}"); - + var eb = new EmbedBuilder + { + Title = manga.Title, + Description = manga.Description, + ImageUrl = manga.ImageURL + }; + + eb.AddInlineField("Premiere", FormatDate(manga.StartDate)) + .AddInlineField("Ended", manga.Publishing ? "-" : FormatDate(manga.EndDate)) + .AddInlineField("Volumes", manga.Volumes) + .AddInlineField("Chapters", manga.Chapters) + .AddInlineField("MAL Score", manga.Score) + .AddField("MAL Link", $"https://myanimelist.net/manga/{manga.MalId}"); + await ReplyAsync("", false, eb.Build()); } else @@ -108,7 +101,7 @@ namespace Geekbot.Bot.Commands.Integrations { return DateTime.MinValue.ToString("d", Thread.CurrentThread.CurrentUICulture); } - + return dateTime.Value.ToString("d", Thread.CurrentThread.CurrentUICulture); } }