更新模板和配置以支持自定义BOT名称

- 在帮助页面中使用配置的BOT名称替代硬编码的"真寻BOT"
- 更新自动更新配置,将资源模板文件夹加入替换列表
- 修改帮助插件以传递BOT名称到模板
- 修复签到插件中的商品描述拼写错误
This commit is contained in:
molanp 2024-10-05 13:55:22 +08:00
parent 6ddb27625a
commit e1610b2580
5 changed files with 10 additions and 2 deletions

View File

@ -14,7 +14,7 @@
<div class="wrapper"> <div class="wrapper">
<div class="main"> <div class="main">
<div style="margin-top: 30px;"></div> <div style="margin-top: 30px;"></div>
<div class="head-text">真寻BOT的使用方法</div> <div class="head-text">{{data.bot_name}}BOT的使用方法</div>
<div class="help-text">可以通过'帮助[功能名称或功能ID]'来获取对应功能的使用方法</div> <div class="help-text">可以通过'帮助[功能名称或功能ID]'来获取对应功能的使用方法</div>
<div class="avatar"> <div class="avatar">
<img class="avatar-img" src="{{data.ava}}" alt=""> <img class="avatar-img" src="{{data.ava}}" alt="">

View File

@ -1,4 +1,5 @@
import os import os
from pathlib import Path
import shutil import shutil
import tarfile import tarfile
import zipfile import zipfile
@ -98,6 +99,8 @@ def _file_handle(latest_version: str | None):
shutil.move(_req_file, REQ_TXT_FILE) shutil.move(_req_file, REQ_TXT_FILE)
for folder in REPLACE_FOLDERS: for folder in REPLACE_FOLDERS:
"""移动指定文件夹""" """移动指定文件夹"""
if isinstance(folder, list):
folder = Path(*folder)
_dir = BASE_PATH / folder _dir = BASE_PATH / folder
_backup_dir = BACKUP_PATH / folder _backup_dir = BACKUP_PATH / folder
if _backup_dir.exists(): if _backup_dir.exists():
@ -109,6 +112,8 @@ def _file_handle(latest_version: str | None):
else: else:
logger.warning(f"文件夹 {_dir} 不存在,跳过删除", "检查更新") logger.warning(f"文件夹 {_dir} 不存在,跳过删除", "检查更新")
for folder in REPLACE_FOLDERS: for folder in REPLACE_FOLDERS:
if isinstance(folder, list):
folder = Path(*folder)
src_folder_path = extract_path / folder src_folder_path = extract_path / folder
dest_folder_path = target_path / folder dest_folder_path = target_path / folder
if src_folder_path.exists(): if src_folder_path.exists():

View File

@ -29,6 +29,7 @@ DOWNLOAD_ZIP_FILE = TMP_PATH / DOWNLOAD_ZIP_FILE_STRING
REPLACE_FOLDERS = [ REPLACE_FOLDERS = [
"builtin_plugins", "builtin_plugins",
["resources", "template"],
"services", "services",
"utils", "utils",
"models", "models",

View File

@ -5,6 +5,7 @@ from zhenxun.utils.enum import BlockType
from zhenxun.utils.platform import PlatformUtils from zhenxun.utils.platform import PlatformUtils
from zhenxun.models.plugin_info import PluginInfo from zhenxun.models.plugin_info import PluginInfo
from zhenxun.configs.path_config import TEMPLATE_PATH from zhenxun.configs.path_config import TEMPLATE_PATH
from zhenxun.configs.config import BotConfig
from zhenxun.models.group_console import GroupConsole from zhenxun.models.group_console import GroupConsole
from ._utils import classify_plugin from ._utils import classify_plugin
@ -132,6 +133,7 @@ async def build_zhenxun_image(
"data": { "data": {
"plugin_list": plugin_list, "plugin_list": plugin_list,
"ava": PlatformUtils.get_user_avatar_url(bot_id, platform), "ava": PlatformUtils.get_user_avatar_url(bot_id, platform),
"bot_name": BotConfig.self_nickname,
} }
}, },
pages={ pages={

View File

@ -52,7 +52,7 @@ async def _(session: EventSession, user_id: int, prob: float):
@shop_register( @shop_register(
name="测试道具A", name="测试道具A",
price=99, price=99,
des="随便而出", des="随便而出",
load_status=False, load_status=False,
icon="sword.png", icon="sword.png",
) )