2016-04-06 21:19:29 +02:00
using Discord.Commands ;
2016-02-10 14:39:11 +01:00
using Discord.Modules ;
using NadekoBot.Classes ;
2016-04-06 21:19:29 +02:00
using Newtonsoft.Json.Linq ;
using System ;
2016-02-10 14:39:11 +01:00
2016-04-06 21:19:29 +02:00
namespace NadekoBot.Modules
{
internal class NSFW : DiscordModule
{
2016-02-10 14:39:11 +01:00
2016-03-03 07:43:50 +01:00
private readonly Random rng = new Random ( ) ;
2016-02-10 14:39:11 +01:00
2016-03-12 10:02:29 +01:00
public override string Prefix { get ; } = NadekoBot . Config . CommandPrefixes . NSFW ;
2016-03-04 13:08:06 +01:00
2016-04-06 21:19:29 +02:00
public override void Install ( ModuleManager manager )
{
manager . CreateCommands ( "" , cgb = >
{
2016-02-12 01:56:55 +01:00
cgb . AddCheck ( Classes . Permissions . PermissionChecker . Instance ) ;
2016-03-06 09:56:17 +01:00
cgb . CreateCommand ( Prefix + "hentai" )
2016-02-24 00:23:26 -05:00
. Description ( "Shows a random NSFW hentai image from gelbooru and danbooru with a given tag. Tag is optional but preffered. (multiple tags are appended with +)\n**Usage**: ~hentai yuri+kissing" )
2016-02-10 14:39:11 +01:00
. Parameter ( "tag" , ParameterType . Unparsed )
2016-04-06 21:19:29 +02:00
. Do ( async e = >
{
2016-03-03 07:43:50 +01:00
var tag = e . GetArg ( "tag" ) ? . Trim ( ) ? ? "" ;
2016-04-06 21:19:29 +02:00
await e . Channel . SendMessage ( ":heart: Gelbooru: " + await SearchHelper . GetGelbooruImageLink ( "rating%3Aexplicit+" + tag ) ) ;
await e . Channel . SendMessage ( ":heart: Danbooru: " + await SearchHelper . GetDanbooruImageLink ( "rating%3Aexplicit+" + tag ) ) ;
2016-02-10 14:39:11 +01:00
} ) ;
2016-03-06 09:56:17 +01:00
cgb . CreateCommand ( Prefix + "danbooru" )
2016-02-13 17:01:24 +01:00
. Description ( "Shows a random hentai image from danbooru with a given tag. Tag is optional but preffered. (multiple tags are appended with +)\n**Usage**: ~danbooru yuri+kissing" )
2016-02-10 14:39:11 +01:00
. Parameter ( "tag" , ParameterType . Unparsed )
2016-04-06 21:19:29 +02:00
. Do ( async e = >
{
2016-03-03 07:43:50 +01:00
var tag = e . GetArg ( "tag" ) ? . Trim ( ) ? ? "" ;
2016-02-22 00:11:07 +01:00
await e . Channel . SendMessage ( await SearchHelper . GetDanbooruImageLink ( tag ) ) ;
2016-02-10 14:39:11 +01:00
} ) ;
2016-03-06 09:56:17 +01:00
cgb . CreateCommand ( Prefix + "gelbooru" )
2016-02-13 17:01:24 +01:00
. Description ( "Shows a random hentai image from gelbooru with a given tag. Tag is optional but preffered. (multiple tags are appended with +)\n**Usage**: ~gelbooru yuri+kissing" )
2016-02-10 14:39:11 +01:00
. Parameter ( "tag" , ParameterType . Unparsed )
2016-04-06 21:19:29 +02:00
. Do ( async e = >
{
2016-03-03 07:43:50 +01:00
var tag = e . GetArg ( "tag" ) ? . Trim ( ) ? ? "" ;
2016-02-22 00:11:07 +01:00
await e . Channel . SendMessage ( await SearchHelper . GetGelbooruImageLink ( tag ) ) ;
2016-02-10 14:39:11 +01:00
} ) ;
2016-04-06 15:54:27 +03:00
cgb . CreateCommand ( Prefix + "safebooru" )
2016-04-06 21:19:29 +02:00
. Description ( "Shows a random image from safebooru with a given tag. Tag is optional but preffered. (multiple tags are appended with +)\n**Usage**: ~safebooru yuri+kissing" )
2016-04-06 15:54:27 +03:00
. Parameter ( "tag" , ParameterType . Unparsed )
2016-04-06 21:19:29 +02:00
. Do ( async e = >
{
2016-04-06 15:54:27 +03:00
var tag = e . GetArg ( "tag" ) ? . Trim ( ) ? ? "" ;
await e . Channel . SendMessage ( await SearchHelper . GetSafebooruImageLink ( tag ) ) ;
} ) ;
cgb . CreateCommand ( Prefix + "rule34" )
. Description ( "Shows a random image from rule34.xx with a given tag. Tag is optional but preffered. (multiple tags are appended with +)\n**Usage**: ~gelbooru yuri+kissing" )
. Parameter ( "tag" , ParameterType . Unparsed )
2016-04-06 21:19:29 +02:00
. Do ( async e = >
{
2016-04-06 15:54:27 +03:00
var tag = e . GetArg ( "tag" ) ? . Trim ( ) ? ? "" ;
await e . Channel . SendMessage ( await SearchHelper . GetRule34ImageLink ( tag ) ) ;
} ) ;
2016-03-06 09:56:17 +01:00
cgb . CreateCommand ( Prefix + "e621" )
2016-02-24 00:23:26 -05:00
. Description ( "Shows a random hentai image from e621.net with a given tag. Tag is optional but preffered. Use spaces for multiple tags.\n**Usage**: ~e621 yuri+kissing" )
2016-02-24 17:33:09 +01:00
. Parameter ( "tag" , ParameterType . Unparsed )
2016-04-06 21:19:29 +02:00
. Do ( async e = >
{
2016-03-03 07:43:50 +01:00
var tag = e . GetArg ( "tag" ) ? . Trim ( ) ? ? "" ;
2016-02-22 00:11:07 +01:00
await e . Channel . SendMessage ( await SearchHelper . GetE621ImageLink ( tag ) ) ;
2016-02-14 16:07:19 +01:00
} ) ;
2016-03-06 09:56:17 +01:00
cgb . CreateCommand ( Prefix + "cp" )
2016-02-10 14:39:11 +01:00
. Description ( "We all know where this will lead you to." )
. Parameter ( "anything" , ParameterType . Unparsed )
2016-04-06 21:19:29 +02:00
. Do ( async e = >
{
2016-02-22 00:11:07 +01:00
await e . Channel . SendMessage ( "http://i.imgur.com/MZkY1md.jpg" ) ;
2016-02-10 14:39:11 +01:00
} ) ;
2016-03-06 09:56:17 +01:00
cgb . CreateCommand ( Prefix + "boobs" )
2016-02-10 14:39:11 +01:00
. Description ( "Real adult content." )
2016-04-06 21:19:29 +02:00
. Do ( async e = >
{
try
{
2016-03-03 07:43:50 +01:00
var obj = JArray . Parse ( await SearchHelper . GetResponseStringAsync ( $"http://api.oboobs.ru/boobs/{rng.Next(0, 9380)}" ) ) [ 0 ] ;
2016-02-22 00:11:07 +01:00
await e . Channel . SendMessage ( $"http://media.oboobs.ru/{ obj[" preview "].ToString() }" ) ;
2016-04-06 21:19:29 +02:00
}
catch ( Exception ex )
{
2016-02-22 00:11:07 +01:00
await e . Channel . SendMessage ( $"💢 {ex.Message}" ) ;
2016-02-10 14:39:11 +01:00
}
} ) ;
2016-03-06 09:56:17 +01:00
cgb . CreateCommand ( Prefix + "butts" )
2016-04-06 21:19:29 +02:00
. Alias ( Prefix + "ass" , Prefix + "butt" )
2016-03-03 07:43:50 +01:00
. Description ( "Real adult content." )
2016-04-06 21:19:29 +02:00
. Do ( async e = >
{
try
{
2016-03-03 07:43:50 +01:00
var obj = JArray . Parse ( await SearchHelper . GetResponseStringAsync ( $"http://api.obutts.ru/butts/{rng.Next(0, 3373)}" ) ) [ 0 ] ;
await e . Channel . SendMessage ( $"http://media.obutts.ru/{ obj[" preview "].ToString() }" ) ;
2016-04-06 21:19:29 +02:00
}
catch ( Exception ex )
{
2016-03-03 07:43:50 +01:00
await e . Channel . SendMessage ( $"💢 {ex.Message}" ) ;
}
} ) ;
2016-02-10 14:39:11 +01:00
} ) ;
}
}
}