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.18.0 examples/bot.rb
telegram-bot-ruby-0.17.0 examples/bot.rb
telegram-bot-ruby-0.16.0 examples/bot.rb
telegram-bot-ruby-0.15.0 examples/bot.rb
telegram-bot-ruby-0.14.0 examples/bot.rb
telegram-bot-ruby-0.13.0 examples/bot.rb
telegram-bot-ruby-0.12.0 examples/bot.rb
telegram-bot-ruby-0.11.0 examples/bot.rb
telegram-bot-ruby-0.10.1 examples/bot.rb
telegram-bot-ruby-0.10.0 examples/bot.rb
telegram-bot-ruby-0.9.1 examples/bot.rb
telegram-bot-ruby-0.9.0 examples/bot.rb
dialog_bot_ruby-0.8.8 examples/bot.rb
dialog_bot_ruby-0.8.7 examples/bot.rb
telegram-bot-ruby-0.8.6.1 examples/bot.rb
telegram-bot-ruby-0.8.6 examples/bot.rb
telegram-bot-ruby-0.8.5 examples/bot.rb
telegram-bot-ruby-0.8.4 examples/bot.rb
telegram-bot-ruby-0.8.3 examples/bot.rb
telegram-bot-ruby-0.8.2 examples/bot.rb