我正在尝试使用php为电报创建一个内联bot。我已经跟随了Bot Bot的步骤。我已经创建了bot,取得了令牌,设置并设置了占位符消息。我设置了webhook,它正在工作。但是当我在消息中输入机器人时,我什么也得不到,如果我发送消息,就什么都没有发生。 webhook正在工作,我用普通的消息试了一下。Telegram Inline Bot没有显示任何内联
这是我的代码,过了一段时间我只是放弃并从博客中获取它,编辑了一下。
$content = file_get_contents("php://input");
$update = json_decode($content, true);
$chatID = $update["message"]["chat"]["id"];
//sendMessage(print_r($update,true), $chatID);
if (isset($update["inline_query"])) {
$inlineQuery = $update["inline_query"];
$queryId = $inlineQuery["id"];
$queryText = $inlineQuery["query"];
if (isset($queryText) && $queryText !== "") {
apiRequestJson("answerInlineQuery", [
"inline_query_id" => $queryId,
"results" => ($queryText),
"cache_time" => 86400,
]);
}
else {
apiRequestJson("answerInlineQuery", [
"inline_query_id" => $queryId,
"results" => [
[
"type" => "article",
"id" => "0",
"title" => "TEST",
"message_text" => "TEST",
],
]
]);
}
}
机器人仍然没有显示任何东西。 我想我只是跳了一步。
Bot API对您的回应是什么? – ihoru
@ihoru什么都没有。不给我什么。 –