From 8eeec67730659727e4bcc0ae9b9c7d90b1adf125 Mon Sep 17 00:00:00 2001 From: ninemine <1371605831@qq.com> Date: Fri, 7 Nov 2025 10:48:54 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=97=A5=E5=BF=97=E6=B5=81?= =?UTF-8?q?=E7=A8=8B=E7=94=A8=E4=BB=A5=E8=A7=A3=E5=86=B3=E6=B8=B8=E6=88=8F?= =?UTF-8?q?=E7=8A=B6=E6=80=81=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- games/werewolf.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/games/werewolf.py b/games/werewolf.py index 192071c..ae744c3 100644 --- a/games/werewolf.py +++ b/games/werewolf.py @@ -66,6 +66,7 @@ class WerewolfGame(BaseGame): # 提取参数 _, args = CommandParser.extract_command_args(command) args = args.strip() + logger.debug(f"狼人杀指令解析 - command: {command}, args: {args}") # 没有参数,显示帮助 if not args: @@ -74,6 +75,7 @@ class WerewolfGame(BaseGame): # 解析参数 parts = args.split(maxsplit=1) action = parts[0].lower() + logger.debug(f"狼人杀指令解析 - parts: {parts}, action: {action}") # 创建/加入/开始游戏 if action == 'open': @@ -147,7 +149,9 @@ class WerewolfGame(BaseGame): """ state = self.db.get_game_state(chat_id, 0, 'werewolf') if state: + logger.debug(f"获取游戏状态成功: chat_id={chat_id}, status={state['state_data'].get('status')}, phase={state['state_data'].get('phase')}") return state['state_data'] + logger.warning(f"获取游戏状态失败: chat_id={chat_id}, 状态不存在") return None def _save_game_state(self, chat_id: int, state_data: Dict): @@ -157,6 +161,7 @@ class WerewolfGame(BaseGame): chat_id: 会话ID state_data: 状态数据 """ + logger.debug(f"保存游戏状态: chat_id={chat_id}, status={state_data.get('status')}, phase={state_data.get('phase')}") self.db.save_game_state(chat_id, 0, 'werewolf', state_data) def _get_phase_description(self, phase: str) -> Dict[str, str]: @@ -578,8 +583,10 @@ class WerewolfGame(BaseGame): Returns: 提示消息 """ + logger.debug(f"处理技能 - chat_id: {chat_id}, user_id: {user_id}, skill: {skill}, target_id: {target_id}") state_data = self._get_game_state(chat_id) if not state_data: + logger.warning(f"技能处理失败 - 未找到游戏状态: chat_id={chat_id}") return "❌ 没有正在进行的游戏!" if state_data['status'] != 'playing':