I
I
Iskander Shakirov2022-01-06 23:50:34
Python
Iskander Shakirov, 2022-01-06 23:50:34

Telebot doesn't allow "commands" commands?

It gives an error: TeleBot.message_handler() got an unexpected keyword argument 'commands'
Searching the Internet did not find an answer, please help
Here is the code

import telebot
from telebot import types

bot = telebot.TeleBot("5031767148:AAFW3rMKl1cFOS-EALaPxVNhPVD1PsJenQQ")

@bot. message_handler(commands=['start'])
def start_message(message):
bot.send_message(message.chat.id, "Hello ✌️")

bot.infinity_poling()

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Ananchenko, 2022-01-07
@IskanderSh

@bot.message_handler(commands = ['start'])
def start(message):
    bot.send_message(message.chat.id, "Привет ✌️ ")

Your tab is not respected, this is the first one, and the fact that it gives such an error is bad, maybe you have the wrong module installed
There are 2 modules that are imported as telebot
The one you are trying to use is called pytelegrambotapi and you most likely installed telebot
pip uninstall telebot
pip install pytelegrambotapi

Try to remove telebot and install the correct one

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question