~hentai changed, ~hentaibomb added (buffed ~hentai)
This commit is contained in:
parent
f3ce927969
commit
8dfa7ee1c1
@ -30,11 +30,51 @@ namespace NadekoBot.Modules.NSFW
|
||||
|
||||
tag = tag?.Trim() ?? "";
|
||||
|
||||
var links = await Task.WhenAll(GetGelbooruImageLink("rating%3Aexplicit+" + tag), GetDanbooruImageLink("rating%3Aexplicit+" + tag)).ConfigureAwait(false);
|
||||
tag = "rating%3Aexplicit+" + tag;
|
||||
|
||||
var rng = new NadekoRandom();
|
||||
Task<string> provider = Task.FromResult("");
|
||||
switch (rng.Next(0,4))
|
||||
{
|
||||
case 0:
|
||||
provider = GetDanbooruImageLink(tag);
|
||||
break;
|
||||
case 1:
|
||||
provider = GetGelbooruImageLink(tag);
|
||||
break;
|
||||
case 2:
|
||||
provider = GetATFbooruImageLink(tag);
|
||||
break;
|
||||
case 3:
|
||||
provider = GetKonachanImageLink(tag);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
var link = await provider.ConfigureAwait(false);
|
||||
if (string.IsNullOrWhiteSpace(link))
|
||||
await channel.SendMessageAsync("Search yielded no results ;(").ConfigureAwait(false);
|
||||
else
|
||||
await channel.SendMessageAsync(link).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
[NadekoCommand, Usage, Description, Aliases]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task HentaiBomb(IUserMessage umsg, [Remainder] string tag = null)
|
||||
{
|
||||
var channel = (ITextChannel)umsg.Channel;
|
||||
|
||||
tag = tag?.Trim() ?? "";
|
||||
tag = "rating%3Aexplicit+" + tag;
|
||||
|
||||
var links = await Task.WhenAll(GetGelbooruImageLink(tag),
|
||||
GetDanbooruImageLink(tag),
|
||||
GetKonachanImageLink(tag),
|
||||
GetATFbooruImageLink(tag)).ConfigureAwait(false);
|
||||
|
||||
if (links.All(l => l == null))
|
||||
{
|
||||
await channel.SendMessageAsync("`No results.`");
|
||||
await channel.SendMessageAsync("`No results.`").ConfigureAwait(false);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -50,7 +90,7 @@ namespace NadekoBot.Modules.NSFW
|
||||
tag = tag?.Trim() ?? "";
|
||||
var link = await GetATFbooruImageLink(tag).ConfigureAwait(false);
|
||||
if (string.IsNullOrWhiteSpace(link))
|
||||
await channel.SendMessageAsync("Search yielded no results ;(");
|
||||
await channel.SendMessageAsync("Search yielded no results ;(").ConfigureAwait(false);
|
||||
else
|
||||
await channel.SendMessageAsync(link).ConfigureAwait(false);
|
||||
}
|
||||
@ -64,7 +104,7 @@ namespace NadekoBot.Modules.NSFW
|
||||
tag = tag?.Trim() ?? "";
|
||||
var link = await GetDanbooruImageLink(tag).ConfigureAwait(false);
|
||||
if (string.IsNullOrWhiteSpace(link))
|
||||
await channel.SendMessageAsync("Search yielded no results ;(");
|
||||
await channel.SendMessageAsync("Search yielded no results ;(").ConfigureAwait(false);
|
||||
else
|
||||
await channel.SendMessageAsync(link).ConfigureAwait(false);
|
||||
}
|
||||
@ -78,7 +118,7 @@ namespace NadekoBot.Modules.NSFW
|
||||
tag = tag?.Trim() ?? "";
|
||||
var link = await GetKonachanImageLink(tag).ConfigureAwait(false);
|
||||
if (string.IsNullOrWhiteSpace(link))
|
||||
await channel.SendMessageAsync("Search yielded no results ;(");
|
||||
await channel.SendMessageAsync("Search yielded no results ;(").ConfigureAwait(false);
|
||||
else
|
||||
await channel.SendMessageAsync(link).ConfigureAwait(false);
|
||||
}
|
||||
@ -92,7 +132,7 @@ namespace NadekoBot.Modules.NSFW
|
||||
tag = tag?.Trim() ?? "";
|
||||
var link = await GetGelbooruImageLink(tag).ConfigureAwait(false);
|
||||
if (string.IsNullOrWhiteSpace(link))
|
||||
await channel.SendMessageAsync("Search yielded no results ;(");
|
||||
await channel.SendMessageAsync("Search yielded no results ;(").ConfigureAwait(false);
|
||||
else
|
||||
await channel.SendMessageAsync(link).ConfigureAwait(false);
|
||||
}
|
||||
@ -106,7 +146,7 @@ namespace NadekoBot.Modules.NSFW
|
||||
tag = tag?.Trim() ?? "";
|
||||
var link = await GetRule34ImageLink(tag).ConfigureAwait(false);
|
||||
if (string.IsNullOrWhiteSpace(link))
|
||||
await channel.SendMessageAsync("Search yielded no results ;(");
|
||||
await channel.SendMessageAsync("Search yielded no results ;(").ConfigureAwait(false);
|
||||
else
|
||||
await channel.SendMessageAsync(link).ConfigureAwait(false);
|
||||
}
|
||||
@ -120,7 +160,7 @@ namespace NadekoBot.Modules.NSFW
|
||||
tag = tag?.Trim() ?? "";
|
||||
var link = await GetE621ImageLink(tag).ConfigureAwait(false);
|
||||
if (string.IsNullOrWhiteSpace(link))
|
||||
await channel.SendMessageAsync("Search yielded no results ;(");
|
||||
await channel.SendMessageAsync("Search yielded no results ;(").ConfigureAwait(false);
|
||||
else
|
||||
await channel.SendMessageAsync(link).ConfigureAwait(false);
|
||||
}
|
||||
@ -190,7 +230,7 @@ namespace NadekoBot.Modules.NSFW
|
||||
|
||||
if (matches.Count == 0)
|
||||
return null;
|
||||
return await NadekoBot.Google.ShortenUrl(matches[rng.Next(0, matches.Count)].Groups["ll"].Value).ConfigureAwait(false);
|
||||
return matches[rng.Next(0, matches.Count)].Groups["ll"].Value;
|
||||
}
|
||||
}
|
||||
|
||||
|
58
src/NadekoBot/Resources/CommandStrings.Designer.cs
generated
58
src/NadekoBot/Resources/CommandStrings.Designer.cs
generated
@ -464,6 +464,33 @@ namespace NadekoBot.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to atfbooru atf.
|
||||
/// </summary>
|
||||
public static string atfbooru_cmd {
|
||||
get {
|
||||
return ResourceManager.GetString("atfbooru_cmd", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Shows a random hentai image from atfbooru with a given tag. Tag is optional but preferred..
|
||||
/// </summary>
|
||||
public static string atfbooru_desc {
|
||||
get {
|
||||
return ResourceManager.GetString("atfbooru_desc", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to `{0}atfbooru yuri+kissing`.
|
||||
/// </summary>
|
||||
public static string atfbooru_usage {
|
||||
get {
|
||||
return ResourceManager.GetString("atfbooru_usage", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to autoassignrole aar.
|
||||
/// </summary>
|
||||
@ -2823,7 +2850,7 @@ namespace NadekoBot.Resources {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Shows a 2 random images (from gelbooru and danbooru) with a given tag. Tag is optional but preferred. Only 1 tag allowed..
|
||||
/// Looks up a localized string similar to Shows a hentai image from a random website (gelbooru or danbooru or konachan or atfbooru) with a given tag. Tag is optional but preferred. Only 1 tag allowed..
|
||||
/// </summary>
|
||||
public static string hentai_desc {
|
||||
get {
|
||||
@ -2840,6 +2867,33 @@ namespace NadekoBot.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to hentaibomb.
|
||||
/// </summary>
|
||||
public static string hentaibomb_cmd {
|
||||
get {
|
||||
return ResourceManager.GetString("hentaibomb_cmd", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Shows a total 4 images (from gelbooru, danbooru, konachan and atfbooru). Tag is optional but preferred..
|
||||
/// </summary>
|
||||
public static string hentaibomb_desc {
|
||||
get {
|
||||
return ResourceManager.GetString("hentaibomb_desc", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to `{0}hentaibomb yuri`.
|
||||
/// </summary>
|
||||
public static string hentaibomb_usage {
|
||||
get {
|
||||
return ResourceManager.GetString("hentaibomb_usage", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to hgit.
|
||||
/// </summary>
|
||||
@ -3147,7 +3201,7 @@ namespace NadekoBot.Resources {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Shows a random hentai image from konachan with a given tag. Tag is optional but preferred. (multiple tags are appended with +).
|
||||
/// Looks up a localized string similar to Shows a random hentai image from konachan with a given tag. Tag is optional but preferred..
|
||||
/// </summary>
|
||||
public static string konachan_desc {
|
||||
get {
|
||||
|
@ -2101,7 +2101,7 @@
|
||||
<value>hentai</value>
|
||||
</data>
|
||||
<data name="hentai_desc" xml:space="preserve">
|
||||
<value>Shows a 2 random images (from gelbooru and danbooru) with a given tag. Tag is optional but preferred. Only 1 tag allowed.</value>
|
||||
<value>Shows a hentai image from a random website (gelbooru or danbooru or konachan or atfbooru) with a given tag. Tag is optional but preferred. Only 1 tag allowed.</value>
|
||||
</data>
|
||||
<data name="hentai_usage" xml:space="preserve">
|
||||
<value>`{0}hentai yuri`</value>
|
||||
@ -2123,7 +2123,7 @@
|
||||
</data>
|
||||
<data name="atfbooru_usage" xml:space="preserve">
|
||||
<value>`{0}atfbooru yuri+kissing`</value>
|
||||
</data>
|
||||
</data>
|
||||
<data name="gelbooru_cmd" xml:space="preserve">
|
||||
<value>gelbooru</value>
|
||||
</data>
|
||||
@ -2461,7 +2461,7 @@
|
||||
<value>konachan</value>
|
||||
</data>
|
||||
<data name="konachan_desc" xml:space="preserve">
|
||||
<value>Shows a random hentai image from konachan with a given tag. Tag is optional but preferred. (multiple tags are appended with +)</value>
|
||||
<value>Shows a random hentai image from konachan with a given tag. Tag is optional but preferred.</value>
|
||||
</data>
|
||||
<data name="konachan_usage" xml:space="preserve">
|
||||
<value>`{0}konachan yuri`</value>
|
||||
@ -2610,4 +2610,13 @@
|
||||
<data name="listservers_usage" xml:space="preserve">
|
||||
<value>`{0}listservers 3`</value>
|
||||
</data>
|
||||
<data name="hentaibomb_cmd" xml:space="preserve">
|
||||
<value>hentaibomb</value>
|
||||
</data>
|
||||
<data name="hentaibomb_desc" xml:space="preserve">
|
||||
<value>Shows a total 4 images (from gelbooru, danbooru, konachan and atfbooru). Tag is optional but preferred.</value>
|
||||
</data>
|
||||
<data name="hentaibomb_usage" xml:space="preserve">
|
||||
<value>`{0}hentaibomb yuri`</value>
|
||||
</data>
|
||||
</root>
|
@ -91,6 +91,10 @@ namespace NadekoBot.Services.Impl
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(url))
|
||||
throw new ArgumentNullException(nameof(url));
|
||||
|
||||
if (string.IsNullOrWhiteSpace(NadekoBot.Credentials.GoogleApiKey))
|
||||
return url;
|
||||
|
||||
try
|
||||
{
|
||||
var response = await sh.Url.Insert(new Url { LongUrl = url }).ExecuteAsync();
|
||||
|
Loading…
Reference in New Issue
Block a user