From fd460b19d45d2b326473cd781c6d929e1a228ce9 Mon Sep 17 00:00:00 2001 From: Alero Date: Fri, 14 Feb 2025 20:43:54 +0800 Subject: [PATCH] fix: cleancode err --- astrbot/core/star/filter/command.py | 1 - astrbot/core/star/filter/command_group.py | 1 - astrbot/core/star/register/star_handler.py | 4 +--- 3 files changed, 1 insertion(+), 5 deletions(-) diff --git a/astrbot/core/star/filter/command.py b/astrbot/core/star/filter/command.py index d34d19a00..e0b6d47e2 100644 --- a/astrbot/core/star/filter/command.py +++ b/astrbot/core/star/filter/command.py @@ -8,7 +8,6 @@ from astrbot.core.config import AstrBotConfig from astrbot.core.utils.param_validation_mixin import ParameterValidationMixin from .custom_filter import CustomFilter from ..star_handler import StarHandlerMetadata -from ... import logger # 标准指令受到 wake_prefix 的制约。 class CommandFilter(HandlerFilter, ParameterValidationMixin): diff --git a/astrbot/core/star/filter/command_group.py b/astrbot/core/star/filter/command_group.py index e75efbfd5..cf7472edf 100644 --- a/astrbot/core/star/filter/command_group.py +++ b/astrbot/core/star/filter/command_group.py @@ -8,7 +8,6 @@ from astrbot.core.platform.astr_message_event import AstrMessageEvent from astrbot.core.config import AstrBotConfig from .custom_filter import CustomFilter from ..star_handler import StarHandlerMetadata -from ... import logger # 指令组受到 wake_prefix 的制约。 class CommandGroupFilter(HandlerFilter): diff --git a/astrbot/core/star/register/star_handler.py b/astrbot/core/star/register/star_handler.py index 320915a5c..14b710ace 100644 --- a/astrbot/core/star/register/star_handler.py +++ b/astrbot/core/star/register/star_handler.py @@ -1,6 +1,5 @@ from __future__ import annotations import docstring_parser -import traceback from ..star_handler import star_handlers_registry, StarHandlerMetadata, EventType from ..filter.command import CommandFilter @@ -10,7 +9,7 @@ from ..filter.platform_adapter_type import PlatformAdapterTypeFilter, PlatformAd from ..filter.permission import PermissionTypeFilter, PermissionType from ..filter.custom_filter import CustomFilter from ..filter.regex import RegexFilter -from typing import Awaitable, Union +from typing import Awaitable from astrbot.core.provider.func_tool_manager import SUPPORTED_TYPES from astrbot.core.provider.register import llm_tools from astrbot.core import logger @@ -118,7 +117,6 @@ def register_custom_filter(custom_type_filter: CustomFilter, *args, **kwargs): if not add_to_event_filters and not isinstance(awaitable, RegisteringCommandable): # 底层子指令 handle_full_name = get_handler_full_name(awaitable) - command_handle = None for sub_handle in parent_rigister_commandable.parent_group.sub_command_filters: # 所有符合fullname一致的子指令handle添加自定义过滤器。 # 不确定是否会有多个子指令有一样的fullname,比如一个方法添加多个command装饰器?