电报嵌入式键盘按钮不起作用

时间:2020-07-13 12:38:48

标签: python heroku callback telegram

我的机器人将嵌入式键盘发送给电报组。键盘的发送没有问题,但是当用户单击时,电报没有响应。我已经使用heroku logs -t检查了我的heroku日志。电报没有ping。这怎么可能发生?这可能是电报的附带问题吗?
附加信息:所有其他功能都可以正常工作。

TELEGRAM_WEBSITE = "https://api.telegram.org/" + <BOT_TOKEN>
response_body=requests.post(TELEGRAM_WEBSITE + "/sendmessage",
                              data={"text": "{}".format(TEXT), "parse_mode": "HTML",
                                    "chat_id": "{}".format(CHAT_ID),
                                    "reply_markup": json.dumps(
                                        {"inline_keyboard": [[{"text": "{}".format(BET_POSITION),
                                        "callback_data": "{};{};{};{};{};{}".format(BET_SUM,CHALLENGE_TYPE,RIVAL_TELE_ID,TELE_ID,BET_POSITION,USERNAME)}]]})})
response_body=response_body.json()
requests.post(TELEGRAM_WEBSITE + "/sendmessage?chat_id={}&text={}".format(<my telegram id>, response_body))

^这是我发送的键盘。

{'ok': True, 'result': {'message_id': 769, 'from': {'id': <>, 'is_bot': True, 'first_name': '<bot name>', 'username': '<bot username>'}, 'chat': {'id': <group chai id >, 'title': '<group title>', 'username': '<group username>', 'type': 'supergroup'}, 'date': 1594645500, 'text': 'CHALLENGE-\nChallenged by:<my username>\nBet:500', 'entities': [{'offset': 27, 'length': 8, 'type': 'text_mention', 'user': {'id': <id>, 'is_bot': False, 'first_name': '<my first name>', 'username': '<my username>', 'language_code': 'en'}}], 'reply_markup': {'inline_keyboard': [[{'text': 'call', 'callback_data': '10;open;;<my telegram id>;9 bets;<my username>'}]]}}}

^这里是response_body的发送确认。 第二个确认显然是我可以在手机上看到键盘。

1 个答案:

答案 0 :(得分:1)

问题出在电报方面。我更改了机器人令牌,并使用了键盘。