Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # -*- coding: utf-8 -*-
- import time
- import telepot
- def handler(msg):
- chat_id = msg['chat']['id']
- chat_message = msg['text']
- buttons = {'keyboard': [['Option #1', 'Option #2'], ['Option #3', 'Option #4']]}
- bot.sendMessage(chat_id, 'Main options', reply_markup=buttons)
- # Ex: Option #1 > You selected Option #1
- bot.sendMessage(chat_id, 'Main selected: %s' %chat_message)
- if chat_message == 'Option #1':
- sub_buttons = {'keyboard': [['Sub option #1_1', 'Sub option #1_2'], ['Sub option #1_3', 'Sub option #1_4']]}
- bot.sendMessage(chat_id, 'Sub options', reply_markup=sub_buttons)
- if chat_message == 'Sub option #1_1':
- bot.sendMessage(chat_id, 'Sub selected %s' %chat_message)
- # ...
- # ...
- bot = telepot.Bot('API KEY')
- bot.message_loop(handler)
- print('[+] started...')
- while 1:
- time.sleep(10)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement