Autohentai no longer posts errors
This commit is contained in:
parent
2d2a7f765f
commit
cc6798496c
@ -19,15 +19,10 @@ namespace NadekoBot.Modules.NSFW
|
|||||||
[NadekoModule("NSFW", "~")]
|
[NadekoModule("NSFW", "~")]
|
||||||
public class NSFW : DiscordModule
|
public class NSFW : DiscordModule
|
||||||
{
|
{
|
||||||
//ulong/cancel
|
|
||||||
private static ConcurrentDictionary<ulong, Timer> AutoHentaiTimers { get; } = new ConcurrentDictionary<ulong, Timer>();
|
private static ConcurrentDictionary<ulong, Timer> AutoHentaiTimers { get; } = new ConcurrentDictionary<ulong, Timer>();
|
||||||
|
|
||||||
[NadekoCommand, Usage, Description, Aliases]
|
private async Task InternalHentai(IMessageChannel channel, string tag, bool noError)
|
||||||
[RequireContext(ContextType.Guild)]
|
|
||||||
public async Task Hentai([Remainder] string tag = null)
|
|
||||||
{
|
{
|
||||||
var channel = (ITextChannel)Context.Channel;
|
|
||||||
|
|
||||||
tag = tag?.Trim() ?? "";
|
tag = tag?.Trim() ?? "";
|
||||||
|
|
||||||
tag = "rating%3Aexplicit+" + tag;
|
tag = "rating%3Aexplicit+" + tag;
|
||||||
@ -54,12 +49,17 @@ namespace NadekoBot.Modules.NSFW
|
|||||||
var link = await provider.ConfigureAwait(false);
|
var link = await provider.ConfigureAwait(false);
|
||||||
if (string.IsNullOrWhiteSpace(link))
|
if (string.IsNullOrWhiteSpace(link))
|
||||||
await channel.SendErrorAsync("No results found.").ConfigureAwait(false);
|
await channel.SendErrorAsync("No results found.").ConfigureAwait(false);
|
||||||
else
|
else if (!noError)
|
||||||
await channel.EmbedAsync(new EmbedBuilder().WithOkColor()
|
await channel.EmbedAsync(new EmbedBuilder().WithOkColor()
|
||||||
.WithImageUrl(link)
|
.WithImageUrl(link)
|
||||||
.WithDescription("Tag: " + tag)).ConfigureAwait(false);
|
.WithDescription("Tag: " + tag)).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[NadekoCommand, Usage, Description, Aliases]
|
||||||
|
[RequireContext(ContextType.Guild)]
|
||||||
|
public Task Hentai([Remainder] string tag = null) =>
|
||||||
|
InternalHentai(Context.Channel, tag, false);
|
||||||
|
|
||||||
[NadekoCommand, Usage, Description, Aliases]
|
[NadekoCommand, Usage, Description, Aliases]
|
||||||
[RequireContext(ContextType.Guild)]
|
[RequireContext(ContextType.Guild)]
|
||||||
public async Task AutoHentai(int interval = 0, string tags = null)
|
public async Task AutoHentai(int interval = 0, string tags = null)
|
||||||
@ -86,9 +86,9 @@ namespace NadekoBot.Modules.NSFW
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (tagsArr == null || tagsArr.Length == 0)
|
if (tagsArr == null || tagsArr.Length == 0)
|
||||||
await Hentai(null).ConfigureAwait(false);
|
await InternalHentai(Context.Channel, null, true).ConfigureAwait(false);
|
||||||
else
|
else
|
||||||
await Hentai(tagsArr[new NadekoRandom().Next(0, tagsArr.Length)]);
|
await InternalHentai(Context.Channel, tagsArr[new NadekoRandom().Next(0, tagsArr.Length)], true);
|
||||||
}
|
}
|
||||||
catch { }
|
catch { }
|
||||||
}, null, interval * 1000, interval * 1000);
|
}, null, interval * 1000, interval * 1000);
|
||||||
|
Loading…
Reference in New Issue
Block a user