aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/hydroroll/plugins/HydroRoll_plugin_echo
diff options
context:
space:
mode:
Diffstat (limited to 'hydroroll/plugins/HydroRoll_plugin_echo')
-rw-r--r--hydroroll/plugins/HydroRoll_plugin_echo/__init__.py17
-rw-r--r--hydroroll/plugins/HydroRoll_plugin_echo/config.py11
2 files changed, 28 insertions, 0 deletions
diff --git a/hydroroll/plugins/HydroRoll_plugin_echo/__init__.py b/hydroroll/plugins/HydroRoll_plugin_echo/__init__.py
new file mode 100644
index 0000000..e800384
--- /dev/null
+++ b/hydroroll/plugins/HydroRoll_plugin_echo/__init__.py
@@ -0,0 +1,17 @@
+import re
+
+from plugins.hydroroll_plugin_base import CommandPluginBase
+
+from .config import Config
+
+
+class Echo(CommandPluginBase[None, Config]):
+ Config = Config
+
+ def __post_init__(self):
+ self.re_pattern = re.compile(r"(?P<echo_str>.*)", flags=re.I)
+
+ async def handle(self) -> None:
+ await self.event.reply(
+ self.format_str(self.config.message_str, self.msg_match.group("echo_str"))
+ )
diff --git a/hydroroll/plugins/HydroRoll_plugin_echo/config.py b/hydroroll/plugins/HydroRoll_plugin_echo/config.py
new file mode 100644
index 0000000..030bbec
--- /dev/null
+++ b/hydroroll/plugins/HydroRoll_plugin_echo/config.py
@@ -0,0 +1,11 @@
+from typing import Set
+
+from plugins.hydroroll_plugin_base import CommandPluginConfig
+
+
+class Config(CommandPluginConfig):
+ __config_name__ = "plugin_echo"
+ command: Set[str] = {"echo"}
+ """命令文本。"""
+ message_str: str = "*{user_name} {message}"
+ """最终发送消息的格式。"""