GloryBot/main.py
2024-05-01 21:15:35 +02:00

35 lines
825 B
Python

import asyncio
import logging
from os import getpid
from discord import Intents
from libbot import sync
from classes.pycordbot import PycordBot
from modules.scheduler import scheduler
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, intents=Intents.all())
bot.load_extension("cogs")
try:
await bot.start(sync.config_get("bot_token", "bot"))
except KeyboardInterrupt:
logger.warning("Forcefully shutting down with PID %s...", getpid())
await bot.close()
if __name__ == "__main__":
loop = asyncio.get_event_loop()
loop.run_until_complete(main())