Removed .novel command as it no longer works

This commit is contained in:
Kwoth
2021-09-12 13:31:57 +02:00
parent d028e23bc1
commit 37cdea4f6a
4 changed files with 31 additions and 34 deletions

View File

@@ -16,33 +16,33 @@ namespace NadekoBot.Modules.Searches
[Group] [Group]
public class AnimeSearchCommands : NadekoSubmodule<AnimeSearchService> public class AnimeSearchCommands : NadekoSubmodule<AnimeSearchService>
{ {
[NadekoCommand, Aliases] // [NadekoCommand, Aliases]
public async Task Novel([Leftover] string query) // public async Task Novel([Leftover] string query)
{ // {
if (string.IsNullOrWhiteSpace(query)) // if (string.IsNullOrWhiteSpace(query))
return; // return;
//
var novelData = await _service.GetNovelData(query).ConfigureAwait(false); // var novelData = await _service.GetNovelData(query).ConfigureAwait(false);
//
if (novelData is null) // if (novelData is null)
{ // {
await ReplyErrorLocalizedAsync(strs.failed_finding_novel).ConfigureAwait(false); // await ReplyErrorLocalizedAsync(strs.failed_finding_novel).ConfigureAwait(false);
return; // return;
} // }
//
var embed = _eb.Create() // var embed = _eb.Create()
.WithOkColor() // .WithOkColor()
.WithDescription(novelData.Description.Replace("<br>", Environment.NewLine, StringComparison.InvariantCulture)) // .WithDescription(novelData.Description.Replace("<br>", Environment.NewLine, StringComparison.InvariantCulture))
.WithTitle(novelData.Title) // .WithTitle(novelData.Title)
.WithUrl(novelData.Link) // .WithUrl(novelData.Link)
.WithImageUrl(novelData.ImageUrl) // .WithImageUrl(novelData.ImageUrl)
.AddField(GetText(strs.authors), string.Join("\n", novelData.Authors), true) // .AddField(GetText(strs.authors), string.Join("\n", novelData.Authors), true)
.AddField(GetText(strs.status), novelData.Status, true) // .AddField(GetText(strs.status), novelData.Status, true)
.AddField(GetText(strs.genres), string.Join(" ", novelData.Genres.Any() ? novelData.Genres : new[] { "none" }), true) // .AddField(GetText(strs.genres), string.Join(" ", novelData.Genres.Any() ? novelData.Genres : new[] { "none" }), true)
.WithFooter($"{GetText(strs.score)} {novelData.Score}"); // .WithFooter($"{GetText(strs.score)} {novelData.Score}");
//
await ctx.Channel.EmbedAsync(embed).ConfigureAwait(false); // await ctx.Channel.EmbedAsync(embed).ConfigureAwait(false);
} // }
[NadekoCommand, Aliases] [NadekoCommand, Aliases]
[Priority(0)] [Priority(0)]

View File

@@ -59,7 +59,10 @@ namespace NadekoBot.Modules.Searches.Services
query = query.Replace(" ", "-", StringComparison.InvariantCulture); query = query.Replace(" ", "-", StringComparison.InvariantCulture);
try 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(); link = link.ToLowerInvariant();
var (ok, data) = await _cache.TryGetNovelDataAsync(link).ConfigureAwait(false); var (ok, data) = await _cache.TryGetNovelDataAsync(link).ConfigureAwait(false);
if (!ok) if (!ok)

View File

@@ -1181,8 +1181,6 @@ timely:
- timely - timely
timelyreset: timelyreset:
- timelyreset - timelyreset
novel:
- novel
crypto: crypto:
- crypto - crypto
- c - c

View File

@@ -1973,10 +1973,6 @@ timelyreset:
desc: "Resets all user timeouts on `{0}timely` command." desc: "Resets all user timeouts on `{0}timely` command."
args: args:
- "" - ""
novel:
desc: "Searches for a novel on `http://novelupdates.com/`. You have to provide an exact name."
args:
- "the nine cauldrons"
crypto: crypto:
desc: "Shows basic stats about a cryptocurrency from coinmarketcap.com. You can use either a name or an abbreviation of the currency." desc: "Shows basic stats about a cryptocurrency from coinmarketcap.com. You can use either a name or an abbreviation of the currency."
args: args: