GloryBot/main.py

40 lines
948 B
Python
Raw Normal View History

2024-05-01 22:15:35 +03:00
import asyncio
import logging
from os import getpid
from discord import Intents
from libbot import sync
2024-06-02 22:51:07 +03:00
from classes.pycord_bot import PycordBot
2024-05-01 22:15:35 +03:00
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():
2024-06-02 22:51:07 +03:00
# Define the bot's intents
intents = Intents.default()
intents.members = True
# Create a bot connection object
bot = PycordBot(scheduler=scheduler, intents=intents)
2024-05-01 22:15:35 +03:00
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())