Skip to content

Instantly share code, notes, and snippets.

@yusufusta
Created April 18, 2021 21:59
Show Gist options
  • Select an option

  • Save yusufusta/0d4db499c5950a1317efdb02ee3b71b7 to your computer and use it in GitHub Desktop.

Select an option

Save yusufusta/0d4db499c5950a1317efdb02ee3b71b7 to your computer and use it in GitHub Desktop.
from telethon.sync import TelegramClient, events
from telethon.tl.functions.messages import GetStickerSetRequest
from telethon.tl.types import InputStickerSetID
with TelegramClient('name', 0, "api hash") as client:
sent = {1397428129: 0, 1125780346: 0}
@client.on(events.NewMessage(from_users=[1397428129, 1125780346]))
async def handler(event):
if sent[event.sender_id] >= 10:
return
stickers = await client(GetStickerSetRequest(
stickerset=InputStickerSetID(
id=1942706539403935808, access_hash=-5150859203810079765
)
))
sent[event.sender_id] = sent[event.sender_id] + 1
await event.client.send_file(event.chat_id, stickers.documents[0], reply_to=event)
client.run_until_disconnected()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment