A
A
anijack2021-11-04 10:49:36
Python
anijack, 2021-11-04 10:49:36

How to use library decorators inside a class?

I need to use a decorator inside a class. I tried to do it via self.bot, however it was not successful:

import telebot

class Bot:
    def __init__(self, token):
        self.bot = telebot.TeleBot(token)

    @self.bot.message_handler(content_types=['text'])
    def start(message):
        pass

Please help me with this problem

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