aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/hydroroll/plugins/plugin_bot/__init__.py
diff options
context:
space:
mode:
author简律纯 <hsiangnianian@outlook.com>2023-05-02 23:30:19 +0800
committer简律纯 <hsiangnianian@outlook.com>2023-05-02 23:30:19 +0800
commitdfa97c9d24b8124ca38ec5eb605cde932cd6ea78 (patch)
tree470a8bfd1960964b8c9724c19de876cf52cf60c3 /hydroroll/plugins/plugin_bot/__init__.py
parent45c49007ee01143ad26899751b856658321cd3ae (diff)
downloadHydroRoll-dfa97c9d24b8124ca38ec5eb605cde932cd6ea78.tar.gz
HydroRoll-dfa97c9d24b8124ca38ec5eb605cde932cd6ea78.zip
Diffstat (limited to 'hydroroll/plugins/plugin_bot/__init__.py')
-rw-r--r--hydroroll/plugins/plugin_bot/__init__.py30
1 files changed, 30 insertions, 0 deletions
diff --git a/hydroroll/plugins/plugin_bot/__init__.py b/hydroroll/plugins/plugin_bot/__init__.py
new file mode 100644
index 0000000..89ba17b
--- /dev/null
+++ b/hydroroll/plugins/plugin_bot/__init__.py
@@ -0,0 +1,30 @@
+import re
+from importlib.metadata import version
+from plugins.plugin_base import CommandPluginBase
+from hydroroll.config import GlobalConfig
+
+from .config import Config
+
+
+class HydroBot(CommandPluginBase[None, Config]):
+ Config = Config
+ CurrentConfig = GlobalConfig
+ priority = 0
+
+ def __post_init__(self):
+ self.re_pattern = re.compile(r"(?P<bot_info_str>.*)", flags=re.I)
+
+ def bot_info(self):
+ info_str = f'{self.CurrentConfig._name} '\
+ f'{self.CurrentConfig._version}({self.CurrentConfig._svn}) '\
+ f'by {self.CurrentConfig._author} '\
+ f'on Python {self.CurrentConfig._python_ver_raw} '\
+ f'with {" & ".join([adapter + "("+version("iamai-adapter-"+adapter) +")" for adapter in dict(self.bot.config.adapter)])} '\
+ f'for iamai({self.CurrentConfig._iamai_version})'
+
+ return info_str
+
+ async def handle(self) -> None:
+ await self.event.reply(
+ self.format_str(self.config.message_str, self.bot_info())
+ )