首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何在telethon中使用id (string)发送贴纸

如何在telethon中使用id (string)发送贴纸
EN

Stack Overflow用户
提问于 2020-11-29 00:44:30
回答 1查看 452关注 0票数 1

有没有使用event.file的id属性发送贴纸的方法?文档指出要使用特定贴纸集合的id和access_hash发送它,最后使用带有sticker_set的索引来发送贴纸。由于电报服务器中存储的特定贴纸有唯一的id,我想知道是否有任何方法可以用它来发送贴纸?

EN

回答 1

Stack Overflow用户

发布于 2021-08-01 13:43:42

代码语言:javascript
复制
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])
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/65052059

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档