From 2ea711e6290c6c433c536e7479d65d145113e85c Mon Sep 17 00:00:00 2001 From: Rock Chin <1010553892@qq.com> Date: Sun, 12 Mar 2023 22:43:02 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=9B=B4=E6=96=B0=E5=8C=85=E4=B8=AD?= =?UTF-8?q?=E5=8C=85=E5=90=AB=E6=96=B0=E6=96=87=E4=BB=B6=E6=97=B6=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E5=A4=B1=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkg/qqbot/command.py | 2 ++ pkg/utils/updater.py | 9 +++++++++ 2 files changed, 11 insertions(+) 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写入文件