Код: Выделить всё
2024-10-26 12:07:46,918 (init.py:7144 MainThread) ERROR - TeleBot: "message_handler: Commands filter should be list of strings (commands), unknown type supplied to the 'commands' filter list. Not able to. return message.content_type == 'text' and util.extract_command(message.text) in filter_value TypeError: argument of type 'function' is not iterableКод: Выделить всё
use the supplied type."Код: Выделить всё
@bot.message_handler(commands=['start'])
def send_welcome(message):
user_id = message.from_user.id
markup = types.ReplyKeyboardMarkup(row_width=2)
buttons = [
'💰 Баланс',
'📊 Торговля',
'📈 Курсы',
'📝 Мои ордера',
'💳 Пополнить',
'💸 Вывести',
'⚙️ Настройки',
'❓ Помощь'
]
markup.add(*[types.KeyboardButton(button) for button in buttons])
bot.reply_to(message,
"Добро пожаловать",
reply_markup=markup)
@bot.message_handler(func=lambda message: message.text == '💰 Баланс')
def show_balance(message):
user_id = message.from_user.id
response = "💰 Ваш баланс: 20"
bot.reply_to(message, response)
the show_balance function runs without problems
@bot.message_handler(func=lambda message: message.text == '❓ Помощь')
def show_help(message):
help_text = "0"
bot.reply_to(message, help_text)
the show_help function causes an error without problems
Ошибка:
2024-10-26 12:07:46,918 (init.py:7144 MainThread) ОШИБКА - TeleBot: "message_handler: Фильтр команд должен представлять собой список строк (команд), неизвестный тип, указанный для список фильтров «команды». Невозможно использовать предоставленный тип
return message.content_type == «text» и util.extract_command(message.text) в filter_value
TypeError: аргумент типа «функция». не является итеративным.
Подробнее здесь: https://stackoverflow.com/questions/791 ... -of-type-f
Мобильная версия