From b56a954fecd429f9390f1bf69bdcb070ee66bf5c Mon Sep 17 00:00:00 2001 From: Lanta Date: Tue, 18 Feb 2025 17:25:22 +0100 Subject: [PATCH 1/2] kolommen op klein scherm --- includes/styles_mobile.css | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/includes/styles_mobile.css b/includes/styles_mobile.css index 810ed63..70bdf9e 100644 --- a/includes/styles_mobile.css +++ b/includes/styles_mobile.css @@ -29,10 +29,13 @@ body { } th:nth-child(1), td:nth-child(1), /* Player */ -th:nth-child(2), td:nth-child(2), /* winrato */ -th:nth-child(3), td:nth-child(3), /* win% */ -th:nth-child(4), td:nth-child(4), /* kdh% */ -th:nth-child(8), td:nth-child(8) /* matches */ +th:nth-child(2), td:nth-child(2), /* Win % */ +th:nth-child(3), td:nth-child(3), /* AHD */ +th:nth-child(4), td:nth-child(4), /* K/D Human */ +th:nth-child(5), td:nth-child(5), /* K/D All */ +th:nth-child(6), td:nth-child(6), /* Matches */ +th:nth-child(7), td:nth-child(7), /* Wins */ +th:nth-child(8), td:nth-child(8) /* Deaths */ { display: table-cell; } -- 2.49.1 From 4203229e84e9754b81e38c9a0e12f0579c9447c5 Mon Sep 17 00:00:00 2001 From: Lanta Date: Wed, 5 Mar 2025 15:43:48 +0100 Subject: [PATCH 2/2] whoisbest update --- discord/teammakerv2.py | 46 +++++++++++++++++++++++++++++++++--------- 1 file changed, 36 insertions(+), 10 deletions(-) diff --git a/discord/teammakerv2.py b/discord/teammakerv2.py index a44a0fa..e88f83e 100644 --- a/discord/teammakerv2.py +++ b/discord/teammakerv2.py @@ -121,7 +121,25 @@ async def teamify(ctx, *args): await ctx.send(f"Kanaal {channel.name} is opgeruimd omdat het leeg was!") @bot.command() -async def whoisbest(ctx, category="Casual"): +async def whoisbest(ctx, category="Casual", matchesback=18): + + + if category.lower() == "help": + help_message = ( + "**Gebruik van het commando `whoisbest`:**\n" + "`!whoisbest [category] [matchesback]`\n\n" + "**Parameters:**\n" + "`category` - De categorie van de stats, bijv. 'Casual' of 'Ranked'. Niet hoofdlettergevoelig.\n" + "`matchesback` - Het minimum aantal matches dat een speler gespeeld moet hebben om mee te tellen (standaard 18).\n\n" + "**Voorbeeld:**\n" + "`!whoisbest Casual 18`\n" + "Laat de top 3 spelers zien op basis van winratio en gemiddelde damage in de Casual categorie met minimaal 18 matches.\n\n" + "Typ `!whoisbest help` om deze uitleg opnieuw te zien." + ) + await ctx.send(help_message) + return + + # Bestandspad file_path = os.path.join("..", "data", "player_last_stats.json") @@ -129,17 +147,25 @@ async def whoisbest(ctx, category="Casual"): # JSON-bestand lezen with open(file_path, "r", encoding="utf-8") as file: data = json.load(file) - - available_categories = list(data.keys()) - - if category not in data: - await ctx.send(f"Ongeldige categorie '{category}'! Beschikbare categorieën: {', '.join(available_categories)}") + + # Mapping maken (lowercase -> originele categorie) + category_mapping = {cat.lower(): cat for cat in data.keys()} + + # Zet de opgegeven category om naar lowercase + lower_category = category.lower() + + if lower_category not in category_mapping: + available_categories = ', '.join(data.keys()) + await ctx.send(f"Ongeldige categorie '{category}'! Beschikbare categorieën: {available_categories}") return - players = [player for player in data.get(category, []) if player.get("matches", 0) >= 18] + # Gebruik de juiste (originele) categorie naam uit de mapping + actual_category = category_mapping[lower_category] + + players = [player for player in data.get(actual_category, []) if player.get("matches", 0) >= matchesback] if not players: - await ctx.send(f"Geen spelersstatistieken gevonden voor '{category}' met minimaal 18 gespeelde matches!") + await ctx.send(f"Geen spelersstatistieken gevonden voor '{actual_category}' met minimaal {matchesback} gespeelde matches!") return # Sorteer spelers op winratio (aflopend) @@ -149,11 +175,11 @@ async def whoisbest(ctx, category="Casual"): top_ahd = sorted(players, key=lambda x: x.get("ahd", 0), reverse=True)[:3] # Bouw het bericht op - message = f"**\U0001F3C6 Top 3 Winratio ({category})**\n" + message = f"**\U0001F3C6 Top 3 Winratio ({actual_category})**\n" for i, player in enumerate(top_winratio, start=1): message += f"{i}. **{player['playername']}** - {player['winratio']:.2f}%\n" - message += f"\n**\U0001F480 Top 3 AHD ({category})**\n" + message += f"\n**\U0001F480 Top 3 AHD ({actual_category})**\n" for i, player in enumerate(top_ahd, start=1): message += f"{i}. **{player['playername']}** - {player['ahd']:.2f}\n" -- 2.49.1