zhenxun_bot/zhenxun/builtin_plugins/about.py
2024-08-20 21:29:42 +08:00

42 lines
1.3 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

from pathlib import Path
from nonebot.plugin import PluginMetadata
from nonebot.rule import to_me
from nonebot_plugin_alconna import Alconna, Arparma, on_alconna
from nonebot_plugin_session import EventSession
from zhenxun.configs.utils import PluginExtraData
from zhenxun.services.log import logger
from zhenxun.utils.message import MessageUtils
__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 MessageUtils.build_message(info).send()
logger.info("查看关于", arparma.header_result, session=session)