All checks were successful
Deploy Bot on NAS / deploy (push) Successful in 29s
discord.py's built-in !help command exposes cog docstrings directly to Discord members — leaving them in French made the output partially French. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
81 lines
2.1 KiB
Python
81 lines
2.1 KiB
Python
# -*- coding: utf-8 -*-
|
|
import discord
|
|
import os
|
|
import sys
|
|
from discord.ext import commands
|
|
from config import DISCORD_TOKEN
|
|
|
|
from utils.DatabaseManager_class import DatabaseManager
|
|
from utils.ScreenshotManager_class import ScreenshotManager
|
|
from utils.MercyManager_class import MercyManager
|
|
from utils.pb_handler import set_managers
|
|
from utils.leaderboard_handler import set_db_manager
|
|
|
|
# Force UTF-8
|
|
|
|
os.environ["PYTHONIOENCODING"] = "utf-8"
|
|
sys.stdout.reconfigure(encoding='utf-8')
|
|
|
|
# Define intents
|
|
intents = discord.Intents.default()
|
|
intents.message_content = True
|
|
|
|
# Initialize managers
|
|
db_manager = DatabaseManager()
|
|
screenshot_manager = ScreenshotManager()
|
|
mercy_manager = MercyManager()
|
|
|
|
# Inject managers into handlers
|
|
set_managers(db_manager, screenshot_manager) # pb_handler
|
|
set_db_manager(db_manager) # leaderboard_handler
|
|
|
|
# Cog list
|
|
initial_cogs = [
|
|
"cogs.guide",
|
|
"cogs.pbhydra",
|
|
"cogs.pbchimera",
|
|
"cogs.pbcvc",
|
|
"cogs.top10",
|
|
"cogs.mystats",
|
|
"cogs.mercy",
|
|
]
|
|
|
|
# Directory list
|
|
folders = [
|
|
"screenshots/hydra/normal",
|
|
"screenshots/hydra/hard",
|
|
"screenshots/hydra/brutal",
|
|
"screenshots/hydra/nightmare",
|
|
"screenshots/chimera/easy",
|
|
"screenshots/chimera/normal",
|
|
"screenshots/chimera/hard",
|
|
"screenshots/chimera/brutal",
|
|
"screenshots/chimera/nightmare",
|
|
"screenshots/chimera/ultra",
|
|
"screenshots/cvc",
|
|
]
|
|
|
|
# Create directories if needed (exist_ok=True avoids overwriting)
|
|
for f in folders:
|
|
os.makedirs(f, exist_ok=True)
|
|
|
|
class MyBot(commands.Bot):
|
|
def __init__(self):
|
|
super().__init__(command_prefix="!", intents=intents)
|
|
self.db_manager = db_manager
|
|
self.screenshot_manager = screenshot_manager
|
|
self.mercy_manager = mercy_manager
|
|
|
|
async def setup_hook(self):
|
|
for cog in initial_cogs:
|
|
try:
|
|
await self.load_extension(cog)
|
|
print(f"[OK] Cog {cog} loaded")
|
|
except Exception as e:
|
|
print(f"[ERROR] Failed to load {cog}: {e}")
|
|
|
|
async def on_ready(self):
|
|
print(f"{self.user.name} connected!")
|
|
|
|
bot = MyBot()
|
|
bot.run(DISCORD_TOKEN)
|