首页 > 解决方案 > 内联机器人不显示任何内容

问题描述

我尝试设置一个只发送一张图片供用户查询的内联机器人。

一切似乎都在工作,但机器人在应用程序中没有显示任何结果,甚至我给他的 switch_pm_text 也没有。我想我以某种方式弄乱了results数组?我正确解析了所有来自 Telegram 的传入内容,即我看到查询 ID 和查询本身,图像搜索正常,但没有任何内容作为答案发送到 Telegram...

这是我的代码:

$search_result = json_decode(file_get_contents('https://www.googleapis.com/customsearch/v1?key=blahblah&q='.urlencode($queue).'&num=1&searchType=image&safe=off&fileType=jpg'), TRUE);  
$image = $search_result['items'][0]['link'];
$thumb = $search_result['items'][0]['image']['thumbnailLink'];

$image_to_send = array(array(
    'type' => 'photo',
    'id' => '1',
    'photo_url' => $image,
    'thumb_url' => $thumb
));

file_get_contents($GLOBALS['api'].'/answerInlineQuery?inline_query_id='.$queryid.'&results='.json_encode($image_to_send).'&switch_pm_text=БОТ');

标签: telegramtelegram-botphp-telegram-bot

解决方案


在我的情况下,它是以switch_pm_text某种方式阻止 API 请求的参数。


推荐阅读