Ошибка message_handler: Commands filter should be list of strings

Рейтинг: 0Ответов: 0Опубликовано: 27.07.2023

Сама ошибка:

ERROR - TeleBot: "message_handler: Commands filter should be list of strings (commands), unknown type supplied to the 'commands' filter list. Not able to use the supplied type."

Она происходит после того, как вводится название товара.

В чём заключается проблема, если я передаю команды как список? Работоспособность функции get_data проверил, в ней точно нет проблем.

Код:

import config
import telebot


bot = telebot.TeleBot(config.token)

@bot.message_handler(commands=["start"])
def start(message):
    markup = telebot.types.ReplyKeyboardMarkup(resize_keyboard=True)
    button_A = telebot.types.KeyboardButton("Найти магазин с наименьшей ценой на товар")
    markup.row(button_A)
    bot.send_message(message.chat.id, config.greetings,reply_markup=markup)

@bot.message_handler(func=lambda message: message.text == 'Найти магазин с наименьшей ценой на товар')
def request_name_of_product(message):
    bot.send_message(message.chat.id, "Введите название товара")

@bot.message_handler(content_types=["text"])
def result(message):
    name = message.text
    data = get_data_magnit(name)
    for name,prices in data.items():
        s = f"Название продукта: {name}\nЦена без скидки: {prices['old_price']}\nЦена со скидкой: {prices['new_price']}" if type(prices) != str else prices
        bot.message_handler(message.chat.id,s)
bot.polling(none_stop=True)

Ответы

Ответов пока нет.