-
Notifications
You must be signed in to change notification settings - Fork 85
/
Copy pathrandomsticker.py
144 lines (129 loc) · 3.76 KB
/
randomsticker.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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
import random
from os import remove
from random import choice
from urllib import parse
import requests
from PIL import Image
from telethon import functions, types, utils
from userbot import catub
from userbot.core.managers import edit_or_reply
from userbot.helpers import reply_id
plugin_category = "extra"
BASE_URL = "https://headp.at/pats/{}"
PAT_IMAGE = "pat.webp"
@catub.cat_cmd(
pattern="cat$",
command=("cat", plugin_category),
info={
"header": "To get random cat stickers.",
"usage": "{tr}cat",
},
)
async def cat(event):
"To get random cat stickers."
await event.delete()
reply_to_id = await reply_id(event)
cat = requests.get("https://nekos.life/api/v2/img/meow").json()
try:
with open("temp.png", "wb") as f:
f.write(requests.get(cat["url"]).content)
img = Image.open("temp.png")
img.save("temp.webp", "webp")
img.seek(0)
await event.delete()
await event.client.send_file(
event.chat_id, open("temp.webp", "rb"), reply_to=reply_to_id
)
remove("temp.webp")
except KeyError:
await edit_or_reply(event, "```Can't Find any cat...```")
# credit to @r4v4n4
@catub.cat_cmd(
pattern="dab$",
command=("dab", plugin_category),
info={
"header": "To get random dabbing pose stickers.",
"usage": "{tr}dab",
},
)
async def dab(event):
"To get random dabbing pose stickers."
reply_to_id = await reply_id(event)
blacklist = {
1653974154589768377,
1653974154589768312,
1653974154589767857,
1653974154589768311,
1653974154589767816,
1653974154589767939,
1653974154589767944,
1653974154589767912,
1653974154589767911,
1653974154589767910,
1653974154589767909,
1653974154589767863,
1653974154589767852,
1653974154589768677,
}
await event.delete()
docs = [
utils.get_input_document(x)
for x in (
await event.client(
functions.messages.GetStickerSetRequest(
types.InputStickerSetShortName("DabOnHaters"),
hash=0,
)
)
).documents
if x.id not in blacklist
]
await event.respond(file=random.choice(docs), reply_to=reply_to_id)
@catub.cat_cmd(
pattern="brain$",
command=("brain", plugin_category),
info={
"header": "To get random brain stickers.",
"usage": "{tr}brain",
},
)
async def brain(event):
"To get random brain stickers."
reply_to_id = await reply_id(event)
blacklist = {}
await event.delete()
docs = [
utils.get_input_document(x)
for x in (
await event.client(
functions.messages.GetStickerSetRequest(
types.InputStickerSetShortName("supermind"),
hash=0,
)
)
).documents
if x.id not in blacklist
]
await event.respond(file=random.choice(docs), reply_to=reply_to_id)
# HeadPat Module for Userbot (http://headp.at)
# cmd:- .pat username or reply to msg
# By:- git: jaskaranSM tg: @Zero_cool7870
@catub.cat_cmd(
pattern="pat$",
command=("pat", plugin_category),
info={
"header": "To get random pat stickers.",
"usage": "{tr}pat",
},
)
async def pat(event):
"To get random pat stickers."
await event.delete()
reply_to_id = await reply_id(event)
resp = requests.get("http://headp.at/js/pats.json")
pats = resp.json()
pat = BASE_URL.format(parse.quote(choice(pats)))
with open(PAT_IMAGE, "wb") as f:
f.write(requests.get(pat).content)
await event.client.send_file(event.chat_id, PAT_IMAGE, reply_to=reply_to_id)
remove(PAT_IMAGE)