From 37cdea4f6aa4ece4760dd3a8bfb502ade0e4511a Mon Sep 17 00:00:00 2001 From: Kwoth Date: Sun, 12 Sep 2021 13:31:57 +0200 Subject: [PATCH] Removed .novel command as it no longer works --- .../Modules/Searches/AnimeSearchCommands.cs | 54 +++++++++---------- .../Searches/Services/AnimeSearchService.cs | 5 +- src/NadekoBot/data/aliases.yml | 2 - .../data/strings/commands/commands.en-US.yml | 4 -- 4 files changed, 31 insertions(+), 34 deletions(-) diff --git a/src/NadekoBot/Modules/Searches/AnimeSearchCommands.cs b/src/NadekoBot/Modules/Searches/AnimeSearchCommands.cs index baf940f21..066cb881b 100644 --- a/src/NadekoBot/Modules/Searches/AnimeSearchCommands.cs +++ b/src/NadekoBot/Modules/Searches/AnimeSearchCommands.cs @@ -16,33 +16,33 @@ namespace NadekoBot.Modules.Searches [Group] public class AnimeSearchCommands : NadekoSubmodule { - [NadekoCommand, Aliases] - public async Task Novel([Leftover] string query) - { - if (string.IsNullOrWhiteSpace(query)) - return; - - var novelData = await _service.GetNovelData(query).ConfigureAwait(false); - - if (novelData is null) - { - await ReplyErrorLocalizedAsync(strs.failed_finding_novel).ConfigureAwait(false); - return; - } - - var embed = _eb.Create() - .WithOkColor() - .WithDescription(novelData.Description.Replace("
", Environment.NewLine, StringComparison.InvariantCulture)) - .WithTitle(novelData.Title) - .WithUrl(novelData.Link) - .WithImageUrl(novelData.ImageUrl) - .AddField(GetText(strs.authors), string.Join("\n", novelData.Authors), true) - .AddField(GetText(strs.status), novelData.Status, true) - .AddField(GetText(strs.genres), string.Join(" ", novelData.Genres.Any() ? novelData.Genres : new[] { "none" }), true) - .WithFooter($"{GetText(strs.score)} {novelData.Score}"); - - await ctx.Channel.EmbedAsync(embed).ConfigureAwait(false); - } + // [NadekoCommand, Aliases] + // public async Task Novel([Leftover] string query) + // { + // if (string.IsNullOrWhiteSpace(query)) + // return; + // + // var novelData = await _service.GetNovelData(query).ConfigureAwait(false); + // + // if (novelData is null) + // { + // await ReplyErrorLocalizedAsync(strs.failed_finding_novel).ConfigureAwait(false); + // return; + // } + // + // var embed = _eb.Create() + // .WithOkColor() + // .WithDescription(novelData.Description.Replace("
", Environment.NewLine, StringComparison.InvariantCulture)) + // .WithTitle(novelData.Title) + // .WithUrl(novelData.Link) + // .WithImageUrl(novelData.ImageUrl) + // .AddField(GetText(strs.authors), string.Join("\n", novelData.Authors), true) + // .AddField(GetText(strs.status), novelData.Status, true) + // .AddField(GetText(strs.genres), string.Join(" ", novelData.Genres.Any() ? novelData.Genres : new[] { "none" }), true) + // .WithFooter($"{GetText(strs.score)} {novelData.Score}"); + // + // await ctx.Channel.EmbedAsync(embed).ConfigureAwait(false); + // } [NadekoCommand, Aliases] [Priority(0)] diff --git a/src/NadekoBot/Modules/Searches/Services/AnimeSearchService.cs b/src/NadekoBot/Modules/Searches/Services/AnimeSearchService.cs index 973d4e3c6..d1c7035fb 100644 --- a/src/NadekoBot/Modules/Searches/Services/AnimeSearchService.cs +++ b/src/NadekoBot/Modules/Searches/Services/AnimeSearchService.cs @@ -59,7 +59,10 @@ namespace NadekoBot.Modules.Searches.Services query = query.Replace(" ", "-", StringComparison.InvariantCulture); try { - var link = "http://www.novelupdates.com/series/" + Uri.EscapeDataString(query.Replace("/", " ", StringComparison.InvariantCulture)); + var link = "https://www.novelupdates.com/series/" + Uri.EscapeDataString(query + .Replace(" ", "-") + .Replace("/", " ") + ); link = link.ToLowerInvariant(); var (ok, data) = await _cache.TryGetNovelDataAsync(link).ConfigureAwait(false); if (!ok) diff --git a/src/NadekoBot/data/aliases.yml b/src/NadekoBot/data/aliases.yml index a6fd7e2e8..57a16c5dc 100644 --- a/src/NadekoBot/data/aliases.yml +++ b/src/NadekoBot/data/aliases.yml @@ -1181,8 +1181,6 @@ timely: - timely timelyreset: - timelyreset -novel: -- novel crypto: - crypto - c diff --git a/src/NadekoBot/data/strings/commands/commands.en-US.yml b/src/NadekoBot/data/strings/commands/commands.en-US.yml index 0230378e8..8985c3e47 100644 --- a/src/NadekoBot/data/strings/commands/commands.en-US.yml +++ b/src/NadekoBot/data/strings/commands/commands.en-US.yml @@ -1973,10 +1973,6 @@ timelyreset: desc: "Resets all user timeouts on `{0}timely` command." args: - "" -novel: - desc: "Searches for a novel on `http://novelupdates.com/`. You have to provide an exact name." - args: - - "the nine cauldrons" crypto: desc: "Shows basic stats about a cryptocurrency from coinmarketcap.com. You can use either a name or an abbreviation of the currency." args: