Почему не работает многоступенчатое меню в боте телеграм?

Есть такой код. Не работает, а точнее не появляется меню ни с категорией товаров, ни с производителями товаров и ТД. Помогите пожалуйстаирншить проблему, заказ ждет. Использовать другие библиотеки нет желания, надеюсь только на telebot.
import telebot
import config

bot = telebot.TeleBot(config.token)

@bot.message_handler(content_types=['text', 'document'])
def kt(message):
	key = types.ReplyKeyboardMarkup(resize_keyboard=True)
	key.row(types.KeyboardButton('Магнитолы'))
	key.row(types.KeyboardButton('Усилители'))
	key.row(types.KeyboardButton('Акустика'))
	key.row(types.KeyboardButton('Эстрадная акустика'))
	key.row(types.KeyboardButton('Сабвуферы'))
	key.row(types.KeyboardButton('Назад'))
	bot.send_message(message.chat.id, 'Выберите категорию товара')

@bot.message_handler(commands=['katalog']
def katalog(message):
	if message.text == 'Магнитолы':
		key = types.ReplyKeyboardMarkup(resize_keyboard=True)
		key.row(types.KeyboardButton('ACES'))
		key.row(types.KeyboardButton('ACV'))
		key.row(types.KeyboardButton('ALPINE'))
		key.row(types.KeyboardButton('AURA'))
		key.row(types.KeyboardButton('AVATAR'))
		key.row(types.KeyboardButton('CLARION'))
		key.row(types.KeyboardButton('Назад'))
		bot.send_message(message.chat.id, 'Выберите производителя')
		
	elif message.text == 'Акустика':
		key = types.ReplyKeyboardMarkup(resize_keyboard=True)
		key.row(types.KeyboardButton('ACV'))
		key.row(types.KeyboardButton('AIRTONE'))
		key.row(types.KeyboardButton('ALPHARD'))
		key.row(types.KeyboardButton('ALPINE'))
		key.row(types.KeyboardButton('ARIA'))
		key.row(types.KeyboardButton('AUDIO SYSTEM'))
		key.row(types.KeyboardButton('Назад'))
		bot.send_message(message.chat.id, 'Выберите производителя')
  • Вопрос задан
  • 814 просмотров
Решения вопроса 1
@AlmazKayum
Ответ прост:
В методах send_message нужно добавить аргумент reply_markup=key
без этого клавиатурный объект не отправиться вместе с сообщением

и еще
key.row('Магнитолы')
key.row('ALPINE')

так проще
Ответ написан
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы