answerInlineQuery已成功发送,但实际上没有结果

时间:2019-07-01 12:09:42

标签: telegram-bot

我有用于inlineQuery的代码:

    在BotFather中打开了
  • 内联模式
  • 正确接收到带有InlineQuery的webhooks
  • answerInlineQuery的结果是:$result_search = "SELECT * FROM insects WHERE '$level' LIKE '%$search%';

在Bots.Business上编写的Bot JavaScript代码(BJS):

{ "ok": true, "result": true }

/ trackResult命令(在answerInlineQuery方法之后处理):

results = [];
item = {
  type: "article",
  id: "13",
  title: "Test item",
  input_message_content: { "message_text": "this is text" }
}
results.push(item);

Api.answerInlineQuery({
  inline_query_id: request.id,
  results: results,
  cache_time: 0,
  on_result: "/trackResult"
})

在错误日志中(我只是将成功通知记录为错误):

correct response from Telegram Api

因此:answerInlineQuery已发送,但在电报聊天中实际上没有任何内联结果

1 个答案:

答案 0 :(得分:0)

results = [];
item = {
  type: "article",
  id: "13",
  title: "Test item",
  input_message_content: '{ "message_text": "this is text" }'
}
results.push(item);

Api.answerInlineQuery({
  inline_query_id: request.id,
  results: results,
  cache_time: 0,
  on_result: "/trackResult"
})

需要将input_message_content作为字符串传递