api - QUERY_ID_INVALID - Telegram 内联机器人

标签 api inline bots telegram telegram-bot

我对使用 Telegram API 的内联机器人有问题...

我有代码:

$json = file_get_contents("php://input");
$dados = json_decode($json,true);
$id_query = $dados['inline_query']['id'];

$resultados_inline[] = [
                            'type'  => 'article',
                            'id'    => "1",
                            'title' => "Test",
                            'message_text' => "test",
                        ];

$post[] = [
        'inline_query_id' => $id_query,
        'results'   => serialize($resultados_inline),           
    ];

$context_options = array(
    'http' => array(
        'method' => 'POST',
        'header'=> "Content-type: application/x-www-form-urlencoded\r\n"
            . "Content-Length: " . strlen($post) . "\r\n",
        'content' => $post
        )
    );

file_get_contents("https://api.telegram.org/bot" . $api_telegram . "/answerInlineQuery",NULL,$context);

但我收到:

{"ok":false,"error_code":400,"description":"BadRequest:QUERY_ID_INVALID"}

有人可以帮帮我吗?

谢谢

最佳答案

我搜索了这个问题,并从机器人支持那里得到了这个答案:

"inline queries require a fast answer, if the answer is delayed, you may get that error and the answer won't be valid. I suggest you to answer faster to them in order to make them work."

我只是停止使用调试器模式并且一切正常,这是对 UX 的 API 限制。

关于api - QUERY_ID_INVALID - Telegram 内联机器人,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37234140/

相关文章:

Java Youtube api 评分评论

Facebook Messenger 平台发送本地镜像附件

bots - 假装 Telegram Bot 正在打字?

bots - 如何找到 Telegram Bot 的所有者?

php - 具有自动登录功能的 Salesforce PHP REST API

django-tastypie : why are api keys useful and how to support multiple auth schemes?

javascript - 如何将使用 Facebook API 阅读的书籍拉到网站?

forms - 内嵌表单输入和提交按钮在屏幕宽度 < 576 px 时未对齐

css - 正则表达式:用 BB 代码替换内联 CSS

css - 从内联 HTML 电子邮件中删除 header CSS 规则是否安全?