Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Telegram::Bot::Client.run(token) do |bot|
- bot.listen do |message|
- case message
- when Telegram::Bot::Types::CallbackQuery
- if message.data == 'touch'
- bot.api.send_message(chat_id: message.from.id, text: "Don't touch me!")
- end
- when Telegram::Bot::Types::Message
- kb = [
- Telegram::Bot::Types::InlineKeyboardButton.new(text: 'Touch me', callback_data: 'touch'),
- ]
- markup = Telegram::Bot::Types::InlineKeyboardMarkup.new(inline_keyboard: kb)
- bot.api.send_message(chat_id: message.chat.id, text: 'Sorry to see you go :(', reply_markup: markup)
- when '/stop'
- bot.api.send_message(chat_id: message.chat.id, text: "Bye, #{message.from.first_name}")
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement