πŸ”ƒCallback functions

The module has several colback functions that are called as they are initialized:

  • def on_init - Called after Stage2, due to the peculiarities of asynchronous programming the availability of the database is not guaranteed

  • async def on_db_ready - Called immediately after full database initialization, useful to use if you need to work with the database immediately after startup

Example usage:

async def on_db_ready(self):
    async with self.db.session_maker() as session:
        # load chat states from database

Last updated