mirror of
https://github.com/zhenxun-org/zhenxun_bot.git
synced 2026-10-04 03:10:01 +08:00
✨ 资源下载分离 (#1814)
* 🚀 资源文件单独下载,分离被动任务初始化 * 🔥 移除resources文件夹 * 🚀 优化版本更新逻辑,增加资源下载异常处理 * 🚀 增加资源下载失败异常处理及提示信息 * 🚀 增加资源下载选项及异常处理优化 * 🚀 移除空ID检查及资源更新条件处理 * ✨ 简易配置中未加载的配置将被移除 * 🐛 测试更新 * ✨ 修复更新完成消息格式 --------- Co-authored-by: Flern <cb56ec362bbbfb5272eb941281299d8d-qq_connect@git.osc>
This commit is contained in:
@@ -155,7 +155,7 @@ class UpdateManage:
|
||||
)
|
||||
|
||||
@classmethod
|
||||
async def update(cls, bot: Bot, user_id: str, version_type: str) -> str | None:
|
||||
async def update(cls, bot: Bot, user_id: str, version_type: str) -> str:
|
||||
"""更新操作
|
||||
|
||||
参数:
|
||||
@@ -171,7 +171,7 @@ class UpdateManage:
|
||||
url = None
|
||||
new_version = None
|
||||
repo_info = GithubUtils.parse_github_url(DEFAULT_GITHUB_URL)
|
||||
if version_type in {"dev", "main"}:
|
||||
if version_type in {"main"}:
|
||||
repo_info.branch = version_type
|
||||
new_version = await cls.__get_version_from_repo(repo_info)
|
||||
if new_version:
|
||||
@@ -203,14 +203,15 @@ class UpdateManage:
|
||||
if await AsyncHttpx.download_file(url, download_file, stream=True):
|
||||
logger.debug("下载真寻最新版文件完成...", "检查更新")
|
||||
await _file_handle(new_version)
|
||||
result = "版本更新完成"
|
||||
return (
|
||||
f"版本更新完成\n"
|
||||
f"{result}\n"
|
||||
f"版本: {cur_version} -> {new_version}\n"
|
||||
"请重新启动真寻以完成更新!"
|
||||
)
|
||||
else:
|
||||
logger.debug("下载真寻最新版文件失败...", "检查更新")
|
||||
return None
|
||||
return ""
|
||||
|
||||
@classmethod
|
||||
def __get_version(cls) -> str:
|
||||
|
||||
Reference in New Issue
Block a user