From 39a7a0d960e4b7a435003ced950ec23c78de2489 Mon Sep 17 00:00:00 2001 From: Soulter <905617992@qq.com> Date: Sun, 14 Sep 2025 19:31:15 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20revert=20"feat:=20=E5=85=BC=E5=AE=B9?= =?UTF-8?q?=E6=8C=87=E4=BB=A4=E5=90=8D=E5=92=8C=E7=AC=AC=E4=B8=80=E4=B8=AA?= =?UTF-8?q?=E5=8F=82=E6=95=B0=E4=B9=8B=E9=97=B4=E6=B2=A1=E6=9C=89=E7=A9=BA?= =?UTF-8?q?=E6=A0=BC=E7=9A=84=E6=83=85=E5=86=B5=20(#2650)"=20for=20command?= =?UTF-8?q?=20issue?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 9bfa72610728f900169e1eabeb533ddba29a4f7d. --- astrbot/core/star/filter/command.py | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/astrbot/core/star/filter/command.py b/astrbot/core/star/filter/command.py index e5400a757..9ceed54a9 100755 --- a/astrbot/core/star/filter/command.py +++ b/astrbot/core/star/filter/command.py @@ -153,17 +153,10 @@ class CommandFilter(HandlerFilter): _full = f"{parent_command_name} {candidate}" else: _full = candidate - if message_str == _full: - # 完全等于命令名 → 没参数 - message_str = "" + if message_str.startswith(f"{_full} ") or message_str == _full: + message_str = message_str[len(_full) :].strip() ok = True break - elif message_str.startswith(_full): - # 命令名后面无论是空格还是直接连参数都可以 - message_str = message_str[len(_full) :].lstrip() - ok = True - break - if not ok: return False