Advertisement
Guest User

Untitled

a guest
Jan 24th, 2017
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. require 'telegram/bot'
  2.  
  3. token = ''
  4.  
  5. Telegram::Bot::Client.run(token) do |bot|
  6.  
  7. bot.listen do |message|
  8. #case message.text
  9. case message
  10. when Telegram::Bot::Types::Message
  11. bot.api.send_message(chat_id: message.chat.id, text: "Hello, #{message.from.first_name}!")
  12. break
  13. case message.text
  14. when '/photo'
  15. bot.api.send_photo(chat_id: message.chat.id, photo: Faraday::UploadIO.new('/home/iceice/Work/telegram/robot/image/404.jpg', 'image/jpeg'))
  16. end
  17. end
  18. end
  19. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement