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.8.1 examples/bot.rb
telegram-bot-ruby-0.8.0 examples/bot.rb
telegram-bot-ruby-0.7.2 examples/bot.rb
telegram-bot-ruby-0.7.1 examples/bot.rb
telegram-bot-ruby-0.7.0 examples/bot.rb
telegram-bot-ruby-0.6.0.2 examples/bot.rb
telegram-bot-ruby-0.6.0.1 examples/bot.rb
telegram-bot-ruby-0.5.3 examples/bot.rb
telegram-bot-ruby-0.5.2 examples/bot.rb
telegram-bot-ruby-0.5.1 examples/bot.rb
telegram-bot-ruby-0.5.0 examples/bot.rb
telegram-bot-ruby-0.5.0.beta4 examples/bot.rb
telegram-bot-ruby-0.5.0.beta3 examples/bot.rb
telegram-bot-ruby-0.5.0.beta2 examples/bot.rb
telegram-bot-ruby-0.5.0.beta1 examples/bot.rb
telegram-bot-ruby-0.4.2 examples/bot.rb
telegram-bot-ruby-0.4.1 examples/bot.rb
telegram-bot-ruby-0.4.0 examples/bot.rb
telegram-bot-ruby-0.3.11 examples/bot.rb
telegram-bot-ruby-0.3.10 examples/bot.rb