diff --git a/pkg/qqbot/command.py b/pkg/qqbot/command.py index 1699ce39..d763a656 100644 --- a/pkg/qqbot/command.py +++ b/pkg/qqbot/command.py @@ -4,6 +4,7 @@ import json import datetime import os import threading +import traceback import pkg.openai.session import pkg.openai.manager @@ -362,6 +363,7 @@ def process_command(session_name: str, text_message: str, mgr, config, else: pkg.utils.context.get_qqbot_manager().notify_admin("无新版本") except Exception as e0: + traceback.print_exc() pkg.utils.context.get_qqbot_manager().notify_admin("更新失败:{}".format(e0)) return diff --git a/pkg/utils/updater.py b/pkg/utils/updater.py index d2d89517..d8398c03 100644 --- a/pkg/utils/updater.py +++ b/pkg/utils/updater.py @@ -126,6 +126,15 @@ def update_all(cli: bool = False) -> bool: dst = src.replace(source_root, ".") if os.path.exists(dst): os.remove(dst) + + # 检查目标文件夹是否存在 + if not os.path.exists(os.path.dirname(dst)): + os.makedirs(os.path.dirname(dst)) + # 检查目标文件是否存在 + if not os.path.exists(dst): + # 创建目标文件 + open(dst, "w").close() + shutil.copy(src, dst) # 把current_tag写入文件