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]
public class AnimeSearchCommands : NadekoSubmodule<AnimeSearchService>
{
[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("<br>", 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("<br>", 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)]

View File

@@ -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)

View File

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

View File

@@ -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: