如何使用telethon中的id(字符串)发送标签

2024-04-25 20:04:56 发布

您现在位置:Python中文网/ 问答频道 /正文

是否有任何方法可以使用event.file的id属性发送标签?文档指出,使用特定标签集的id和访问散列发送标签,然后使用带有标签集的索引发送标签。由于电报服务器中存储的特定标签有唯一的id,我想知道是否有任何方法可以使用它来发送标签


Tags: 方法文档服务器eventid属性标签电报
1条回答
网友
1楼 · 发布于 2024-04-25 20:04:56
from telethon.tl.functions.messages import GetAllStickersRequest
sticker_sets = await client(GetAllStickersRequest(0))

# Choose a sticker set
from telethon.tl.functions.messages import GetStickerSetRequest
from telethon.tl.types import InputStickerSetID
sticker_set = sticker_sets.sets[0]

# Get the stickers for this sticker set
stickers = await client(GetStickerSetRequest(
    stickerset=InputStickerSetID(
        id=sticker_set.id, access_hash=sticker_set.access_hash
    )
))

# Stickers are nothing more than files, so send that
await client.send_file('me', stickers.documents[0])

相关问题 更多 >