From 6769c724cb4dc373f418837b7f9cfdc134d6ff2b Mon Sep 17 00:00:00 2001 From: HibiKier <775757368@qq.com> Date: Wed, 16 Apr 2025 09:38:40 +0800 Subject: [PATCH] =?UTF-8?q?:bug:=20=E4=BF=AE=E5=A4=8D=E7=BE=A4=E8=A2=AB?= =?UTF-8?q?=E5=8A=A8=E5=BC=80=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- zhenxun/builtin_plugins/about.py | 39 ++++++++++++++++---------------- zhenxun/models/group_console.py | 4 ++-- 2 files changed, 22 insertions(+), 21 deletions(-) diff --git a/zhenxun/builtin_plugins/about.py b/zhenxun/builtin_plugins/about.py index faa0ba0e..31c77bc7 100644 --- a/zhenxun/builtin_plugins/about.py +++ b/zhenxun/builtin_plugins/about.py @@ -26,6 +26,21 @@ __plugin_meta__ = PluginMetadata( _matcher = on_alconna(Alconna("关于"), priority=5, block=True, rule=to_me()) +QQ_INFO = """ +『绪山真寻Bot』 +版本:{version} +简介:基于Nonebot2开发,支持多平台,是一个非常可爱的Bot呀,希望与大家要好好相处 +""".strip() + +INFO = """ +『绪山真寻Bot』 +版本:{version} +简介:基于Nonebot2开发,支持多平台,是一个非常可爱的Bot呀,希望与大家要好好相处 +项目地址:https://github.com/zhenxun-org/zhenxun_bot +文档地址:https://zhenxun-org.github.io/zhenxun_bot/ +""".strip() + + @_matcher.handle() async def _(session: Uninfo, arparma: Arparma): ver_file = Path() / "__version__" @@ -35,25 +50,11 @@ async def _(session: Uninfo, arparma: Arparma): if text := await f.read(): version = text.split(":")[-1].strip() if PlatformUtils.is_qbot(session): - info: list[str | Path] = [ - f""" -『绪山真寻Bot』 -版本:{version} -简介:基于Nonebot2开发,支持多平台,是一个非常可爱的Bot呀,希望与大家要好好相处 - """.strip() - ] + result: list[str | Path] = [QQ_INFO.format(version=version)] path = DATA_PATH / "about.png" if path.exists(): - info.append(path) + result.append(path) + await MessageUtils.build_message(result).send() # type: ignore else: - 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() # type: ignore - logger.info("查看关于", arparma.header_result, session=session) + await MessageUtils.build_message(INFO.format(version=version)).send() + logger.info("查看关于", arparma.header_result, session=session) diff --git a/zhenxun/models/group_console.py b/zhenxun/models/group_console.py index 0a0693d3..08406fa7 100644 --- a/zhenxun/models/group_console.py +++ b/zhenxun/models/group_console.py @@ -41,9 +41,9 @@ def convert_module_format(data: str | list[str]) -> str | list[str]: str | list[str]: 根据输入类型返回转换后的数据。 """ if isinstance(data, str): - return [item.strip(",") for item in data.split("<") if item] + return [item.strip(",") for item in data.split("<") if item.strip()] else: - return "".join(format(item) for item in data) + return "".join(add_disable_marker(item) for item in data) class GroupConsole(Model):