8
8
from discord .ext import commands
9
9
10
10
import 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 } )" )
12
25
13
26
14
27
class Neko (commands .Cog ):
15
28
"""Neko!!! :3"""
16
29
17
30
def __init__ (self , bot ):
18
- """ Initialize neko class"""
19
-
31
+ """Initialize neko class"""
20
32
self .bot = bot
21
33
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
-
34
34
@commands .command ()
35
35
async def neko (self , ctx ):
36
- await ctx .send (embed = self . neko_api (ctx , "neko" ))
36
+ await ctx .send (embed = neko_api ("neko" ))
37
37
38
38
@commands .command ()
39
39
async def waifu (self , ctx ):
40
- await ctx .send (embed = self . neko_api (ctx , "waifu" ))
40
+ await ctx .send (embed = neko_api ("waifu" ))
41
41
42
42
@commands .command ()
43
43
async def avatar (self , ctx ):
44
- await ctx .send (embed = self . neko_api (ctx , "avatar" ))
44
+ await ctx .send (embed = neko_api ("avatar" ))
45
45
46
46
@commands .command ()
47
47
async def wallpaper (self , ctx ):
48
- await ctx .send (embed = self . neko_api (ctx , "wallpaper" ))
48
+ await ctx .send (embed = neko_api ("wallpaper" ))
49
49
50
50
@commands .command ()
51
51
async def tickle (self , ctx ):
52
- await ctx .send (embed = self . neko_api (ctx , "tickle" ))
52
+ await ctx .send (embed = neko_api ("tickle" ))
53
53
54
54
@commands .command ()
55
55
async def poke (self , ctx ):
56
- await ctx .send (embed = self . neko_api (ctx , "poke" ))
56
+ await ctx .send (embed = neko_api ("poke" ))
57
57
58
58
@commands .command ()
59
59
async def kiss (self , ctx ):
60
- await ctx .send (embed = self . neko_api (ctx , "kiss" ))
60
+ await ctx .send (embed = neko_api ("kiss" ))
61
61
62
62
@commands .command (aliases = ['8ball' ])
63
63
async def eightball (self , ctx ):
64
- await ctx .send (embed = self . neko_api (ctx , "8ball" ))
64
+ await ctx .send (embed = neko_api ("8ball" ))
65
65
66
66
@commands .command ()
67
67
async def lizard (self , ctx ):
68
- await ctx .send (embed = self . neko_api (ctx , "lizard" ))
68
+ await ctx .send (embed = neko_api ("lizard" ))
69
69
70
70
@commands .command ()
71
71
async def slap (self , ctx ):
72
- await ctx .send (embed = self . neko_api (ctx , "slap" ))
72
+ await ctx .send (embed = neko_api ("slap" ))
73
73
74
74
@commands .command ()
75
75
async def cuddle (self , ctx ):
76
- await ctx .send (embed = self . neko_api (ctx , "cuddle" ))
76
+ await ctx .send (embed = neko_api ("cuddle" ))
77
77
78
78
@commands .command ()
79
79
async def goose (self , ctx ):
80
- await ctx .send (embed = self . neko_api (ctx , "goose" ))
80
+ await ctx .send (embed = neko_api ("goose" ))
81
81
82
82
@commands .command ()
83
83
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" ))
85
85
86
86
@commands .command ()
87
87
async def baka (self , ctx ):
88
- await ctx .send (embed = self . neko_api (ctx , "baka" ))
88
+ await ctx .send (embed = neko_api ("baka" ))
89
89
90
90
@commands .command ()
91
- async def hentai (self , ctx , type = "" ):
91
+ async def hentai (self , ctx , api_type = "" ):
92
92
if ctx .message .channel .nsfw :
93
93
api_types = ['femdom' , 'classic' , 'ngif' , 'erofeet' , 'erok' , 'les' ,
94
94
'hololewd' , 'lewdk' , 'keta' , 'feetg' , 'nsfw_neko_gif' , 'eroyuri' ,
@@ -97,13 +97,13 @@ async def hentai(self, ctx, type=""):
97
97
'feet' , 'smug' , 'kemonomimi' , 'solog' , 'holo' , 'bj' , 'woof' , 'yuri' , 'trap' , 'anal' ,
98
98
'blowjob' , 'holoero' , 'feed' , 'gasm' , 'hentai' , 'futanari' , 'ero' , 'solo' , 'pwankg' , 'eron' ,
99
99
'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 } ' )
101
102
try :
102
- req = requests .get (f'https://nekos.life/api/v2/img/{ type } ' )
103
103
if req .status_code != 200 :
104
104
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" ]
107
107
108
108
message = await ctx .send (embed = teapot .messages .downloading ())
109
109
async with aiohttp .ClientSession () as session :
0 commit comments