Created
March 22, 2016 14:55
-
-
Save ikaruce/2ee4088438bb45d25fbd to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'telegram_bot' | |
bot = TelegramBot.new(token: '193199186:AAFtN0tv35_AUxiWHvQvOQOLw-u-tsGtn6A') | |
bot.get_updates(fail_silently: true) do |message| | |
puts "@#{message.from.username}: #{message.text}" | |
command = message.get_command_for(bot) | |
message.reply do |reply| | |
case command | |
when /greet/i | |
reply.text = "Hello, #{message.from.first_name}!" | |
else | |
reply.text = "#{message.from.first_name}, have no idea what #{command.inspect} means." | |
end | |
puts "sending #{reply.text.inspect} to @#{message.from.username}" | |
reply.send_with(bot) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment