Sha256: 6620f4c4f2b22dfae1075b10f9f24ed10ea666dbf48db11f71ace6bb64e39828

Contents?: true

Size: 517 Bytes

Versions: 45

Compression:

Stored size: 517 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.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

Version data entries

45 entries across 45 versions & 2 rubygems

Version Path
telegram-bot-ruby-0.3.9 examples/bot.rb
telegram-bot-ruby-0.3.8 examples/bot.rb
telegram-bot-ruby-0.3.7 examples/bot.rb
telegram-bot-ruby-0.3.6 examples/bot.rb
telegram-bot-ruby-0.3.5 examples/bot.rb