diff --git a/astrbot/core/config/default.py b/astrbot/core/config/default.py index f7a0201b4..5e86c0f59 100644 --- a/astrbot/core/config/default.py +++ b/astrbot/core/config/default.py @@ -17,6 +17,7 @@ DEFAULT_CONFIG = { }, "reply_prefix": "", "forward_threshold": 200, + "enable_id_white_list": True, "id_whitelist": [], "id_whitelist_log": True, "wl_ignore_admin_on_group": True, @@ -162,6 +163,10 @@ CONFIG_METADATA_2 = { "type": "int", "hint": "超过一定字数后,机器人会将消息折叠成 QQ 群聊的 “转发消息”,以防止刷屏。目前仅 QQ 平台适配器适用。", }, + "enable_id_white_list": { + "description": "启用 ID 白名单", + "type": "bool" + }, "id_whitelist": { "description": "ID 白名单", "type": "list", diff --git a/astrbot/core/pipeline/whitelist_check/stage.py b/astrbot/core/pipeline/whitelist_check/stage.py index b2b713a6a..6a4e7097e 100644 --- a/astrbot/core/pipeline/whitelist_check/stage.py +++ b/astrbot/core/pipeline/whitelist_check/stage.py @@ -10,12 +10,16 @@ class WhitelistCheckStage(Stage): '''检查是否在群聊/私聊白名单 ''' async def initialize(self, ctx: PipelineContext) -> None: + self.enable_whitelist_check = ctx.astrbot_config['platform_settings']['enable_id_white_list'] self.whitelist = ctx.astrbot_config['platform_settings']['id_whitelist'] self.wl_ignore_admin_on_group = ctx.astrbot_config['platform_settings']['wl_ignore_admin_on_group'] self.wl_ignore_admin_on_friend = ctx.astrbot_config['platform_settings']['wl_ignore_admin_on_friend'] self.wl_log = ctx.astrbot_config['platform_settings']['id_whitelist_log'] async def process(self, event: AstrMessageEvent) -> Union[None, AsyncGenerator[None, None]]: + if not self.enable_whitelist_check: + return + # 检查是否在白名单 if self.wl_ignore_admin_on_group: if event.role == 'admin' and event.get_message_type() == MessageType.GROUP_MESSAGE: