Advertisement
Guest User

Untitled

a guest
Dec 15th, 2020
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1.  
  2. Telegram::Bot::Client.run(token) do |bot|
  3. bot.listen do |message|
  4. case message
  5. when Telegram::Bot::Types::CallbackQuery
  6. if message.data == 'touch'
  7. bot.api.send_message(chat_id: message.from.id, text: "Don't touch me!")
  8. end
  9.  
  10.  
  11. when Telegram::Bot::Types::Message
  12. kb = [
  13. Telegram::Bot::Types::InlineKeyboardButton.new(text: 'Touch me', callback_data: 'touch'),
  14. ]
  15.  
  16. markup = Telegram::Bot::Types::InlineKeyboardMarkup.new(inline_keyboard: kb)
  17. bot.api.send_message(chat_id: message.chat.id, text: 'Sorry to see you go :(', reply_markup: markup)
  18. when '/stop'
  19. bot.api.send_message(chat_id: message.chat.id, text: "Bye, #{message.from.first_name}")
  20. end
  21. end
  22. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement