diff --git a/pyproject.toml b/pyproject.toml index e487205..b5dfa81 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "MaiBotNapcatAdapter" -version = "0.2.2" +version = "0.2.3" description = "A MaiBot adapter for Napcat" [tool.ruff] diff --git a/src/config.py b/src/config.py index 53828df..f0a4f0d 100644 --- a/src/config.py +++ b/src/config.py @@ -59,6 +59,7 @@ class Config: self.group_list: list = raw_config["Chat"].get("group_list", []) self.private_list: list = raw_config["Chat"].get("private_list", []) self.ban_user_id: list = raw_config["Chat"].get("ban_user_id", []) + self.enable_poke: bool = raw_config["Chat"].get("enable_poke", True) if not self.list_type or self.list_type not in ["whitelist", "blacklist"]: logger.critical("请在配置文件中指定list_type或list_type填写错误") sys.exit(1) diff --git a/src/recv_handler.py b/src/recv_handler.py index 96e5c02..279042e 100644 --- a/src/recv_handler.py +++ b/src/recv_handler.py @@ -494,7 +494,10 @@ class RecvHandler: sub_type = raw_message.get("sub_type") match sub_type: case NoticeType.Notify.poke: - handled_message: Seg = await self.handle_poke_notify(raw_message) + if global_config.enable_poke: + handled_message: Seg = await self.handle_poke_notify(raw_message) + else: + logger.warning("戳一戳消息被禁用") case _: logger.warning("不支持的notify类型") case _: diff --git a/template/template_config.toml b/template/template_config.toml index dba4b5d..5e94fac 100644 --- a/template/template_config.toml +++ b/template/template_config.toml @@ -18,6 +18,7 @@ list_type = "whitelist" # 使用的白名单类型,可选为:whitelist, blac group_list = [] # 群组名单 private_list = [] # 私聊名单 ban_user_id = [] # 禁止名单(禁止名单中的人无法使用任何功能) +enable_poke = true # 是否启用戳一戳功能 [Voice] # 发送语音设置 use_tts = false # 是否使用tts语音(请确保你配置了tts并有对应的adapter)