88from discord .ext import commands
99
1010import teapot
11- import teapot .tools .embed as dmbd
11+ import teapot .tools .embed as embed
12+
13+
14+ def neko_api (x ):
15+ req = requests .get (f'https://nekos.life/api/v2/img/{ x } ' )
16+ try :
17+ if req .status_code != 200 :
18+ print ("Unable to obtain neko image!" )
19+ api_json = json .loads (req .text )
20+ url = api_json ["url" ]
21+ em = embed .newembed ().set_image (url = url )
22+ return em
23+ except :
24+ return teapot .messages .error (f"obtaining image ({ req .status_code } )" )
1225
1326
1427class Neko (commands .Cog ):
1528 """Neko!!! :3"""
1629
1730 def __init__ (self , bot ):
18- """ Initialize neko class"""
19-
31+ """Initialize neko class"""
2032 self .bot = bot
2133
22- def neko_api (self , ctx , x ):
23- try :
24- req = requests .get (f'https://nekos.life/api/v2/img/{ x } ' )
25- if req .status_code != 200 :
26- print ("Could not get a neko" )
27- apijson = json .loads (req .text )
28- url = apijson ["url" ]
29- em = dmbd .newembed ().set_image (url = url )
30- return em
31- except :
32- return teapot .messages .error (f"obtaining image ({ req .status_code } )" )
33-
3434 @commands .command ()
3535 async def neko (self , ctx ):
36- await ctx .send (embed = self . neko_api (ctx , "neko" ))
36+ await ctx .send (embed = neko_api ("neko" ))
3737
3838 @commands .command ()
3939 async def waifu (self , ctx ):
40- await ctx .send (embed = self . neko_api (ctx , "waifu" ))
40+ await ctx .send (embed = neko_api ("waifu" ))
4141
4242 @commands .command ()
4343 async def avatar (self , ctx ):
44- await ctx .send (embed = self . neko_api (ctx , "avatar" ))
44+ await ctx .send (embed = neko_api ("avatar" ))
4545
4646 @commands .command ()
4747 async def wallpaper (self , ctx ):
48- await ctx .send (embed = self . neko_api (ctx , "wallpaper" ))
48+ await ctx .send (embed = neko_api ("wallpaper" ))
4949
5050 @commands .command ()
5151 async def tickle (self , ctx ):
52- await ctx .send (embed = self . neko_api (ctx , "tickle" ))
52+ await ctx .send (embed = neko_api ("tickle" ))
5353
5454 @commands .command ()
5555 async def poke (self , ctx ):
56- await ctx .send (embed = self . neko_api (ctx , "poke" ))
56+ await ctx .send (embed = neko_api ("poke" ))
5757
5858 @commands .command ()
5959 async def kiss (self , ctx ):
60- await ctx .send (embed = self . neko_api (ctx , "kiss" ))
60+ await ctx .send (embed = neko_api ("kiss" ))
6161
6262 @commands .command (aliases = ['8ball' ])
6363 async def eightball (self , ctx ):
64- await ctx .send (embed = self . neko_api (ctx , "8ball" ))
64+ await ctx .send (embed = neko_api ("8ball" ))
6565
6666 @commands .command ()
6767 async def lizard (self , ctx ):
68- await ctx .send (embed = self . neko_api (ctx , "lizard" ))
68+ await ctx .send (embed = neko_api ("lizard" ))
6969
7070 @commands .command ()
7171 async def slap (self , ctx ):
72- await ctx .send (embed = self . neko_api (ctx , "slap" ))
72+ await ctx .send (embed = neko_api ("slap" ))
7373
7474 @commands .command ()
7575 async def cuddle (self , ctx ):
76- await ctx .send (embed = self . neko_api (ctx , "cuddle" ))
76+ await ctx .send (embed = neko_api ("cuddle" ))
7777
7878 @commands .command ()
7979 async def goose (self , ctx ):
80- await ctx .send (embed = self . neko_api (ctx , "goose" ))
80+ await ctx .send (embed = neko_api ("goose" ))
8181
8282 @commands .command ()
8383 async def fox_girl (self , ctx ):
84- await ctx .send (embed = self . neko_api (ctx , "fox_girl" ))
84+ await ctx .send (embed = neko_api ("fox_girl" ))
8585
8686 @commands .command ()
8787 async def baka (self , ctx ):
88- await ctx .send (embed = self . neko_api (ctx , "baka" ))
88+ await ctx .send (embed = neko_api ("baka" ))
8989
9090 @commands .command ()
91- async def hentai (self , ctx , type = "" ):
91+ async def hentai (self , ctx , api_type = "" ):
9292 if ctx .message .channel .nsfw :
9393 api_types = ['femdom' , 'classic' , 'ngif' , 'erofeet' , 'erok' , 'les' ,
9494 'hololewd' , 'lewdk' , 'keta' , 'feetg' , 'nsfw_neko_gif' , 'eroyuri' ,
@@ -97,13 +97,13 @@ async def hentai(self, ctx, type=""):
9797 'feet' , 'smug' , 'kemonomimi' , 'solog' , 'holo' , 'bj' , 'woof' , 'yuri' , 'trap' , 'anal' ,
9898 'blowjob' , 'holoero' , 'feed' , 'gasm' , 'hentai' , 'futanari' , 'ero' , 'solo' , 'pwankg' , 'eron' ,
9999 'erokemo' ]
100- if type in api_types :
100+ if api_type in api_types :
101+ req = requests .get (f'https://nekos.life/api/v2/img/{ api_type } ' )
101102 try :
102- req = requests .get (f'https://nekos.life/api/v2/img/{ type } ' )
103103 if req .status_code != 200 :
104104 print ("Unable to obtain image" )
105- apijson = json .loads (req .text )
106- url = apijson ["url" ]
105+ api_json = json .loads (req .text )
106+ url = api_json ["url" ]
107107
108108 message = await ctx .send (embed = teapot .messages .downloading ())
109109 async with aiohttp .ClientSession () as session :
0 commit comments