如何在此结果中获取ChosenInlineResult? : 我正在使用PHP,这是我的发送结果页面
$results = array(
array(
"type" => "article",
"id" => "1",
"title" => "aaaa",
"description" => "bbbb",
"input_message_content" => array(
"message_text" => "mt",
"parse_mode" => "HTML"
),"reply_markup" => array('inline_keyboard' => ($keyboardx))
)
);
$data = array(
"inline_query_id" => $qid,
"results" => json_encode($results),
"cache_time" => 0
);
$data_string = json_encode($data);
$ch = curl_init('https://api.telegram.org/'.$token.'/answerInlineQuery');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'Content-Length: ' . strlen($data_string))
);
$result = curl_exec($ch);
file_put_contents("res.txt",$result,FILE_APPEND);
这里我将保存返回的数据在res.txt
中答案 0 :(得分:4)
您需要转到BotFather并将/setinlinefeedback
设置为Enabled
才能收到ChosenInlineResult
。之后,当InlineQueryResult
被选中时,您会收到ChosenInlineResult
的消息。
{
"update_id" : 123456789,
"chosen_inline_result" : {
//[...]
}
}