From c3b2a3b623ce3d752d9dc54e9fdda3e67911c258 Mon Sep 17 00:00:00 2001 From: HibiKier <775757368@qq.com> Date: Tue, 28 May 2024 03:41:32 +0800 Subject: [PATCH] =?UTF-8?q?feat=E2=9C=A8:=20=E5=85=B3=E4=BA=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- zhenxun/plugins/about.py | 42 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 zhenxun/plugins/about.py diff --git a/zhenxun/plugins/about.py b/zhenxun/plugins/about.py new file mode 100644 index 00000000..35a0d237 --- /dev/null +++ b/zhenxun/plugins/about.py @@ -0,0 +1,42 @@ +from pathlib import Path + +from nonebot import on_regex +from nonebot.plugin import PluginMetadata +from nonebot.rule import to_me +from nonebot_plugin_alconna import Alconna, Arparma, on_alconna +from nonebot_plugin_saa import Text +from nonebot_plugin_session import EventSession + +from zhenxun.configs.utils import PluginExtraData +from zhenxun.services.log import logger + +__plugin_meta__ = PluginMetadata( + name="识番", + description="想要更加了解真寻吗", + usage=""" + 指令: + 关于 + """.strip(), + extra=PluginExtraData(author="HibiKier", version="0.1", menu_type="其他").dict(), +) + + +_matcher = on_alconna(Alconna("关于"), priority=5, block=True, rule=to_me()) + + +@_matcher.handle() +async def _(session: EventSession, arparma: Arparma): + ver_file = Path() / "__version__" + version = None + if ver_file.exists(): + with open(ver_file, "r", encoding="utf8") as f: + version = f.read().split(":")[-1].strip() + info = f""" +『绪山真寻Bot』 +版本:{version} +简介:基于Nonebot2开发,支持多平台,是一个非常可爱的Bot呀,希望与大家要好好相处 +项目地址:https://github.com/HibiKier/zhenxun_bot +文档地址:https://hibikier.github.io/zhenxun_bot/ + """.strip() + await Text(info).send() + logger.info("查看关于", arparma.header_result, session=session)