dongxieyi9115 2016-12-28 19:57
浏览 106

PHP Telegram bot answerInlineQuery无法正常工作

I'm adding inline function to my bot. I'm using PHP only. I wrote this and it seems good to me:

$content = file_get_contents("php://input");

$update = json_decode($content, true);

$inlineQuery = isset($update["inline_query"]) ? $update["inline_query"] : "";


if ($inlineQuery["query"] !== "" ) {
    $queryId = $inlineQuery["id"];
    $collection = array(
          "type" => "article",
          "id" => $queryId,
          "title" => "prov",
          "input_message_content" =>   array( "message_text" => "ciao") ,
        );

    $parameters =  array(
    "inline_query_id" => $queryId,
    "results" => $collection,
    );

    $parameters["method"] = "answerInlineQuery";

}

echo json_encode($parameters);

I get this error:

{"ok":false,"error_code":400,"description":"Bad Request: QUERY_ID_INVALID"}

What do I have to put in id? Thanks

  • 写回答

1条回答 默认 最新

  • doutui4649 2017-09-01 14:01
    关注

    This error usually occurs because you answer the request longer than 7-8 seconds after user type something to your inline bot. Try to answer less than 3 seconds

    评论

报告相同问题?

悬赏问题

  • ¥20 怎么用dlib库的算法识别小麦病虫害
  • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
  • ¥15 java写代码遇到问题,求帮助
  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?
  • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算