From bfac2edccf0f83caab5321587de3d7876fd52871 Mon Sep 17 00:00:00 2001 From: 简律纯 Date: Wed, 19 Apr 2023 16:58:55 +0800 Subject: 🐛修复指令前缀bug失效问题 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ChienDice/plugins/iamai_plugin_base/__init__.py | 2 +- ChienDice/plugins/iamai_plugin_base/config.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'ChienDice/plugins/iamai_plugin_base') diff --git a/ChienDice/plugins/iamai_plugin_base/__init__.py b/ChienDice/plugins/iamai_plugin_base/__init__.py index e99ce15..fe0cd32 100644 --- a/ChienDice/plugins/iamai_plugin_base/__init__.py +++ b/ChienDice/plugins/iamai_plugin_base/__init__.py @@ -70,7 +70,7 @@ class CommandPluginBase(RegexPluginBase[T_State, T_CommandPluginConfig], ABC): def str_match(self, msg_str: str) -> bool: if not hasattr(self, "command_re_pattern"): self.command_re_pattern = re.compile( - f'({"|".join(self.config.command_prefix)})' + f'[{"".join(self.config.command_prefix)}]' f'({"|".join(self.config.command)})' r"\s*(?P.*)", flags=re.I if self.config.ignore_case else 0, diff --git a/ChienDice/plugins/iamai_plugin_base/config.py b/ChienDice/plugins/iamai_plugin_base/config.py index b410888..c36d03e 100644 --- a/ChienDice/plugins/iamai_plugin_base/config.py +++ b/ChienDice/plugins/iamai_plugin_base/config.py @@ -5,7 +5,7 @@ from iamai import ConfigModel class BasePluginConfig(ConfigModel): __config_name__ = "" - handle_all_message: bool = False + handle_all_message: bool = True """是否处理所有类型的消息,此配置为 True 时会覆盖 handle_friend_message 和 handle_group_message。""" handle_friend_message: bool = True """是否处理好友消息。""" @@ -22,7 +22,7 @@ class RegexPluginConfig(BasePluginConfig): class CommandPluginConfig(RegexPluginConfig): - command_prefix: Set[str] = {".", "。"} + command_prefix: Set[str] = {".", "。","!"} """命令前缀。""" command: Set[str] = {} """命令文本。""" -- cgit v1.2.3-70-g09d2