[英]PHP Telegram bot answerInlineQuery not working
I'm adding inline function to my bot. 我正在向机器人添加内联函数。 I'm using PHP only. 我只使用PHP。 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? 我必须输入什么ID? Thanks 谢谢
This error usually occurs because you answer the request longer than 7-8 seconds after user type something to your inline bot. 通常会发生此错误,因为您在用户向内联漫游器键入内容后回答请求的时间超过了7-8秒。 Try to answer less than 3 seconds 尝试回答少于3秒
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.