Sha256: 6298496671e75815ba9e2f8f9a959aec859149a49071005ce47605965b747456

Contents?: true

Size: 514 Bytes

Versions: 6

Compression:

Stored size: 514 Bytes

Contents

require 'rubygems'
require 'telegram/bot'

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.sendMessage(chat_id: message.chat.id, text: "Hello, #{message.from.first_name}!")
    when '/end'
      bot.api.sendMessage(chat_id: message.chat.id, text: "Bye, #{message.from.first_name}!")
    else
      bot.api.sendMessage(chat_id: message.chat.id, text: "I don't understand you :(")
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
telegram-bot-ruby-0.3.4 examples/bot.rb
telegram-bot-ruby-0.3.3 examples/bot.rb
telegram-bot-ruby-0.3.2 examples/bot.rb
telegram-bot-ruby-0.3.1 examples/bot.rb
telegram-bot-ruby-0.3.0 examples/bot.rb
telegram-bot-ruby-0.2.6 examples/bot.rb