F
F
First Second2020-12-14 20:22:18
Python
First Second, 2020-12-14 20:22:18

Do you get an error when sending a message to a bot?

Hello. There is the following code:

bot = telebot.TeleBot(token)

class Bot:

    def __init__(self, four_digits=None, amount='1 390,00 руб.', platform=None):
        self.four_digits = four_digits
        self.amount = amount
        self.platform = platform

    @bot.message_handler(commands=['start'])
    def start(self, message):
        bot.send_animation(message.chat.id, 'CAACAgIAAxkBAAJ7kV_QyCsjcwiMuROqR-cyXPuBy16OAAJMAgACygMGCxJWY4NsIlRSHgQ')
        msg = bot.send_message(message.chat.id, START_TEXT, reply_markup=keyboard1)
        bot.register_next_step_handler(msg, self.process_step)
        bot.clear_step_handler(msg)

def main():
    kino_bot = KinoBot()
    bot.polling(none_stop=True)


if __name__ == '__main__':
    main()


When sending /start to the bot, I catch the following error:
2020-12-14 20:20:22,603 (util.py:68 WorkerThread3) ERROR - TeleBot: "TypeError occurred, args=("start() missing 1 required positional argument: 'message'",)
Traceback (most recent call last):
  File "C:\Users\user\AppData\Local\Programs\Python\Python38\lib\site-packages\telebot\util.py", line 62, in run
    task(*args, **kwargs)
TypeError: start() missing 1 required positional argument: 'message'
"
Traceback (most recent call last):
  File "D:/Projects/pythonProject1/main.py", line 246, in <module>
    main()
  File "D:/Projects/pythonProject1/main.py", line 242, in main
    bot.polling(none_stop=True)
  File "C:\Users\user\AppData\Local\Programs\Python\Python38\lib\site-packages\telebot\__init__.py", line 427, in polling
    self.__threaded_polling(none_stop, interval, timeout)
  File "C:\Users\user\AppData\Local\Programs\Python\Python38\lib\site-packages\telebot\__init__.py", line 451, in __threaded_polling
    self.worker_pool.raise_exceptions()
  File "C:\Users\user\AppData\Local\Programs\Python\Python38\lib\site-packages\telebot\util.py", line 111, in raise_exceptions
    six.reraise(self.exc_info[0], self.exc_info[1], self.exc_info[2])
  File "C:\Users\user\AppData\Local\Programs\Python\Python38\lib\site-packages\six.py", line 703, in reraise
    raise value
  File "C:\Users\user\AppData\Local\Programs\Python\Python38\lib\site-packages\telebot\util.py", line 62, in run
    task(*args, **kwargs)
TypeError: start() missing 1 required positional argument: 'message'


I am sure that somehow I am not correctly collecting the Class of the bot. Can't find an error. Help plz.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question