Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import telebot
- from telebot import InlineKeyboardMarkup, InlineKeyboardButton
- bot = telebot.TeleBot('1331182453:AAFJnouzpJeoi5jYKK8EddDFJ-t8ZI8bilc')
- keyboardMain = InlineKeyboardMarkup()
- keyboardMain.row_width = 1
- keyboardMain.add(InlineKeyboardButton("Раздел 1", callback_data="section1"))
- keyboardBt = InlineKeyboardMarkup()
- keyboardBt.row_width = 1
- keyboardBt.add(InlineKeyboardButton("Кнопка 1", callback_data="bt1"))
- @bot.message_handler(commands=['start'])
- def start(message):
- bot.send_message(message.chat.id, 'Привет очередной.', reply_markup=keyboards.keyboardMain)
- @bot.callback_query_handler(func=lambda call: True)
- def callback_query(call):
- if call.data == 'section1':
- msg = bot.send_message(call.from_user.id, 'текст', reply_markup=keyboardBt)
- bot.register_next_step_handler(msg, button)
- print(call.data)
- def button(call):
- print(call.data)
- if call.data == 'bt1':
- bot.send_message(call.from_user.id, 'какой-то текст')
- bot.polling()
Advertisement
Add Comment
Please, Sign In to add comment