GloryBot/main.py
2024-06-02 21:51:07 +02:00

40 lines
948 B
Python

import asyncio
import logging
from os import getpid
from discord import Intents
from libbot import sync
from classes.pycord_bot 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():
# Define the bot's intents
intents = Intents.default()
intents.members = True
# Create a bot connection object
bot = PycordBot(scheduler=scheduler, intents=intents)
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())