电报信息上设置了不同的表情符号

2024-04-20 08:10:17 发布

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

我正在开发一个用Python编写的电报机器人。使用官方电报API发送消息。这是一张带有标题的照片,因此我使用以下端点:https://api.telegram.org/{{bot_token}}/sendPhoto

问题如下:

一旦发送了一条“我在我的Android手机上看到这条消息”(Realme X2 Pro,右屏幕截图),从任意长度的消息中,表情集似乎会从苹果变为谷歌(根据篮球表情在这里的显示:https://emojipedia.org/basketball/)。但是,如果我在iPhone上看到这条消息(左屏幕截图),这条消息就会完美地显示出来

iOS and Android screenshots

这是我用来发送带有标题的图片的代码:

url = 'https://api.telegram.org/{{bot_token}}/sendPhoto'
files = {'photo': open('final.jpg', 'rb')}
payload = dict(chat_id={{bot_id}}, caption=mensaje, parse_mode='MarkdownV2')
res = requests.post(url, data=payload, files=files) 

有人知道我做错了什么吗

编辑

我一直在测试一条关于表情符号的信息,我得到的是:前50个表情符号是用苹果套装显示的;从第51位开始,它看起来像谷歌集。检查它:

enter image description here

这是我用于此测试的代码:

money = u'\U0001F4B0'
message = ""
for i in range(200):
    message += money
url = 'https://api.telegram.org/{{bot_token}}/sendMessage'
payload = dict(chat_id={{bot_id}}, text=message)
res = requests.post(url, data=payload)

提前谢谢


Tags: httpsorgtokenapiid消息url标题