From 55b28209ef109e82709bc1b27857877f3aefc03c Mon Sep 17 00:00:00 2001 From: Soulter <905617992@qq.com> Date: Wed, 1 Oct 2025 11:18:13 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E6=B3=A8=E5=86=8C?= =?UTF-8?q?=E6=8C=87=E4=BB=A4=E7=BB=84=E6=8C=87=E4=BB=A4=E6=97=B6=E7=9A=84?= =?UTF-8?q?=20Pyright=20=E7=B1=BB=E5=9E=8B=E6=A3=80=E6=9F=A5=E6=8F=90?= =?UTF-8?q?=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- astrbot/core/star/register/star_handler.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/astrbot/core/star/register/star_handler.py b/astrbot/core/star/register/star_handler.py index 419c874bf..d1c5a6dce 100644 --- a/astrbot/core/star/register/star_handler.py +++ b/astrbot/core/star/register/star_handler.py @@ -205,7 +205,6 @@ def register_command_group( new_group = CommandGroupFilter(command_group_name, alias) def decorator(obj): - # 根指令组 if new_group: handler_md = get_handler_or_create( obj, EventType.AdapterMessageEvent, **kwargs @@ -213,6 +212,7 @@ def decorator(obj): handler_md.event_filters.append(new_group) return RegisteringCommandable(new_group) + raise ValueError("注册指令组失败。") return decorator @@ -220,9 +220,11 @@ def decorator(obj): class RegisteringCommandable: """用于指令组级联注册""" - group: CommandGroupFilter = register_command_group - command: CommandFilter = register_command - custom_filter = register_custom_filter + group: Callable[..., Callable[..., "RegisteringCommandable"]] = ( + register_command_group + ) + command: Callable[..., Callable[..., None]] = register_command + custom_filter: Callable[..., Callable[..., None]] = register_custom_filter def __init__(self, parent_group: CommandGroupFilter): self.parent_group = parent_group