# -*- coding: utf-8 -*- import discord from discord.ext import commands from utils.leaderboard_handler import show_leaderboard from utils.helpers import normalize_difficulty from config import BOSS_CONFIG class Top10(commands.Cog): """Cog regroupant toutes les commandes de leaderboard globales et par clan""" def __init__(self, bot): self.bot = bot # --- Commandes globales --- @commands.command() async def top10hydra(self, ctx, difficulty: str = None): if difficulty and normalize_difficulty(difficulty) in BOSS_CONFIG['hydra']['difficulties']: await show_leaderboard(ctx, 'hydra', difficulty) else: difficulties = " | ".join(BOSS_CONFIG['hydra']['difficulties']) await ctx.send(f"❌ Please specify difficulty: `!top10hydra `\n**Available:** {difficulties}\n**Shortcuts:** `nm` = Nightmare") @commands.command() async def top10chimera(self, ctx, difficulty: str = None): if difficulty and normalize_difficulty(difficulty) in BOSS_CONFIG['chimera']['difficulties']: await show_leaderboard(ctx, 'chimera', difficulty) else: difficulties = " | ".join(BOSS_CONFIG['chimera']['difficulties']) await ctx.send(f"❌ Please specify difficulty: `!top10chimera `\n**Available:** {difficulties}\n**Shortcuts:** `nm` = Nightmare, `unm` = Ultra") @commands.command() async def top10cvc(self, ctx): await show_leaderboard(ctx, 'cvc') # --- Commandes par clan TEAI (Inferno) --- @commands.command() async def teaihydra(self, ctx, difficulty: str = None): await self._show_clan_leaderboard(ctx, 'hydra', difficulty, 'TEAI') @commands.command() async def teaichimera(self, ctx, difficulty: str = None): await self._show_clan_leaderboard(ctx, 'chimera', difficulty, 'TEAI') @commands.command() async def teaicvc(self, ctx): await show_leaderboard(ctx, 'cvc', clan='TEAI') # --- Commandes par clan TEAF (Flame) --- @commands.command() async def teafhydra(self, ctx, difficulty: str = None): await self._show_clan_leaderboard(ctx, 'hydra', difficulty, 'TEAF') @commands.command() async def teafchimera(self, ctx, difficulty: str = None): await self._show_clan_leaderboard(ctx, 'chimera', difficulty, 'TEAF') @commands.command() async def teafcvc(self, ctx): await show_leaderboard(ctx, 'cvc', clan='TEAF') # --- Commandes par clan TEAC (Cinder) --- @commands.command() async def teachydra(self, ctx, difficulty: str = None): await self._show_clan_leaderboard(ctx, 'hydra', difficulty, 'TEAC') @commands.command() async def teachimera(self, ctx, difficulty: str = None): await self._show_clan_leaderboard(ctx, 'chimera', difficulty, 'TEAC') @commands.command() async def teaccvc(self, ctx): await show_leaderboard(ctx, 'cvc', clan='TEAC') # --- Commandes par clan TEACO (Corrupted Olympians) --- @commands.command() async def teacohydra(self, ctx, difficulty: str = None): await self._show_clan_leaderboard(ctx, 'hydra', difficulty, 'TEACO') @commands.command() async def teacochimera(self, ctx, difficulty: str = None): await self._show_clan_leaderboard(ctx, 'chimera', difficulty, 'TEACO') @commands.command() async def teacocvc(self, ctx): await show_leaderboard(ctx, 'cvc', clan='TEACO') # --- Méthode interne pour éviter la répétition --- async def _show_clan_leaderboard(self, ctx, boss_type, difficulty, clan): """Affiche le leaderboard pour un boss et un clan spécifique""" if difficulty and normalize_difficulty(difficulty) in BOSS_CONFIG[boss_type]['difficulties']: await show_leaderboard(ctx, boss_type, difficulty, clan) elif boss_type != 'cvc': # CvC n’a pas de difficultés difficulties = " | ".join(BOSS_CONFIG[boss_type]['difficulties']) await ctx.send( f"❌ Please specify difficulty: `!{ctx.command.name} `\n" f"**Available:** {difficulties}\n" f"**Shortcuts:** `nm` = Nightmare, `unm` = Ultra" ) else: await show_leaderboard(ctx, boss_type, clan=clan) async def setup(bot): await bot.add_cog(Top10(bot))