Answer the question
In order to leave comments, you need to log in
How to fix TypeError: message_handler() got an unexpected keyword argument 'commands' error?
import telebot
bot = telebot.TeleBot('token')
@bot.message_handler(commands=['start'])
def start_message(message):
bot.send_message(message.chat.id, "Привет")
@bot.message_handler(content_types=['text'])
def get_text_messages(message):
if message.text == "Привет":
bot.send_message(message.chat.id, "Привет, чем я могу тебе помочь?")
elif message.text == "/help":
bot.send_message(message.chat.id, "Напиши привет")
else:
bot.send_message(message.chat.id, "Я тебя не понимаю. Напиши /help.")
if __name__ == "name":
bot.infinity_polling()
Traceback (most recent call last):
File "C:\Users\Пользователь\PycharmProjects\pythonProject2\telebot1.py", line 6, in <module>
@bot.message_handler(commands=['start'])
TypeError: message_handler() got an unexpected keyword argument 'commands'
Process finished with exit code 1
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question