From 77f577404bb91e4ba0131e64ed17a05a21656421 Mon Sep 17 00:00:00 2001 From: SlyAimer <2289782085@qq.com> Date: Fri, 11 Apr 2025 09:57:50 +0800 Subject: [PATCH] =?UTF-8?q?fix(daily=5Freport):=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E6=97=A5=E6=8A=A5=E8=8E=B7=E5=8F=96=E9=94=99=E8=AF=AF=E5=A4=84?= =?UTF-8?q?=E7=90=86=E5=8F=8A=E6=97=A5=E5=BF=97=E8=AE=B0=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/plugins/daily_report.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/plugins/daily_report.py b/src/plugins/daily_report.py index acc806c..400f24a 100644 --- a/src/plugins/daily_report.py +++ b/src/plugins/daily_report.py @@ -5,6 +5,7 @@ from nonebot.plugin import on_command from nonebot.adapters.qq import MessageSegment from src.clover_report.data_source import Report from src.configs.path_config import temp_path +from nonebot import logger import os @@ -15,5 +16,9 @@ async def handle_function(): file = Path() / temp_path / f"{now.date()}日报.png" if not os.path.exists(file): await daily_report.send("您是今天第一个查看日报的哦,来看看世界上都发生了些什么吧💫\nCrunching the latest news, just for you. Hang tight…") - await Report.get_report_image() + try: + await Report.get_report_image() + except Exception as e: + logger.error(f"日报获取失败:{e}") + await daily_report.finish("出错啦,请重试。") await daily_report.finish(MessageSegment.file_image(Path(temp_path+f"{now.date()}日报.png")))