From e1610b25805a413f8fc2c6479a03e1050ad0ed2d Mon Sep 17 00:00:00 2001 From: molanp <104612722+molanp@users.noreply.github.com> Date: Sat, 5 Oct 2024 13:55:22 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=A8=A1=E6=9D=BF=E5=92=8C?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E4=BB=A5=E6=94=AF=E6=8C=81=E8=87=AA=E5=AE=9A?= =?UTF-8?q?=E4=B9=89BOT=E5=90=8D=E7=A7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在帮助页面中使用配置的BOT名称替代硬编码的"真寻BOT" - 更新自动更新配置,将资源模板文件夹加入替换列表 - 修改帮助插件以传递BOT名称到模板 - 修复签到插件中的商品描述拼写错误 --- resources/template/ss_menu/main.html | 2 +- zhenxun/builtin_plugins/auto_update/_data_source.py | 5 +++++ zhenxun/builtin_plugins/auto_update/config.py | 1 + zhenxun/builtin_plugins/help/zhenxun_help.py | 2 ++ zhenxun/builtin_plugins/sign_in/goods_register.py | 2 +- 5 files changed, 10 insertions(+), 2 deletions(-) diff --git a/resources/template/ss_menu/main.html b/resources/template/ss_menu/main.html index 6c91ab74..96b08b15 100644 --- a/resources/template/ss_menu/main.html +++ b/resources/template/ss_menu/main.html @@ -14,7 +14,7 @@
-
真寻BOT的使用方法
+
{{data.bot_name}}BOT的使用方法
可以通过'帮助[功能名称或功能ID]'来获取对应功能的使用方法
diff --git a/zhenxun/builtin_plugins/auto_update/_data_source.py b/zhenxun/builtin_plugins/auto_update/_data_source.py index be5e3b23..57ef4732 100644 --- a/zhenxun/builtin_plugins/auto_update/_data_source.py +++ b/zhenxun/builtin_plugins/auto_update/_data_source.py @@ -1,4 +1,5 @@ import os +from pathlib import Path import shutil import tarfile import zipfile @@ -98,6 +99,8 @@ def _file_handle(latest_version: str | None): shutil.move(_req_file, REQ_TXT_FILE) for folder in REPLACE_FOLDERS: """移动指定文件夹""" + if isinstance(folder, list): + folder = Path(*folder) _dir = BASE_PATH / folder _backup_dir = BACKUP_PATH / folder if _backup_dir.exists(): @@ -109,6 +112,8 @@ def _file_handle(latest_version: str | None): else: logger.warning(f"文件夹 {_dir} 不存在,跳过删除", "检查更新") for folder in REPLACE_FOLDERS: + if isinstance(folder, list): + folder = Path(*folder) src_folder_path = extract_path / folder dest_folder_path = target_path / folder if src_folder_path.exists(): diff --git a/zhenxun/builtin_plugins/auto_update/config.py b/zhenxun/builtin_plugins/auto_update/config.py index b4c61345..53d4d7f7 100644 --- a/zhenxun/builtin_plugins/auto_update/config.py +++ b/zhenxun/builtin_plugins/auto_update/config.py @@ -29,6 +29,7 @@ DOWNLOAD_ZIP_FILE = TMP_PATH / DOWNLOAD_ZIP_FILE_STRING REPLACE_FOLDERS = [ "builtin_plugins", + ["resources", "template"], "services", "utils", "models", diff --git a/zhenxun/builtin_plugins/help/zhenxun_help.py b/zhenxun/builtin_plugins/help/zhenxun_help.py index a08b49e3..2936bc77 100644 --- a/zhenxun/builtin_plugins/help/zhenxun_help.py +++ b/zhenxun/builtin_plugins/help/zhenxun_help.py @@ -5,6 +5,7 @@ from zhenxun.utils.enum import BlockType from zhenxun.utils.platform import PlatformUtils from zhenxun.models.plugin_info import PluginInfo from zhenxun.configs.path_config import TEMPLATE_PATH +from zhenxun.configs.config import BotConfig from zhenxun.models.group_console import GroupConsole from ._utils import classify_plugin @@ -132,6 +133,7 @@ async def build_zhenxun_image( "data": { "plugin_list": plugin_list, "ava": PlatformUtils.get_user_avatar_url(bot_id, platform), + "bot_name": BotConfig.self_nickname, } }, pages={ diff --git a/zhenxun/builtin_plugins/sign_in/goods_register.py b/zhenxun/builtin_plugins/sign_in/goods_register.py index a280d9a7..13058e46 100644 --- a/zhenxun/builtin_plugins/sign_in/goods_register.py +++ b/zhenxun/builtin_plugins/sign_in/goods_register.py @@ -52,7 +52,7 @@ async def _(session: EventSession, user_id: int, prob: float): @shop_register( name="测试道具A", price=99, - des="随便侧而出", + des="随便测而出", load_status=False, icon="sword.png", )