Update RTF.py

Ajout gestion suffixe B M K, ajout des diminutif de difficultés
This commit is contained in:
Mickaël 2025-08-20 11:51:18 +02:00 committed by GitHub
parent 5538426bdd
commit b87effe810
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

317
RTF.py
View file

@ -1,92 +1,10 @@
"""
DISCORD BOT - Personal Best Tracker with Multiple Boss Difficulties
==================================================================
COMMANDS DOCUMENTATION:
=====================
📊 PERSONAL BEST COMMANDS:
--------------------------
HYDRA:
!pbhydra normal <damage> Submit Normal Hydra PB (requires screenshot)
!pbhydra hard <damage> Submit Hard Hydra PB (requires screenshot)
!pbhydra brutal <damage> Submit Brutal Hydra PB (requires screenshot)
!pbhydra nightmare <damage> Submit Nightmare Hydra PB (requires screenshot)
!pbhydra normal Show your Normal Hydra PB + screenshot
!pbhydra hard <username> Show username's Hard Hydra PB + screenshot
CHIMERA:
!pbchimera easy <damage> Submit Easy Chimera PB (requires screenshot)
!pbchimera normal <damage> Submit Normal Chimera PB (requires screenshot)
!pbchimera hard <damage> Submit Hard Chimera PB (requires screenshot)
!pbchimera brutal <damage> Submit Brutal Chimera PB (requires screenshot)
!pbchimera nightmare <damage> Submit Nightmare Chimera PB (requires screenshot)
!pbchimera ultra <damage> Submit Ultra Nightmare Chimera PB (requires screenshot)
!pbchimera easy Show your Easy Chimera PB + screenshot
!pbchimera normal <username> Show username's Normal Chimera PB + screenshot
CVC (unchanged):
!pbcvc <damage> Submit CvC PB (requires screenshot)
!pbcvc Show your CvC PB + screenshot
!pbcvc <username> Show username's CvC PB + screenshot
🏆 LEADERBOARD COMMANDS (GLOBAL):
--------------------------------
!top10hydra <difficulty> Top 10 Hydra records for specific difficulty
!top10chimera <difficulty> Top 10 Chimera records for specific difficulty
!top10cvc Top 10 CvC records
LEADERBOARD COMMANDS (RTF CLAN):
----------------------------------
!rtfhydra <difficulty> RTF clan Hydra records for specific difficulty
!rtfchimera <difficulty> RTF clan Chimera records for specific difficulty
!rtfcvc RTF clan CvC records
🔥 LEADERBOARD COMMANDS (RTFC CLAN):
-----------------------------------
!rtfchydra <difficulty> RTFC clan Hydra records for specific difficulty
!rtfcchimera <difficulty> RTFC clan Chimera records for specific difficulty
!rtfccvc RTFC clan CvC records
LEADERBOARD COMMANDS (RTFR CLAN):
-----------------------------------
!rtfrhydra <difficulty> RTFR clan Hydra records for specific difficulty
!rtfrchimera <difficulty> RTFR clan Chimera records for specific difficulty
!rtfrcvc RTFR clan CvC records
📈 STATS COMMANDS:
-----------------
!mystats Show all your PBs across all bosses and difficulties
!mystats <username> Show all PBs for specified user
!guide Show user-friendly command list
💡 USAGE EXAMPLES:
-----------------
!pbhydra normal 1500000 Submit 1.5M damage on Normal Hydra (with screenshot)
!pbchimera brutal [RTF]Alice Shows Alice's Brutal Chimera PB
!rtfhydra nightmare Shows RTF clan's Nightmare Hydra top 10
🏛 CLAN SYSTEM:
--------------
Clans are auto-detected from username prefixes:
- RTF members: [RTF] Username or [RTF]Username
- RTFC members: [RTFC] Username or [RTFC]Username
- RTFR members: [RTFR] Username or [RTFR]Username
🔧 REQUIREMENTS:
---------------
- Screenshot must be attached when submitting new PBs
- Only works in authorized channel
- Supported image formats: PNG, JPG, JPEG, GIF, WEBP
- Old screenshots are automatically deleted when new PB is set
"""
import discord import discord
from discord.ext import commands from discord.ext import commands
import sqlite3 import sqlite3
import os import os
import aiohttp import aiohttp
from datetime import datetime from datetime import datetime
import re
intents = discord.Intents.default() intents = discord.Intents.default()
intents.message_content = True intents.message_content = True
@ -138,6 +56,93 @@ BOSS_CONFIG = {
} }
} }
# Mappings pour les diminutifs de difficultés
DIFFICULTY_SHORTCUTS = {
'nm': 'nightmare',
'unm': 'ultra'
}
def parse_damage_amount(damage_str):
"""Convertit les montants avec suffixes (K, M, B) en nombres entiers"""
if not damage_str:
return None
damage_str = damage_str.strip().upper()
# Si c'est déjà un nombre sans suffixe
if damage_str.isdigit():
return int(damage_str)
# Utiliser regex pour extraire le nombre et le suffixe
match = re.match(r'^([0-9]*\.?[0-9]+)([KMB]?)$', damage_str)
if not match:
return None
number_str, suffix = match.groups()
try:
number = float(number_str)
except ValueError:
return None
# Conversion selon le suffixe
multipliers = {
'K': 1000,
'M': 1000000,
'B': 1000000000,
'': 1
}
if suffix in multipliers:
result = int(number * multipliers[suffix])
return result
return None
def format_damage_display(damage):
"""Formate un montant de dégâts avec le suffixe approprié"""
if damage == 0:
return "0"
if damage >= 1000000000:
# Milliards
billions = damage / 1000000000
if billions == int(billions):
return f"{int(billions)}B"
else:
return f"{billions:.1f}B"
elif damage >= 1000000:
# Millions
millions = damage / 1000000
if millions == int(millions):
return f"{int(millions)}M"
else:
return f"{millions:.1f}M"
elif damage >= 1000:
# Milliers
thousands = damage / 1000
if thousands == int(thousands):
return f"{int(thousands)}K"
else:
return f"{thousands:.1f}K"
else:
# Moins de 1000
return str(damage)
def normalize_difficulty(difficulty):
"""Normalise une difficulté en gérant les diminutifs"""
if not difficulty:
return None
difficulty_lower = difficulty.lower()
# Vérifier les diminutifs d'abord
if difficulty_lower in DIFFICULTY_SHORTCUTS:
return DIFFICULTY_SHORTCUTS[difficulty_lower]
# Sinon retourner tel quel
return difficulty_lower
class DatabaseManager: class DatabaseManager:
def __init__(self, db_path=DATABASE_PATH): def __init__(self, db_path=DATABASE_PATH):
self.db_path = db_path self.db_path = db_path
@ -444,12 +449,13 @@ async def handle_pb_command(ctx, boss_type, arg1=None, arg2=None):
try: try:
# Pour CvC (pas de difficultés) # Pour CvC (pas de difficultés)
if not difficulties: if not difficulties:
# Utiliser l'ancienne logique pour CvC # Utiliser l'ancienne logique pour CvC avec parsing des montants
if arg1 and arg1.isdigit(): if arg1:
damage = int(arg1) damage = parse_damage_amount(arg1)
await handle_pb_submission(ctx, boss_type, None, damage) if damage is not None:
elif arg1: # Username await handle_pb_submission(ctx, boss_type, None, damage)
await show_user_pb(ctx, boss_type, None, arg1) else: # Username
await show_user_pb(ctx, boss_type, None, arg1)
else: # Montrer son propre PB else: # Montrer son propre PB
await show_user_pb(ctx, boss_type, None, ctx.author.display_name) await show_user_pb(ctx, boss_type, None, ctx.author.display_name)
return return
@ -461,24 +467,30 @@ async def handle_pb_command(ctx, boss_type, arg1=None, arg2=None):
await ctx.send( await ctx.send(
f"❌ Please specify difficulty and damage!\n" f"❌ Please specify difficulty and damage!\n"
f"**Available difficulties:** {difficulty_list}\n" f"**Available difficulties:** {difficulty_list}\n"
f"**Shortcuts:** `nm` = Nightmare, `unm` = Ultra Nightmare\n"
f"**Examples:**\n" f"**Examples:**\n"
f"`!pb{boss_type} normal 1500000` - Submit PB with screenshot\n" f"`!pb{boss_type} normal 1.5M` - Submit PB with screenshot\n"
f"`!pb{boss_type} nm 500K` - Submit Nightmare PB\n"
f"`!pb{boss_type} hard` - Show your Hard PB\n" f"`!pb{boss_type} hard` - Show your Hard PB\n"
f"`!pb{boss_type} brutal username` - Show user's Brutal PB" f"`!pb{boss_type} brutal username` - Show user's Brutal PB"
) )
return return
# Normaliser la difficulté (gérer les diminutifs)
normalized_difficulty = normalize_difficulty(arg1)
# Vérifier si arg1 est une difficulté valide # Vérifier si arg1 est une difficulté valide
if arg1.lower() in difficulties: if normalized_difficulty in difficulties:
difficulty = arg1.lower() difficulty = normalized_difficulty
if arg2 and arg2.isdigit(): if arg2:
# !pbhydra normal 1500000 - Soumission PB damage = parse_damage_amount(arg2)
damage = int(arg2) if damage is not None:
await handle_pb_submission(ctx, boss_type, difficulty, damage) # !pbhydra normal 1.5M - Soumission PB
elif arg2: await handle_pb_submission(ctx, boss_type, difficulty, damage)
# !pbhydra normal username - Voir PB d'un utilisateur else:
await show_user_pb(ctx, boss_type, difficulty, arg2) # !pbhydra normal username - Voir PB d'un utilisateur
await show_user_pb(ctx, boss_type, difficulty, arg2)
else: else:
# !pbhydra normal - Voir son propre PB # !pbhydra normal - Voir son propre PB
await show_user_pb(ctx, boss_type, difficulty, ctx.author.display_name) await show_user_pb(ctx, boss_type, difficulty, ctx.author.display_name)
@ -487,11 +499,10 @@ async def handle_pb_command(ctx, boss_type, arg1=None, arg2=None):
difficulty_list = " | ".join([d.title() for d in difficulties]) difficulty_list = " | ".join([d.title() for d in difficulties])
await ctx.send( await ctx.send(
f"❌ Invalid difficulty: `{arg1}`\n" f"❌ Invalid difficulty: `{arg1}`\n"
f"**Available difficulties:** {difficulty_list}" f"**Available difficulties:** {difficulty_list}\n"
f"**Shortcuts:** `nm` = Nightmare, `unm` = Ultra Nightmare"
) )
except ValueError:
await ctx.send(f"❌ Please provide a valid damage number!")
except Exception as e: except Exception as e:
await ctx.send(f"❌ Error: {e}") await ctx.send(f"❌ Error: {e}")
@ -531,10 +542,10 @@ async def handle_pb_submission(ctx, boss_type, difficulty, damage):
embed = discord.Embed( embed = discord.Embed(
title=f"🎉 NEW {boss_info['name'].upper()} PB! 🎉", title=f"🎉 NEW {boss_info['name'].upper()} PB! 🎉",
description=f"**{username}** just hit **{damage:,} damage** on {difficulty_name} {boss_info['name']}!", description=f"**{username}** just hit **{format_damage_display(damage)} damage** on {difficulty_name} {boss_info['name']}!",
color=0x00ff00 color=0x00ff00
) )
embed.add_field(name="📈 Improvement", value=f"+{improvement:,} damage", inline=True) embed.add_field(name="📈 Improvement", value=f"+{format_damage_display(improvement)} damage", inline=True)
embed.set_image(url=attachment.url) embed.set_image(url=attachment.url)
await ctx.send(embed=embed) await ctx.send(embed=embed)
@ -544,12 +555,12 @@ async def handle_pb_submission(ctx, boss_type, difficulty, damage):
difficulty_name = get_difficulty_display_name(difficulty) if difficulty else "" difficulty_name = get_difficulty_display_name(difficulty) if difficulty else ""
embed = discord.Embed( embed = discord.Embed(
title="💪 Nice attempt!", title="💪 Nice attempt!",
description=f"Your damage: **{damage:,}**\nCurrent PB: **{current_pb:,}**", description=f"Your damage: **{format_damage_display(damage)}**\nCurrent PB: **{format_damage_display(current_pb)}**",
color=0xffa500 color=0xffa500
) )
embed.add_field( embed.add_field(
name="Keep going!", name="Keep going!",
value=f"You need **{current_pb - damage + 1:,}** more damage for a new {difficulty_name} PB!", value=f"You need **{format_damage_display(current_pb - damage + 1)}** more damage for a new {difficulty_name} PB!",
inline=False inline=False
) )
await ctx.send(embed=embed) await ctx.send(embed=embed)
@ -570,7 +581,7 @@ async def show_user_pb(ctx, boss_type, difficulty, username):
) )
embed.add_field( embed.add_field(
name="💡 Get started!", name="💡 Get started!",
value=f"Use `!pb{boss_type} {difficulty} <damage>` with a screenshot to set your first record!", value=f"Use `!pb{boss_type} {difficulty} <damage>` with a screenshot to set your first record!\nAccepts K/M/B suffixes: `1.5M`, `500K`, etc.",
inline=False inline=False
) )
await ctx.send(embed=embed) await ctx.send(embed=embed)
@ -578,7 +589,7 @@ async def show_user_pb(ctx, boss_type, difficulty, username):
embed = discord.Embed( embed = discord.Embed(
title=f"{boss_info['emoji']} {username}'s {difficulty_name} {boss_info['name']} PB", title=f"{boss_info['emoji']} {username}'s {difficulty_name} {boss_info['name']} PB",
description=f"**{pb_damage:,} damage**", description=f"**{format_damage_display(pb_damage)} damage**",
color=boss_info['color'] color=boss_info['color']
) )
if pb_date: if pb_date:
@ -619,6 +630,14 @@ async def show_leaderboard(ctx, boss_type, difficulty=None, clan=None):
return return
try: try:
# Normaliser la difficulté si spécifiée
if difficulty:
difficulty = normalize_difficulty(difficulty)
if difficulty not in BOSS_CONFIG[boss_type]['difficulties']:
difficulties = " | ".join(BOSS_CONFIG[boss_type]['difficulties'])
await ctx.send(f"❌ Invalid difficulty. Available: {difficulties}")
return
boss_info = BOSS_CONFIG[boss_type] boss_info = BOSS_CONFIG[boss_type]
leaderboard = db_manager.get_leaderboard(boss_type, difficulty, 10, clan) leaderboard = db_manager.get_leaderboard(boss_type, difficulty, 10, clan)
@ -660,7 +679,7 @@ async def show_leaderboard(ctx, boss_type, difficulty=None, clan=None):
embed.add_field( embed.add_field(
name=f"{medals[i]} #{i+1} {display_name}", name=f"{medals[i]} #{i+1} {display_name}",
value=f"**{damage:,}** damage{date_text}", value=f"**{format_damage_display(damage)} damage**{date_text}",
inline=False inline=False
) )
@ -673,20 +692,20 @@ async def show_leaderboard(ctx, boss_type, difficulty=None, clan=None):
@bot.command() @bot.command()
async def top10hydra(ctx, difficulty: str = None): async def top10hydra(ctx, difficulty: str = None):
"""Affiche le top 10 des PB Hydra pour une difficulté""" """Affiche le top 10 des PB Hydra pour une difficulté"""
if difficulty and difficulty.lower() in BOSS_CONFIG['hydra']['difficulties']: if difficulty and normalize_difficulty(difficulty) in BOSS_CONFIG['hydra']['difficulties']:
await show_leaderboard(ctx, 'hydra', difficulty.lower()) await show_leaderboard(ctx, 'hydra', difficulty)
else: else:
difficulties = " | ".join(BOSS_CONFIG['hydra']['difficulties']) difficulties = " | ".join(BOSS_CONFIG['hydra']['difficulties'])
await ctx.send(f"❌ Please specify difficulty: `!top10hydra <difficulty>`\n**Available:** {difficulties}") await ctx.send(f"❌ Please specify difficulty: `!top10hydra <difficulty>`\n**Available:** {difficulties}\n**Shortcuts:** `nm` = Nightmare")
@bot.command() @bot.command()
async def top10chimera(ctx, difficulty: str = None): async def top10chimera(ctx, difficulty: str = None):
"""Affiche le top 10 des PB Chimera pour une difficulté""" """Affiche le top 10 des PB Chimera pour une difficulté"""
if difficulty and difficulty.lower() in BOSS_CONFIG['chimera']['difficulties']: if difficulty and normalize_difficulty(difficulty) in BOSS_CONFIG['chimera']['difficulties']:
await show_leaderboard(ctx, 'chimera', difficulty.lower()) await show_leaderboard(ctx, 'chimera', difficulty)
else: else:
difficulties = " | ".join(BOSS_CONFIG['chimera']['difficulties']) difficulties = " | ".join(BOSS_CONFIG['chimera']['difficulties'])
await ctx.send(f"❌ Please specify difficulty: `!top10chimera <difficulty>`\n**Available:** {difficulties}") await ctx.send(f"❌ Please specify difficulty: `!top10chimera <difficulty>`\n**Available:** {difficulties}\n**Shortcuts:** `nm` = Nightmare, `unm` = Ultra")
@bot.command() @bot.command()
async def top10cvc(ctx): async def top10cvc(ctx):
@ -697,20 +716,20 @@ async def top10cvc(ctx):
@bot.command() @bot.command()
async def rtfhydra(ctx, difficulty: str = None): async def rtfhydra(ctx, difficulty: str = None):
"""Affiche le top 10 Hydra du clan RTF""" """Affiche le top 10 Hydra du clan RTF"""
if difficulty and difficulty.lower() in BOSS_CONFIG['hydra']['difficulties']: if difficulty and normalize_difficulty(difficulty) in BOSS_CONFIG['hydra']['difficulties']:
await show_leaderboard(ctx, 'hydra', difficulty.lower(), 'RTF') await show_leaderboard(ctx, 'hydra', difficulty, 'RTF')
else: else:
difficulties = " | ".join(BOSS_CONFIG['hydra']['difficulties']) difficulties = " | ".join(BOSS_CONFIG['hydra']['difficulties'])
await ctx.send(f"❌ Please specify difficulty: `!rtfhydra <difficulty>`\n**Available:** {difficulties}") await ctx.send(f"❌ Please specify difficulty: `!rtfhydra <difficulty>`\n**Available:** {difficulties}\n**Shortcuts:** `nm` = Nightmare")
@bot.command() @bot.command()
async def rtfchimera(ctx, difficulty: str = None): async def rtfchimera(ctx, difficulty: str = None):
"""Affiche le top 10 Chimera du clan RTF""" """Affiche le top 10 Chimera du clan RTF"""
if difficulty and difficulty.lower() in BOSS_CONFIG['chimera']['difficulties']: if difficulty and normalize_difficulty(difficulty) in BOSS_CONFIG['chimera']['difficulties']:
await show_leaderboard(ctx, 'chimera', difficulty.lower(), 'RTF') await show_leaderboard(ctx, 'chimera', difficulty, 'RTF')
else: else:
difficulties = " | ".join(BOSS_CONFIG['chimera']['difficulties']) difficulties = " | ".join(BOSS_CONFIG['chimera']['difficulties'])
await ctx.send(f"❌ Please specify difficulty: `!rtfchimera <difficulty>`\n**Available:** {difficulties}") await ctx.send(f"❌ Please specify difficulty: `!rtfchimera <difficulty>`\n**Available:** {difficulties}\n**Shortcuts:** `nm` = Nightmare, `unm` = Ultra")
@bot.command() @bot.command()
async def rtfcvc(ctx): async def rtfcvc(ctx):
@ -721,20 +740,20 @@ async def rtfcvc(ctx):
@bot.command() @bot.command()
async def rtfchydra(ctx, difficulty: str = None): async def rtfchydra(ctx, difficulty: str = None):
"""Affiche le top 10 Hydra du clan RTFC""" """Affiche le top 10 Hydra du clan RTFC"""
if difficulty and difficulty.lower() in BOSS_CONFIG['hydra']['difficulties']: if difficulty and normalize_difficulty(difficulty) in BOSS_CONFIG['hydra']['difficulties']:
await show_leaderboard(ctx, 'hydra', difficulty.lower(), 'RTFC') await show_leaderboard(ctx, 'hydra', difficulty, 'RTFC')
else: else:
difficulties = " | ".join(BOSS_CONFIG['hydra']['difficulties']) difficulties = " | ".join(BOSS_CONFIG['hydra']['difficulties'])
await ctx.send(f"❌ Please specify difficulty: `!rtfchydra <difficulty>`\n**Available:** {difficulties}") await ctx.send(f"❌ Please specify difficulty: `!rtfchydra <difficulty>`\n**Available:** {difficulties}\n**Shortcuts:** `nm` = Nightmare")
@bot.command() @bot.command()
async def rtfcchimera(ctx, difficulty: str = None): async def rtfcchimera(ctx, difficulty: str = None):
"""Affiche le top 10 Chimera du clan RTFC""" """Affiche le top 10 Chimera du clan RTFC"""
if difficulty and difficulty.lower() in BOSS_CONFIG['chimera']['difficulties']: if difficulty and normalize_difficulty(difficulty) in BOSS_CONFIG['chimera']['difficulties']:
await show_leaderboard(ctx, 'chimera', difficulty.lower(), 'RTFC') await show_leaderboard(ctx, 'chimera', difficulty, 'RTFC')
else: else:
difficulties = " | ".join(BOSS_CONFIG['chimera']['difficulties']) difficulties = " | ".join(BOSS_CONFIG['chimera']['difficulties'])
await ctx.send(f"❌ Please specify difficulty: `!rtfcchimera <difficulty>`\n**Available:** {difficulties}") await ctx.send(f"❌ Please specify difficulty: `!rtfcchimera <difficulty>`\n**Available:** {difficulties}\n**Shortcuts:** `nm` = Nightmare, `unm` = Ultra")
@bot.command() @bot.command()
async def rtfccvc(ctx): async def rtfccvc(ctx):
@ -745,20 +764,20 @@ async def rtfccvc(ctx):
@bot.command() @bot.command()
async def rtfrhydra(ctx, difficulty: str = None): async def rtfrhydra(ctx, difficulty: str = None):
"""Affiche le top 10 Hydra du clan RTFR""" """Affiche le top 10 Hydra du clan RTFR"""
if difficulty and difficulty.lower() in BOSS_CONFIG['hydra']['difficulties']: if difficulty and normalize_difficulty(difficulty) in BOSS_CONFIG['hydra']['difficulties']:
await show_leaderboard(ctx, 'hydra', difficulty.lower(), 'RTFR') await show_leaderboard(ctx, 'hydra', difficulty, 'RTFR')
else: else:
difficulties = " | ".join(BOSS_CONFIG['hydra']['difficulties']) difficulties = " | ".join(BOSS_CONFIG['hydra']['difficulties'])
await ctx.send(f"❌ Please specify difficulty: `!rtfrhydra <difficulty>`\n**Available:** {difficulties}") await ctx.send(f"❌ Please specify difficulty: `!rtfrhydra <difficulty>`\n**Available:** {difficulties}\n**Shortcuts:** `nm` = Nightmare")
@bot.command() @bot.command()
async def rtfrchimera(ctx, difficulty: str = None): async def rtfrchimera(ctx, difficulty: str = None):
"""Affiche le top 10 Chimera du clan RTFR""" """Affiche le top 10 Chimera du clan RTFR"""
if difficulty and difficulty.lower() in BOSS_CONFIG['chimera']['difficulties']: if difficulty and normalize_difficulty(difficulty) in BOSS_CONFIG['chimera']['difficulties']:
await show_leaderboard(ctx, 'chimera', difficulty.lower(), 'RTFR') await show_leaderboard(ctx, 'chimera', difficulty, 'RTFR')
else: else:
difficulties = " | ".join(BOSS_CONFIG['chimera']['difficulties']) difficulties = " | ".join(BOSS_CONFIG['chimera']['difficulties'])
await ctx.send(f"❌ Please specify difficulty: `!rtfrchimera <difficulty>`\n**Available:** {difficulties}") await ctx.send(f"❌ Please specify difficulty: `!rtfrchimera <difficulty>`\n**Available:** {difficulties}\n**Shortcuts:** `nm` = Nightmare, `unm` = Ultra")
@bot.command() @bot.command()
async def rtfrcvc(ctx): async def rtfrcvc(ctx):
@ -794,7 +813,7 @@ async def mystats(ctx, target_user: str = None):
pb_value = user_data[pb_key] pb_value = user_data[pb_key]
pb_date = user_data.get(date_key) pb_date = user_data.get(date_key)
date_text = f"{format_date_only(pb_date)}" if pb_date else "" date_text = f"{format_date_only(pb_date)}" if pb_date else ""
hydra_stats.append(f"**{difficulty.title()}:** {pb_value:,}{date_text}") hydra_stats.append(f"**{difficulty.title()}:** {format_damage_display(pb_value)}{date_text}")
hydra_text = "\n".join(hydra_stats) if hydra_stats else "No records" hydra_text = "\n".join(hydra_stats) if hydra_stats else "No records"
embed.add_field(name="🐍 Hydra PBs", value=hydra_text, inline=False) embed.add_field(name="🐍 Hydra PBs", value=hydra_text, inline=False)
@ -810,7 +829,7 @@ async def mystats(ctx, target_user: str = None):
pb_date = user_data.get(date_key) pb_date = user_data.get(date_key)
date_text = f"{format_date_only(pb_date)}" if pb_date else "" date_text = f"{format_date_only(pb_date)}" if pb_date else ""
display_name = "Ultra Nightmare" if difficulty == "ultra" else difficulty.title() display_name = "Ultra Nightmare" if difficulty == "ultra" else difficulty.title()
chimera_stats.append(f"**{display_name}:** {pb_value:,}{date_text}") chimera_stats.append(f"**{display_name}:** {format_damage_display(pb_value)}{date_text}")
chimera_text = "\n".join(chimera_stats) if chimera_stats else "No records" chimera_text = "\n".join(chimera_stats) if chimera_stats else "No records"
embed.add_field(name="🦁 Chimera PBs", value=chimera_text, inline=False) embed.add_field(name="🦁 Chimera PBs", value=chimera_text, inline=False)
@ -818,7 +837,7 @@ async def mystats(ctx, target_user: str = None):
# CvC # CvC
cvc_pb = user_data.get('pb_cvc', 0) cvc_pb = user_data.get('pb_cvc', 0)
cvc_date = user_data.get('pb_cvc_date') cvc_date = user_data.get('pb_cvc_date')
cvc_text = f"**{cvc_pb:,} damage**" if cvc_pb > 0 else "No record" cvc_text = f"**{format_damage_display(cvc_pb)} damage**" if cvc_pb > 0 else "No record"
if cvc_pb > 0 and cvc_date: if cvc_pb > 0 and cvc_date:
formatted_date = format_date_only(cvc_date) formatted_date = format_date_only(cvc_date)
if formatted_date: if formatted_date:
@ -833,7 +852,7 @@ async def mystats(ctx, target_user: str = None):
total_damage += user_data.get(f'pb_chimera_{difficulty}', 0) total_damage += user_data.get(f'pb_chimera_{difficulty}', 0)
total_damage += user_data.get('pb_cvc', 0) total_damage += user_data.get('pb_cvc', 0)
embed.add_field(name="💯 Total Combined Damage", value=f"**{total_damage:,}**", inline=False) embed.add_field(name="💯 Total Combined Damage", value=f"**{format_damage_display(total_damage)}**", inline=False)
await ctx.send(embed=embed) await ctx.send(embed=embed)
@ -852,10 +871,19 @@ async def guide(ctx):
color=0x00bfff color=0x00bfff
) )
# Info sur les formats de dégâts
embed.add_field(
name="💰 Damage Formats",
value="**Accepted formats:** `1500000`, `1.5M`, `500K`, `2B`\n" +
"**Suffixes:** K = thousands, M = millions, B = billions\n" +
"**Shortcuts:** `nm` = Nightmare, `unm` = Ultra Nightmare",
inline=False
)
# Commandes PB Hydra # Commandes PB Hydra
embed.add_field( embed.add_field(
name="🐍 Hydra Commands", name="🐍 Hydra Commands",
value="**Difficulties:** Normal | Hard | Brutal | Nightmare\n" + value="**Difficulties:** Normal | Hard | Brutal | Nightmare (nm)\n" +
"`!pbhydra <difficulty> <damage>` - Submit PB + screenshot\n" + "`!pbhydra <difficulty> <damage>` - Submit PB + screenshot\n" +
"`!pbhydra <difficulty>` - Show your PB\n" + "`!pbhydra <difficulty>` - Show your PB\n" +
"`!pbhydra <difficulty> <user>` - Show user's PB", "`!pbhydra <difficulty> <user>` - Show user's PB",
@ -865,7 +893,7 @@ async def guide(ctx):
# Commandes PB Chimera # Commandes PB Chimera
embed.add_field( embed.add_field(
name="🦁 Chimera Commands", name="🦁 Chimera Commands",
value="**Difficulties:** Easy | Normal | Hard | Brutal | Nightmare | Ultra\n" + value="**Difficulties:** Easy | Normal | Hard | Brutal | Nightmare (nm) | Ultra (unm)\n" +
"`!pbchimera <difficulty> <damage>` - Submit PB + screenshot\n" + "`!pbchimera <difficulty> <damage>` - Submit PB + screenshot\n" +
"`!pbchimera <difficulty>` - Show your PB\n" + "`!pbchimera <difficulty>` - Show your PB\n" +
"`!pbchimera <difficulty> <user>` - Show user's PB", "`!pbchimera <difficulty> <user>` - Show user's PB",
@ -911,9 +939,10 @@ async def guide(ctx):
# Instructions # Instructions
embed.add_field( embed.add_field(
name="💡 Examples", name="💡 Examples",
value="`!pbhydra brutal 1500000` - Submit Brutal Hydra PB\n" + value="`!pbhydra brutal 1.5M` - Submit Brutal Hydra PB\n" +
"`!pbchimera ultra` - Show your Ultra Nightmare PB\n" + "`!pbchimera unm 500K` - Submit Ultra Nightmare PB\n" +
"`!rtfhydra nightmare` - RTF clan Nightmare rankings\n" + "`!pbcvc 2.3M` - Submit CvC PB\n" +
"`!rtfhydra nm` - RTF clan Nightmare rankings\n" +
"**Always attach screenshot when submitting PBs!**", "**Always attach screenshot when submitting PBs!**",
inline=False inline=False
) )
@ -922,5 +951,5 @@ async def guide(ctx):
await ctx.send(embed=embed) await ctx.send(embed=embed)
# TODO: Add your bot token here # Ajout du token bot (à remplacer par votre token)
# bot.run("YOUR_DISCORD_TOKEN") # bot.run('YOUR_BOT_TOKEN_HERE')