-
-
Notifications
You must be signed in to change notification settings - Fork 301
/
stickerspam.py
54 lines (46 loc) · 1.46 KB
/
stickerspam.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
# Ultroid - UserBot
# Copyright (C) 2020 TeamUltroid
#
# This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
# PLease read the GNU Affero General Public License in
# <https://www.github.com/TeamUltroid/Ultroid/blob/main/LICENSE/>.
"""
✘ Commands Available -
•`{i}sspam <reply to sticker> <optional- time gap>`
it spam the whole stickers in that pack.
"""
import asyncio
from telethon.tl.functions.messages import GetStickerSetRequest
from telethon.tl.types import InputStickerSetID, InputStickerSetShortName
from telethon.utils import get_input_document
from . import *
@ultroid_cmd(pattern="sspam ?(.*)")
async def _(e):
match = e.pattern_match.group(1)
x = await e.get_reply_message()
if not (x and x.media and hasattr(x.media, "document")):
return await eod(e, "`Reply To Sticker Only`")
set = x.document.attributes[1]
sset = await e.client(
GetStickerSetRequest(
InputStickerSetID(
id=set.stickerset.id, access_hash=set.stickerset.access_hash
),
hash=0,
)
)
pack = sset.set.short_name
docs = [
get_input_document(x)
for x in (
await e.client(GetStickerSetRequest(InputStickerSetShortName(pack), hash=0))
).documents
]
try:
match = int(match)
except ValueError:
match = None
for xx in docs:
if match:
await asyncio.sleep(match)
await e.respond(file=xx)