diff options
| author | 2023-04-19 16:58:55 +0800 | |
|---|---|---|
| committer | 2023-04-19 16:58:55 +0800 | |
| commit | bfac2edccf0f83caab5321587de3d7876fd52871 (patch) | |
| tree | e71d59e0ef7d642a712ba963b7b5096c454b96c1 /ChienDice/plugins/iamai_plugin_base | |
| parent | 23b32b900423ae8fe36a50224f0308cb3d97d4d0 (diff) | |
| download | HydroRoll-bfac2edccf0f83caab5321587de3d7876fd52871.tar.gz HydroRoll-bfac2edccf0f83caab5321587de3d7876fd52871.zip | |
🐛修复指令前缀bug失效问题
Diffstat (limited to 'ChienDice/plugins/iamai_plugin_base')
| -rw-r--r-- | ChienDice/plugins/iamai_plugin_base/__init__.py | 2 | ||||
| -rw-r--r-- | ChienDice/plugins/iamai_plugin_base/config.py | 4 |
2 files changed, 3 insertions, 3 deletions
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<command_args>.*)", 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] = {} """命令文本。""" |
