gpt4 book ai didi

php - TELEGRAMBOT 如何获取 ChosenInlineResult

转载 作者:行者123 更新时间:2023-12-02 04:07:57 25 4
gpt4 key购买 nike

如何在这个结果中获取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 中

最佳答案

您需要前往 BotFather 并将 /setinlinefeedback 设置为 Enabled 才能接收 ChosenInlineResult。之后,当选择 InlineQueryResult 时,您将收到一条包含 ChosenInlineResult 的消息。

{
"update_id" : 123456789,
"chosen_inline_result" : {
//[...]
}
}

关于php - TELEGRAMBOT 如何获取 ChosenInlineResult,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38482817/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com