Discord-Raid-bot/bot.py

49 lines
1.1 KiB
Python
Raw Normal View History

2025-08-26 17:35:54 +00:00
# -*- coding: utf-8 -*-
2025-08-22 13:25:34 +00:00
import os
import discord
from discord.ext import commands
from config import DISCORD_TOKEN
2025-08-26 17:35:54 +00:00
# Import des managers
2025-08-22 13:25:34 +00:00
from utils.DatabaseManager_class import DatabaseManager
from utils.ScreenshotManager_class import ScreenshotManager
2025-08-26 17:35:54 +00:00
# Définir les intents
2025-08-22 13:25:34 +00:00
intents = discord.Intents.default()
2025-08-26 13:02:34 +00:00
intents.message_content = True
2025-08-26 17:35:54 +00:00
2025-08-22 13:25:34 +00:00
bot = commands.Bot(command_prefix="!", intents=intents)
2025-08-26 17:35:54 +00:00
# Initialisation unique des managers
2025-08-22 13:25:34 +00:00
db_manager = DatabaseManager()
screenshot_manager = ScreenshotManager()
2025-08-26 17:35:54 +00:00
# Liste des Cogs à charger
2025-08-22 13:25:34 +00:00
initial_cogs = [
"cogs.guide",
"cogs.pbhydra",
"cogs.pbchimera",
"cogs.pbcvc",
"cogs.top10",
"cogs.mystats",
2025-08-24 08:21:54 +00:00
"cogs.mercy",
2025-08-22 13:25:34 +00:00
]
2025-08-26 17:35:54 +00:00
async def load_cogs():
2025-08-26 13:02:34 +00:00
for cog in initial_cogs:
try:
await bot.load_extension(cog)
print(f"[OK] Cog {cog} chargé")
except Exception as e:
print(f"[ERREUR] Impossible de charger {cog}: {e}")
2025-08-22 13:25:34 +00:00
@bot.event
async def on_ready():
print(f"{bot.user.name} est connecté !")
2025-08-26 17:35:54 +00:00
# Charger les cogs avant le run
bot.loop.create_task(load_cogs())
2025-08-24 08:21:54 +00:00
2025-08-26 17:35:54 +00:00
# Lancer le bot
bot.run(DISCORD_TOKEN)