/
hentai_api.py
82 lines (73 loc) · 2.15 KB
/
hentai_api.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
from aiohttp.client_exceptions import ClientError
from pyrogram import filters
from pyrogram.types import Message
from userbot import UserBot
from userbot.helpers.aiohttp_helper import AioHttp
from userbot.plugins.help import add_command_help
cf_api_data = {
"anime": {
"url": "https://api.computerfreaker.cf/v1/anime",
"help": "It works on my machine!",
},
"hentai": {
"url": "https://api.computerfreaker.cf/v1/hentai",
"help": "Sends a nice compliment.",
},
"yuri": {
"url": "https://api.computerfreaker.cf/v1/yuri",
"help": "Affirmative messages",
},
"dva": {
"url": "https://api.computerfreaker.cf/v1/dva",
"help": "Affirmative messages",
},
"trap": {
"url": "https://api.computerfreaker.cf/v1/trap",
"help": "Affirmative messages",
},
"hug": {
"url": "https://api.computerfreaker.cf/v1/hug",
"help": "Give it a guess dumbass!",
},
"neko": {
"url": "https://api.computerfreaker.cf/v1/neko",
"format": "Kanye once said:\n`{}`",
"help": "Kanye used to say",
},
"nsfwneko": {
"url": "https://api.computerfreaker.cf/v1/nsfwneko",
"help": "Programmers be like.",
},
"baguette": {
"url": "https://api.computerfreaker.cf/v1/baguette",
"help": "Affirmative messages",
},
}
text_api_commands = []
for x in cf_api_data:
text_api_commands.append(x)
if "alts" in cf_api_data[x]:
for y in cf_api_data[x]["alts"]:
text_api_commands.append(y)
@UserBot.on_message(
filters.command(text_api_commands, ".") & filters.me
)
async def hentai_api(bot: UserBot, message: Message):
cmd = message.command
api_key = cmd[0]
api = cf_api_data[api_key]
try:
data = await AioHttp().get_json(api["url"])
content_url: str = data['url']
await bot.send_photo(message.chat.id, content_url)
except ClientError as e:
print(e)
await message.delete()
# Command help section
for x in cf_api_data:
add_command_help(
"anime_cf",
[
[f".{x}", cf_api_data[x]["help"]],
],
)