From 45e627c33c1ed50d5b6952f151a5f9093f5eaa22 Mon Sep 17 00:00:00 2001 From: Alero Date: Fri, 14 Feb 2025 23:52:31 +0800 Subject: [PATCH] fix: a bug when add filter to root command group --- astrbot/core/star/register/star_handler.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/astrbot/core/star/register/star_handler.py b/astrbot/core/star/register/star_handler.py index bc40978c..2c8cc536 100644 --- a/astrbot/core/star/register/star_handler.py +++ b/astrbot/core/star/register/star_handler.py @@ -111,8 +111,9 @@ def register_custom_filter(custom_type_filter, *args, **kwargs): def decorator(awaitable): # 裸指令,子指令与指令组的区分,指令组会因为标记跳过wake。 - if not add_to_event_filters and isinstance(awaitable, RegisteringCommandable): - # 指令组,添加到本层的grouphandle中一起判断 + if not add_to_event_filters and isinstance(awaitable, RegisteringCommandable) or \ + (add_to_event_filters and isinstance(awaitable, RegisteringCommandable)): + # 指令组 与 根指令组,添加到本层的grouphandle中一起判断 awaitable.parent_group.add_custom_filter(custom_filter) else: handler_md = get_handler_or_create(awaitable, EventType.AdapterMessageEvent, **kwargs)