-
Notifications
You must be signed in to change notification settings - Fork 102
/
pats.py
35 lines (29 loc) · 1 KB
/
pats.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
import asyncio
import aiohttp
from pyrogram import filters
from pyrogram.types import Message
from userbot import UserBot
from userbot.helpers.PyroHelpers import GetChatID, ReplyCheck
from userbot.plugins.help import add_command_help
@UserBot.on_message(filters.command(["pat", "pats"], ".") & filters.me)
async def give_pats(bot: UserBot, message: Message):
URL = "https://some-random-api.com/animu/pat"
async with aiohttp.ClientSession() as session:
async with session.get(URL) as request:
if request.status == 404:
return await message.edit("`no Pats for you :c")
result = await request.json()
url = result.get("link", None)
await asyncio.gather(
message.delete(),
bot.send_video(
GetChatID(message), url, reply_to_message_id=ReplyCheck(message)
),
)
# Command help section
add_command_help(
"pats",
[
[".pat | .pats", "Give pats."],
],
)