From 01f1e28d77c39f03e9bd69a405b6e92b50c74edc Mon Sep 17 00:00:00 2001 From: omg-xtao <100690902+omg-xtao@users.noreply.github.com> Date: Mon, 8 Jan 2024 12:02:08 +0800 Subject: [PATCH] =?UTF-8?q?news60s=20=E4=BF=AE=E5=A4=8D=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- news60s/main.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/news60s/main.py b/news60s/main.py index bfc6a7e..59d2379 100644 --- a/news60s/main.py +++ b/news60s/main.py @@ -27,7 +27,7 @@ async def get_news60s() -> None: return resp = await client.get("https://api.03c3.cn/api/zb?type=jsonImg") res = resp.json() - assert res["msg"] == "success", f"API 返回错误: {res['code']} ({res['msg']})" + assert res["msg"] == "ok", f"API 返回错误: {res['code']} ({res['msg']})" news_date = datetime.strptime(res["data"]["datetime"], "%Y-%m-%d").date() if news_date == news60s_cache_date and not force_update: return @@ -61,7 +61,7 @@ async def news60s(message: Message): if not message.arguments: try: await get_news60s() - except ValueError as e: + except (ValueError, AssertionError) as e: return await message.edit(e.__str__()) await message.safe_delete() await push_news60s(message.chat.id)