Api
Api copied to clipboard
answerInlineQuery not working?
$bot->inlineQuery(function($update) use ($bot){
$content = new \TelegramBot\Api\Types\Inline\InputMessageContent\Text('*Test*', 'html');
$result = new \TelegramBot\Api\Types\Inline\QueryResult\Article(time(),'Title', null,null,null,null, $content);
$bot->answerInlineQuery($update->getId(), $result);
$bot->sendMessage(808542421, $update->getid().$update->getQuery()); //FOR TESTING
});
No matter how much I test, no error, no result. sendMessage send inline query id, and query the itself.
But $bot->answerInlineQuery don't do anything. Also code in bottom works good.
$inlineResult = [
[
"type" => "article",
"id" => time(),
"title" => "Title",
"input_message_content" => [
"message_text" => "*Test*",
"parse_mode" => "Markdown",
],
] ];
$uqid = $update->getid();
file_get_contents("https://api.telegram.org/bottoken/answerInlineQuery?inline_query_id$uqid&results=".json_encode($inlineResult));
@maksutovnurda You should pass an array of results, see https://core.telegram.org/bots/api#answerinlinequery This will work:
$bot->answerInlineQuery($update->getId(), [$result]);