diff --git a/plugins/guess_song/main.py b/plugins/guess_song/main.py index a684238..6b3b25b 100644 --- a/plugins/guess_song/main.py +++ b/plugins/guess_song/main.py @@ -181,24 +181,35 @@ class GuessSongPlugin(MessagePluginInterface): return command in self._commands - @plugin_stats_decorator(plugin_name="猜歌名") - @plugin_points_cost(2, "猜歌名消耗积分", FEATURE_KEY) + @plugin_stats_decorator(plugin_name="猜歌名游戏") async def process_message(self, message: Dict[str, Any]) -> Tuple[bool, Optional[str]]: """处理消息""" content = str(message.get("content", "")).strip() self.LOG.debug(f"插件执行: {self.name}:{content}") + + # 简化命令处理,只检查开头是否包含命令前缀 + command_found = False + for cmd in self._commands: + if content.startswith(cmd): + command_found = True + content = content[len(cmd):].strip() + break + + if not command_found: + return False, "不匹配的命令" + sender = message.get("sender") roomid = message.get("roomid", "") gbm: GroupBotManager = message.get("gbm") bot: WechatAPIClient = message.get("bot") + # 使用roomid或sender作为游戏会话ID + session_id = roomid if roomid else sender + # 检查权限 if roomid and gbm.get_group_permission(roomid, self.feature) == PermissionStatus.DISABLED: return False, "没有权限" - # 使用roomid或sender作为游戏会话ID - session_id = roomid if roomid else sender - # 获取当前游戏会话 current_game = None if self.redis_db: