Small wording tweaks to the !anime and !manga commands. They also no long need their description html decoded.

This commit is contained in:
runebaas 2020-09-24 18:29:21 +02:00
parent ed7748833a
commit 41795aa13f
No known key found for this signature in database
GPG key ID: 2677AF508D0300D6

View file

@ -2,7 +2,6 @@
using System.Linq; using System.Linq;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Web;
using Discord; using Discord;
using Discord.Commands; using Discord.Commands;
using Geekbot.Core; using Geekbot.Core;
@ -32,22 +31,19 @@ namespace Geekbot.Bot.Commands.Integrations
var anime = results.Results.FirstOrDefault(); var anime = results.Results.FirstOrDefault();
if (anime != null) if (anime != null)
{ {
var eb = new EmbedBuilder(); var eb = new EmbedBuilder
{
var description = HttpUtility.HtmlDecode(anime.Description) Title = anime.Title,
.Replace("<br />", "") Description = anime.Description,
.Replace("[i]", "*") ImageUrl = anime.ImageURL
.Replace("[/i]", "*"); };
eb.Title = anime.Title; eb.AddInlineField("Premiere", FormatDate(anime.StartDate))
eb.Description = description; .AddInlineField("Ended", anime.Airing ? "-" : FormatDate(anime.EndDate))
eb.ImageUrl = anime.ImageURL; .AddInlineField("Episodes", anime.Episodes)
eb.AddInlineField("Premiered", FormatDate(anime.StartDate)); .AddInlineField("MAL Score", anime.Score)
eb.AddInlineField("Ended", anime.Airing ? "Present" : FormatDate(anime.EndDate)); .AddInlineField("Type", anime.Type)
eb.AddInlineField("Episodes", anime.Episodes); .AddField("MAL Link", $"https://myanimelist.net/anime/{anime.MalId}");
eb.AddInlineField("MAL Score", anime.Score);
eb.AddInlineField("Type", anime.Type);
eb.AddField("MAL Link", $"https://myanimelist.net/anime/{anime.MalId}");
await ReplyAsync("", false, eb.Build()); await ReplyAsync("", false, eb.Build());
} }
@ -72,23 +68,20 @@ namespace Geekbot.Bot.Commands.Integrations
var manga = results.Results.FirstOrDefault(); var manga = results.Results.FirstOrDefault();
if (manga != null) if (manga != null)
{ {
var eb = new EmbedBuilder(); var eb = new EmbedBuilder
{
var description = HttpUtility.HtmlDecode(manga.Description) Title = manga.Title,
.Replace("<br />", "") Description = manga.Description,
.Replace("[i]", "*") ImageUrl = manga.ImageURL
.Replace("[/i]", "*"); };
eb.Title = manga.Title; eb.AddInlineField("Premiere", FormatDate(manga.StartDate))
eb.Description = description; .AddInlineField("Ended", manga.Publishing ? "-" : FormatDate(manga.EndDate))
eb.ImageUrl = manga.ImageURL; .AddInlineField("Volumes", manga.Volumes)
eb.AddInlineField("Premiered", FormatDate(manga.StartDate)); .AddInlineField("Chapters", manga.Chapters)
eb.AddInlineField("Ended", manga.Publishing ? "Present" : FormatDate(manga.EndDate)); .AddInlineField("MAL Score", manga.Score)
eb.AddInlineField("Volumes", manga.Volumes); .AddField("MAL Link", $"https://myanimelist.net/manga/{manga.MalId}");
eb.AddInlineField("Chapters", manga.Chapters);
eb.AddInlineField("MAL Score", manga.Score);
eb.AddField("MAL Link", $"https://myanimelist.net/manga/{manga.MalId}");
await ReplyAsync("", false, eb.Build()); await ReplyAsync("", false, eb.Build());
} }
else else
@ -108,7 +101,7 @@ namespace Geekbot.Bot.Commands.Integrations
{ {
return DateTime.MinValue.ToString("d", Thread.CurrentThread.CurrentUICulture); return DateTime.MinValue.ToString("d", Thread.CurrentThread.CurrentUICulture);
} }
return dateTime.Value.ToString("d", Thread.CurrentThread.CurrentUICulture); return dateTime.Value.ToString("d", Thread.CurrentThread.CurrentUICulture);
} }
} }