import asyncio import logging from os import getpid from libbot import sync from classes.pycordbot import PycordBot from modules.extensions_loader import dynamic_import_from_src from modules.scheduler import scheduler # Import required for uvicorn from api.app import app logging.basicConfig( level=logging.DEBUG if sync.config_get("debug") else logging.INFO, format="%(name)s.%(funcName)s | %(levelname)s | %(message)s", datefmt="[%X]", ) logger = logging.getLogger(__name__) async def main(): bot = PycordBot(scheduler=scheduler) bot.load_extension("cogs") # Import API modules dynamic_import_from_src("api.extensions", star_import=True) try: await bot.start(sync.config_get("bot_token", "bot")) except KeyboardInterrupt: logger.warning("Forcefully shutting down with PID %s...", getpid()) await bot.close() asyncio.create_task(main())