import asyncio from typing import Optional from cpl_core.application import ApplicationBuilder from bot.application import Application from bot.startup import Startup from bot.startup_discord_extension import StartupDiscordExtension from bot.startup_migration_extension import StartupMigrationExtension from modules.boot_log.boot_log_extension import BootLogExtension from modules.database.database_extension import DatabaseExtension class Main: def __init__(self): self._app: Optional[Application] = None async def main(self): app_builder = ApplicationBuilder(Application) app_builder.use_extension(StartupDiscordExtension) app_builder.use_extension(StartupMigrationExtension) app_builder.use_extension(BootLogExtension) app_builder.use_extension(DatabaseExtension) app_builder.use_startup(Startup) self._app: Application = await app_builder.build_async() await self._app.run_async() async def stop(self): await self._app.stop_async() if __name__ == '__main__': main = Main() try: asyncio.run(main.main()) except KeyboardInterrupt: asyncio.run(main.stop()) # (( # ( `) # ; / , # / \/ # / | # / ~/ # / ) ) ~ edraft # ___// | / # `--' \_~-,