2

Телеграм отвечает мне {"ok"=>true, "result"=>true} и даже показывает кнопку «перейти в приват», но не показывает мне никаких результатов в инлайн режиме. Кажется мне, что проблема в том, как я формирую results, но почему тогда я получаю ок, а не 400, может кто-то знает рабочий пример или понимает в чём проблема? Вот кусок кода:

Telegram::Bot::Client.run(token) do |bot|
  bot.listen do |message|

    case message
    when Telegram::Bot::Types::Message
      puts "Message @#{message.from.username}: #{message.text}"
      bot.api.send_message(chat_id: message.chat.id, text: "I am only inline bot for now" )
    when Telegram::Bot::Types::InlineQuery
      puts " InlineQuery @#{message.from.username}: #{message.query} and #{message.id}"

      results = [ JSON.parse('{"type":"article", "id":"0", "title":"Cool Blog", "message_text":"I am the author of this bot, please visit my blog"}'), JSON.parse('{"type":"article", "id":"1", "title":"Cool Blog", "message_text":"I am the author of this bot, please visit my blog"}')] 
      puts bot.api.answer_inline_query(inline_query_id: message.id, results: results, switch_pm_text:"PM me please", cache_time: 86400)
    end

  end
end
2
  • 6
    This site is for questions in Russian only. You can either translate the question or ask it at stackoverflow.com 14 апр 2016 в 10:46
  • Спасибо, переписал 14 апр 2016 в 14:38

1 ответ 1

1

Обновите версию гема, текущая 0.5, заработает gem install 'telegram-bot-ruby'

1

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge you have read our privacy policy.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками или задайте свой вопрос.