使用Telegram Bot API获取测验答案解释时缺失solution参数求助
无法通过Telegram Bot API获取测验Poll的solution字段
我在项目里碰到个问题,想请教大家。我正尝试用Telegram Bot API从频道获取测验结果,包括答案的解释内容。
目前我用getUpdates方法获取测验结果,能拿到题目和投票数据,但拿不到答案解释。根据Telegram官方API文档,PollResults对象应该包含存储解释的solution参数,但实际返回的响应里根本没有这个字段。
以下是我的代码片段:
import requests import json bot_token = 'XXXXXX' url = f'https://api.telegram.org/bot{bot_token}/getUpdates' response = requests.get(url) data = response.json() if 'result' in data: for update in data['result']: #... (后续代码) poll_data = poll_response.json() print(poll_data)
我得到的响应片段如下:
{ "ok": true, "result": [{ "update_id": 123456, "message": { "message_id": 100, "poll": { "id": "1234567890", "question": "Sample Question", "options": [{ "text": "Option 1", "voter_count": 10 }, { "text": "Option 2", "voter_count": 20 }], "total_voter_count": 30, "is_closed": false, "is_anonymous": true, "type": "quiz", "allows_multiple_answers": false } } }] }
如你所见,solution字段完全缺失。有没有人碰到过类似问题?是我操作有误,还是Telegram Bot API有什么限制或者bug?
感谢各位的帮助!
内容的提问来源于stack exchange,提问作者Kémil
相关产品推荐
相关产品推荐

