Discord-Raid-bot/cogs/top10.py

104 lines
4.2 KiB
Python
Raw Normal View History

# -*- 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 grouping all global and per-clan leaderboard commands"""
def __init__(self, bot):
self.bot = bot
# --- Global commands ---
@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 <difficulty>`\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 <difficulty>`\n**Available:** {difficulties}\n**Shortcuts:** `nm` = Nightmare, `unm` = Ultra")
@commands.command()
async def top10cvc(self, ctx):
await show_leaderboard(ctx, 'cvc')
# --- TEAI clan commands (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')
# --- TEAF clan commands (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')
# --- TEAC clan commands (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')
# --- TEACO clan commands (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')
# --- Internal helper method ---
async def _show_clan_leaderboard(self, ctx, boss_type, difficulty, clan):
"""Shows the leaderboard for a specific boss and clan"""
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 has no difficulties
difficulties = " | ".join(BOSS_CONFIG[boss_type]['difficulties'])
await ctx.send(
f"❌ Please specify difficulty: `!{ctx.command.name} <difficulty>`\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))