examples/bot.rb in telegram-bot-ruby-0.21.1 vs examples/bot.rb in telegram-bot-ruby-0.22.0

- old
+ new

@@ -5,15 +5,18 @@ token = 'replace-me-with-your-real-token' Telegram::Bot::Client.run(token) do |bot| bot.listen do |message| - case message.text - when '/start' - bot.api.send_message(chat_id: message.chat.id, text: "Hello, #{message.from.first_name}!") - when '/end' - bot.api.send_message(chat_id: message.chat.id, text: "Bye, #{message.from.first_name}!") - else - bot.api.send_message(chat_id: message.chat.id, text: "I don't understand you :(") + case message + when Telegram::Bot::Types::Message + case message.text + when '/start' + bot.api.send_message(chat_id: message.chat.id, text: "Hello, #{message.from.first_name}!") + when '/end' + bot.api.send_message(chat_id: message.chat.id, text: "Bye, #{message.from.first_name}!") + else + bot.api.send_message(chat_id: message.chat.id, text: "I don't understand you :(") + end end end end