aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/hydroroll/plugins/HydroRoll_plugin_send/__init__.py
diff options
context:
space:
mode:
author简律纯 <hsiangnianian@outlook.com>2023-04-28 03:04:40 +0800
committer简律纯 <hsiangnianian@outlook.com>2023-04-28 03:04:40 +0800
commitc8c76cb2293001a3f5a8122e581648002033eb15 (patch)
tree26a4ded54d50d44ed8d0804f0109d4c38ac511d2 /hydroroll/plugins/HydroRoll_plugin_send/__init__.py
parent57a8f67b27aa617b7a993477231b3d6978f4f842 (diff)
downloadHydroRoll-0.1.0.tar.gz
HydroRoll-0.1.0.zip
Diffstat (limited to 'hydroroll/plugins/HydroRoll_plugin_send/__init__.py')
-rw-r--r--hydroroll/plugins/HydroRoll_plugin_send/__init__.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/hydroroll/plugins/HydroRoll_plugin_send/__init__.py b/hydroroll/plugins/HydroRoll_plugin_send/__init__.py
new file mode 100644
index 0000000..234e5b3
--- /dev/null
+++ b/hydroroll/plugins/HydroRoll_plugin_send/__init__.py
@@ -0,0 +1,28 @@
+import re
+
+from plugins.hydroroll_plugin_base import CommandPluginBase
+
+from .config import Config
+
+
+class Send(CommandPluginBase[None, Config]):
+ Config = Config
+
+ def __post_init__(self):
+ self.re_pattern = re.compile(r"\s*(?P<message>.*)", flags=re.I)
+
+ async def handle(self) -> None:
+ try:
+ await self.event.adapter.send(
+ self.msg_match.group("message"),
+ "private",
+ self.config.send_user_id,
+ )
+ except Exception as e:
+ if self.config.send_filed_msg is not None:
+ await self.event.reply(
+ self.format_str(self.config.send_filed_msg, repr(e))
+ )
+ else:
+ if self.config.send_success_msg is not None:
+ await self.event.reply(self.format_str(self.config.send_success_msg))