From 746957bc17a74bf88a20e4e8f6eae3a3ac5fb7f4 Mon Sep 17 00:00:00 2001 From: ComputerTech312 Date: Sat, 13 Sep 2025 15:39:55 +0100 Subject: [PATCH] Fix help command organization and stats message output - Added player_stats message type to force_public config - Stats messages now always appear in public channel instead of as notices - Non-admin users no longer see ignore/unignore commands in help --- duckhunt/config.json | 1 + duckhunt/simple_duckhunt.py | 14 +++++++------- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/duckhunt/config.json b/duckhunt/config.json index b0d5cf6..4e97991 100644 --- a/duckhunt/config.json +++ b/duckhunt/config.json @@ -23,6 +23,7 @@ "duck_befriend": true, "duck_miss": true, "wild_shot": true, + "player_stats": true, "leaderboard": true, "admin_commands": true }, diff --git a/duckhunt/simple_duckhunt.py b/duckhunt/simple_duckhunt.py index 0bb211e..96633ad 100644 --- a/duckhunt/simple_duckhunt.py +++ b/duckhunt/simple_duckhunt.py @@ -1478,8 +1478,8 @@ class SimpleIRCBot: stats_line3 = f"{nick} > Best:{best_display} | Avg:{average_time:.3f}s | Jams:{player.get('jammed_count', 0)} | Accidents:{player.get('accidents', 0)} | Lucky:{player.get('lucky_shots', 0)}" # Send compact stats (just 2-3 lines instead of 4+) - await self.send_user_message(nick, channel, stats_line1) - await self.send_user_message(nick, channel, stats_line2) + await self.send_user_message(nick, channel, stats_line1, 'player_stats') + await self.send_user_message(nick, channel, stats_line2, 'player_stats') # Display inventory compactly if player has items if player.get('inventory'): @@ -1502,10 +1502,10 @@ class SimpleIRCBot: inventory_display = f"{nick} > {self.colors['magenta']}Inventory ({total_items}/{max_slots}):{self.colors['reset']} {' | '.join(inventory_items[:8])}" if len(inventory_items) > 8: inventory_display += f" ... +{len(inventory_items) - 8} more" - await self.send_user_message(nick, channel, inventory_display) + await self.send_user_message(nick, channel, inventory_display, 'player_stats') # Only show advanced stats if player has significant activity if player.get('reflex_shots', 0) > 5: - await self.send_user_message(nick, channel, stats_line3) + await self.send_user_message(nick, channel, stats_line3, 'player_stats') # Inventory display if player.get('inventory'): @@ -1527,7 +1527,7 @@ class SimpleIRCBot: inventory_display = f"{nick} > {self.colors['magenta']}Items({total_items}/{max_slots}):{self.colors['reset']} {' '.join(inventory_items[:15])}" if len(inventory_items) > 15: inventory_display += f" +{len(inventory_items) - 15}" - await self.send_user_message(nick, channel, inventory_display) + await self.send_user_message(nick, channel, inventory_display, 'player_stats') async def handle_rearm(self, nick, channel, user, target_nick): """Rearm a player whose gun was confiscated""" @@ -1607,11 +1607,11 @@ class SimpleIRCBot: help_lines = [ f"{nick} > {self.colors['cyan']}🦆 DUCKHUNT COMMANDS 🦆{self.colors['reset']}", f"{nick} > {self.colors['green']}Game:{self.colors['reset']} !bang !bef !reload !stats !topduck !shop !buy !inventory !nextduck", - f"{nick} > {self.colors['blue']}Settings:{self.colors['reset']} !output !ignore !unignore ", + f"{nick} > {self.colors['blue']}Settings:{self.colors['reset']} !output ", f"{nick} > {self.colors['yellow']}Info:{self.colors['reset']} Golden ducks: 50 XP | Gun jamming & ricochets ON | Timeout: {self.duck_timeout_min}-{self.duck_timeout_max}s" ] if self.is_admin(f"{nick}!*@*"): # Check if admin - help_lines.append(f"{nick} > {self.colors['red']}Admin:{self.colors['reset']} !duck !golden !ban !reset !resetdb !rearm !giveitem !givexp | /msg {self.config['nick']} restart|quit") + help_lines.append(f"{nick} > {self.colors['red']}Admin:{self.colors['reset']} !duck !golden !ban !reset !resetdb !rearm !giveitem !givexp !ignore !unignore | /msg {self.config['nick']} restart|quit") for line in help_lines: self.send_message(channel, line)