Initial commit with code

This commit is contained in:
2025-04-16 18:39:03 +02:00
parent fcaa3263cb
commit cf0d4bd18f
24 changed files with 576 additions and 18 deletions

42
main.py Normal file
View File

@@ -0,0 +1,42 @@
import asyncio
import contextlib
import logging.config
from logging import Logger
from os import getpid, makedirs
from pathlib import Path
# Import required for uvicorn
from libbot.utils import config_get
from classes.pycord_bot import PycordBot
from modules.logging_utils import get_logging_config, get_logger
from modules.scheduler import scheduler
makedirs(Path("logs/"), exist_ok=True)
logging.config.dictConfig(get_logging_config())
logger: Logger = get_logger(__name__)
# Try to import the module that improves performance
# and ignore errors when module is not installed
with contextlib.suppress(ImportError):
import uvloop
uvloop.install()
async def main():
bot = PycordBot(scheduler=scheduler)
bot.load_extension("cogs")
try:
await bot.start(config_get("bot_token", "bot"))
except KeyboardInterrupt:
logger.warning("Forcefully shutting down with PID %s...", getpid())
await bot.close()
if __name__ == "__main__":
asyncio.create_task(main())