为了理解telegram-bot语法,我在chrome浏览器中抛出了一个telegram-cli。我在手机上看到会发生什么,并在浏览器中看到响应。 我坚持对来自在线键盘按钮点击的回调回答做出回应。
以下是步骤:
发送在线键盘 - >这有效
https://api.telegram.org/bot<token>/sendMessage?chat_id=
<chat_id_nr>&text=How%20are%20you&reply_markup=
{"inline_keyboard":k[[{"text":"Fine","callback_data":"great"}],
[{"text":"fine1","callback_data":"great1"},
{"text":"fine2","callback_data":"great2"}]]}
点击在线键盘上的一个键。
在浏览器中获取回复,如下所示:
{
ok: true,
result: [
{
update_id: **********,
callback_query: {
id: "10665788123459204304",
from: {
id: *********,
- &GT;等等
4.现在我想发送https://core.telegram.org/bots/api#answercallbackquery"
中提到的回复查询
当我发送:
https://api.telegram.org/bot<bot>/answerCallbackQuery?
{[{"callback_query_id":"10665788123459204304", "text"=ok, "show_alert"=true}]}
得到了这个答案:
{
ok: false,
error_code: 400,
description: "Bad Request: QUERY_ID_INVALID"
}
是的,我知道你必须在内联键盘按钮点击后15秒内回答。
我知道这对专家来说是件小事,但对我来说,我是在拉我的头发。
提前致谢。 (大胆的头,到现在为止)
答案 0 :(得分:0)
Found it, this must be the answer:
https://api.telegram.org/bot(bot.token)/answerCallbackQuery?callback_query_id=1066578811231371872
The answer has to be send back in a few seconds. I dit copy/pased within 10 seconds but that seems to be to long.
Putting it all together in a bash script, answered it in aan few seconds and that was all. The solution can be so close.