使用自定义表情符号

图形化的 Telegram 客户端应该将表情符号转换为相应的动画版本。

动态表情符号

inputStickerSetAnimatedEmoji#28703c8 = InputStickerSet;messages.stickerSet#6e153f16 set:StickerSet packs:Vector<StickerPack> keywords:Vector<StickerKeyword> documents:Vector<Document> = messages.StickerSet;---functions---messages.getStickerSet#c8a0ec74 stickerset:InputStickerSet hash:int = messages.StickerSet;

启动时,客户端应调用messages.getStickerSet方法来获取动态表情贴纸集,并将inputStickerSetAnimatedEmoji参数传递给该stickerset方法。
返回的贴纸集将包含一组动态贴纸,每个贴纸对应一个支持的表情符号。

客户应将仅包含一个允许使用的表情符号的消息替换为相应的动态贴纸。
此外,当收到仅包含一个自定义表情符号的消息时,不应显示包含单个小型自定义表情符号的消息气泡,而应像普通贴纸一样直接显示放大后的自定义表情符号。

动态表情符号在首次发送、接收或点击时应仅循环播放一次。
对于支持的表情符号,当私聊双方中的任何一方点击动态表情符号时,双方客户端都应显示相应的反应动画:点击此处了解更多信息 »。

对于特殊的骰子表情符号,例如🎲🎯🏀,客户端在发送和接收此类表情符号时应该有不同的行为:点击此处了解更多信息 »。

带声音的表情符号

根据服务器端配置,某些动画表情符号在点击时应播放声音。

返回的 JSON 对象将包含以下映射,其中包含要下载的文件 ID 列表:

"emojies_sounds": {"\ud83c\udf83": {"id": "4956223179606458539","access_hash": "-2107001400913062971","file_reference_base64": "AF-4ApC7ukC0UWEPZN0TeSJURe7T"},"\u26b0": {"id": "4956223179606458540","access_hash": "-1498869544183595185","file_reference_base64": "AF-4ApCLKMGt96WCvLm58kbqZHd3"},"\ud83e\udddf\u200d\u2642": {"id": "4960929110848176331","access_hash": "3986395821757915468","file_reference_base64": "AF-4ApAedNln3IMEHH-SUQuH8L9g"},}

下载文件之前,应该对文件引用字段进行 base64 解码。

表情符号反应

inputStickerSetAnimatedEmojiAnimations#cde3739 = InputStickerSet;messages.stickerSet#6e153f16 set:StickerSet packs:Vector<StickerPack> keywords:Vector<StickerKeyword> documents:Vector<Document> = messages.StickerSet;stickerPack#12b299d4 emoticon:string documents:Vector<long> = StickerPack;sendMessageEmojiInteraction#25972bcb emoticon:string msg_id:int interaction:DataJSON = SendMessageAction; sendMessageEmojiInteractionSeen#b665902e emoticon:string = SendMessageAction;updateUserTyping#c01e857f user_id:long action:SendMessageAction = Update;---functions---messages.getStickerSet#c8a0ec74 stickerset:InputStickerSet hash:int = messages.StickerSet;messages.setTyping#58943ee2 flags:# peer:InputPeer top_msg_id:flags.0?int action:SendMessageAction = Bool;

不要与消息反应混淆 »。

启动时,客户端应调用`messages.getStickerSet`方法获取动态表情贴纸集,并将`inputStickerSetAnimatedEmojiAnimations` 参数传递给它stickerset。
返回的贴纸集将包含一组动态表情,每个受支持的表情符号对应一个或多个
表情。 如果返回了某个表情符号的一组表情❤,则也应将相同的表情分配给🧡` <img>`💛、 `<img>`、` <img>` 、`<img>`💚、 `<img>`和`<img>` 表情符号。💙💜🖤🤍🤎

在私聊中,当双方用户点击支持的动态表情符号时,双方客户端都应在动态贴纸上叠加相应的反应动画。如果底层的普通表情符号也受支持(如上所述),则对于独立的自定义表情符号(单个自定义表情符号
始终显示为独立贴纸), 也应执行相同的操作。每次点击的反应动画应从给定表情符号的所有可用反应中随机选择,多次点击应汇总并按以下方式发送给对方:

每次点击时,客户端应将所有发生的点击事件存储在本地列表中。
如果 1 秒内没有新的点击事件发生,则应清空本地列表,并使用messages.setTyping发送已存储的点击事件,同时传递一个包含以下字段的sendMessageEmojiInteraction构造函数:

在接收用户看到特定表情符号的最后一个反应动画后 1 秒,必须使用messages.setTyping发送确认信息,并传递一个带有该表情符号的sendMessageEmojiInteractionSeen。