telegram - 内联机器人不显示任何内容
问题描述
我尝试设置一个只发送一张图片供用户查询的内联机器人。
一切似乎都在工作,但机器人在应用程序中没有显示任何结果,甚至我给他的 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=БОТ');
解决方案
在我的情况下,它是以switch_pm_text
某种方式阻止 API 请求的参数。
推荐阅读
- java - com.fasterxml.jackson.databind.exc.MismatchedInputException:无法从 START_OBJECT 令牌中反序列化 `java.lang.String` 的实例
- spring-boot - Springdoc-ui + GraalVM 原生 @Configuration 类问题
- sql - SQL - 如何从表中的 XML 字段中提取多个属性
- powerbi-embedded - PowerBI Embed Service Principal 为有效 ID 嵌入令牌生成错误
- asp.net-core - asp.net core IConfiguration 的内存占用
- c++ - 使用 chrono 库获取系统时间不准确
- angular - 离子如何等待服务完成
- wordpress - 从子目录中的任何路径重定向到不同的网站
- javascript - 如何使用图表 Js 查找每年的项目总和
- python - 字符串之间的空间