mirror of
https://github.com/zhenxun-org/zhenxun_bot.git
synced 2025-12-15 14:22:55 +08:00
✨ feat(update): 优化资源更新逻辑,调整更新路径和消息处理
This commit is contained in:
parent
050ef43a44
commit
a4a31f1474
@ -86,7 +86,7 @@ from bag_users t1
|
||||
@PriorityLifecycle.on_startup(priority=5)
|
||||
async def _():
|
||||
if not ZhenxunRepoManager.check_resources_exists():
|
||||
await ZhenxunRepoManager.resources_update(branch="test")
|
||||
await ZhenxunRepoManager.resources_update()
|
||||
"""签到与用户的数据迁移"""
|
||||
if goods_list := await GoodsInfo.filter(uuid__isnull=True).all():
|
||||
for goods in goods_list:
|
||||
|
||||
@ -100,7 +100,6 @@ async def _(
|
||||
source_str, # type: ignore
|
||||
zip.result,
|
||||
)
|
||||
await MessageUtils.build_message(result).finish(reply_to=True)
|
||||
except Exception as e:
|
||||
logger.error("版本更新失败...", "检查更新", session=session, e=e)
|
||||
await MessageUtils.build_message(f"更新版本失败...e: {e}").finish()
|
||||
|
||||
@ -45,11 +45,11 @@ class ZhenxunRepoConfig:
|
||||
ZHENXUN_BOT_BACKUP_PATH = Path() / "backup"
|
||||
# 需要替换的文件夹
|
||||
ZHENXUN_BOT_UPDATE_FOLDERS: ClassVar[list[str]] = [
|
||||
"builtin_plugins",
|
||||
"services",
|
||||
"utils",
|
||||
"models",
|
||||
"configs",
|
||||
"zhenxun/builtin_plugins",
|
||||
"zhenxun/services",
|
||||
"zhenxun/utils",
|
||||
"zhenxun/models",
|
||||
"zhenxun/configs",
|
||||
]
|
||||
ZHENXUN_BOT_VERSION_FILE_STRING = "__version__"
|
||||
ZHENXUN_BOT_VERSION_FILE = Path() / ZHENXUN_BOT_VERSION_FILE_STRING
|
||||
@ -262,11 +262,10 @@ class ZhenxunRepoManagerClass:
|
||||
self.config.ZHENXUN_BOT_UNZIP_PATH / filename,
|
||||
Path() / filename,
|
||||
)
|
||||
logger.debug("备份真寻更新文件完成!", LOG_COMMAND)
|
||||
unzip_dir = next(self.config.ZHENXUN_BOT_UNZIP_PATH.iterdir())
|
||||
for folder in self.config.ZHENXUN_BOT_UPDATE_FOLDERS:
|
||||
self.__copy_files(
|
||||
self.config.ZHENXUN_BOT_UNZIP_PATH / folder,
|
||||
self.config.ZHENXUN_BOT_CODE_PATH / folder,
|
||||
)
|
||||
self.__copy_files(unzip_dir / folder, Path() / folder)
|
||||
logger.debug("移动真寻更新文件完成!", LOG_COMMAND)
|
||||
if self.config.ZHENXUN_BOT_UNZIP_PATH.exists():
|
||||
shutil.rmtree(self.config.ZHENXUN_BOT_UNZIP_PATH)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user