From 451ca9cb5a2f56f1a3d1876e4516e17fa7b39a10 Mon Sep 17 00:00:00 2001 From: Aqr-K <95741669+Aqr-K@users.noreply.github.com> Date: Tue, 1 Jul 2025 17:19:01 +0800 Subject: [PATCH] =?UTF-8?q?feat(command):=20=E5=A2=9E=E5=8A=A0=20`show`=20?= =?UTF-8?q?=EF=BC=8C=E7=94=A8=E6=9D=A5=E5=88=A4=E6=96=AD=E6=98=AF=E5=90=A6?= =?UTF-8?q?=E6=B3=A8=E5=86=8C=E8=BF=9B=E8=8F=9C=E5=8D=95=E9=87=8C=E6=98=BE?= =?UTF-8?q?=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/command.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/app/command.py b/app/command.py index 94911ce3..c403e38e 100644 --- a/app/command.py +++ b/app/command.py @@ -225,6 +225,9 @@ class Command(metaclass=Singleton): 添加命令集合 """ for cmd, command in source.items(): + if not command.get("show", True): + continue + command_data = { "type": command_type, "description": command.get("description"), @@ -261,6 +264,7 @@ class Command(metaclass=Singleton): "func": self.send_plugin_event, "description": command.get("desc"), "category": command.get("category"), + "show": command.get("show", True), "data": { "etype": command.get("event"), "data": command.get("data") @@ -335,7 +339,8 @@ class Command(metaclass=Singleton): return self._commands.get(cmd, {}) def register(self, cmd: str, func: Any, data: Optional[dict] = None, - desc: Optional[str] = None, category: Optional[str] = None) -> None: + desc: Optional[str] = None, category: Optional[str] = None, + show: bool = True) -> None: """ 注册单个命令 """ @@ -344,7 +349,8 @@ class Command(metaclass=Singleton): "func": func, "description": desc, "category": category, - "data": data or {} + "data": data or {}, + "show": show } def execute(self, cmd: str, data_str: Optional[str] = "",