mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-09-19 02:12:40 +03:00
Destroyed Sending stickers (markdown)
parent
d9832dc5aa
commit
f036e2a871
|
@ -1,28 +0,0 @@
|
||||||
Stickers are nothing else than **files**, and when you successfully retrieve the stickers for a certain sticker set, all you will have are **handles** to these files. Remember, the files Telegram holds on their servers can be referenced through this pair of ID/hash (unique per user), and you need to use this handle when sending a "document" message. This working example will send yourself the very first sticker you have:
|
|
||||||
|
|
||||||
```python
|
|
||||||
# Get all the sticker sets this user has
|
|
||||||
sticker_sets = client(GetAllStickersRequest(0))
|
|
||||||
|
|
||||||
# Choose a sticker set
|
|
||||||
sticker_set = sticker_sets.sets[0]
|
|
||||||
|
|
||||||
# Get the stickers for this sticker set
|
|
||||||
stickers = client(GetStickerSetRequest(
|
|
||||||
stickerset=InputStickerSetID(
|
|
||||||
id=sticker_set.id, access_hash=sticker_set.access_hash
|
|
||||||
)
|
|
||||||
))
|
|
||||||
|
|
||||||
# Stickers are nothing more than files, so send that
|
|
||||||
client(SendMediaRequest(
|
|
||||||
peer=client.get_me(),
|
|
||||||
media=InputMediaDocument(
|
|
||||||
id=InputDocument(
|
|
||||||
id=stickers.documents[0].id,
|
|
||||||
access_hash=stickers.documents[0].access_hash
|
|
||||||
),
|
|
||||||
caption=''
|
|
||||||
)
|
|
||||||
))
|
|
||||||
```
|
|
Loading…
Reference in New Issue
Block a user