From 271b11a5fc26bb77883df290dbdc68b1be40d4a8 Mon Sep 17 00:00:00 2001 From: UnCLAS-Prommer Date: Sat, 17 May 2025 23:59:11 +0800 Subject: [PATCH] minor fix of template again --- pyproject.toml | 2 +- src/config.py | 2 +- src/recv_handler.py | 4 ++-- template/template_config.toml | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 8d6ec3c..e487205 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "MaiBotNapcatAdapter" -version = "0.2.1" +version = "0.2.2" description = "A MaiBot adapter for Napcat" [tool.ruff] diff --git a/src/config.py b/src/config.py index 8ac6c3d..53828df 100644 --- a/src/config.py +++ b/src/config.py @@ -57,7 +57,7 @@ class Config: self.list_type: str = raw_config["Chat"].get("list_type") self.group_list: list = raw_config["Chat"].get("group_list", []) - self.user_list: list = raw_config["Chat"].get("user_list", []) + self.private_list: list = raw_config["Chat"].get("private_list", []) self.ban_user_id: list = raw_config["Chat"].get("ban_user_id", []) if not self.list_type or self.list_type not in ["whitelist", "blacklist"]: logger.critical("请在配置文件中指定list_type或list_type填写错误") diff --git a/src/recv_handler.py b/src/recv_handler.py index 71df21c..96e5c02 100644 --- a/src/recv_handler.py +++ b/src/recv_handler.py @@ -83,10 +83,10 @@ class RecvHandler: logger.warning("群聊在黑名单中,消息被丢弃") return False else: - if global_config.list_type == "whitelist" and user_id not in global_config.user_list: + if global_config.list_type == "whitelist" and user_id not in global_config.private_list: logger.warning("用户不在白名单中,消息被丢弃") return False - elif global_config.list_type == "blacklist" and user_id in global_config.user_list: + elif global_config.list_type == "blacklist" and user_id in global_config.private_list: logger.warning("用户在黑名单中,消息被丢弃") return False if user_id in global_config.ban_user_id: diff --git a/template/template_config.toml b/template/template_config.toml index 42aaf3c..dba4b5d 100644 --- a/template/template_config.toml +++ b/template/template_config.toml @@ -16,7 +16,7 @@ list_type = "whitelist" # 使用的白名单类型,可选为:whitelist, blac # 当list_type为whitelist时,使用白名单模式,以下两个列表的含义是:仅允许名单中的人聊天 # 当list_type为blacklist时,使用黑名单模式,以下两个列表的含义是:禁止名单中的人聊天 group_list = [] # 群组名单 -user_list = [] # 私聊名单 +private_list = [] # 私聊名单 ban_user_id = [] # 禁止名单(禁止名单中的人无法使用任何功能) [Voice] # 发送语音设置