mirror of
https://github.com/TeamPGM/PagerMaid_Plugins_Pyro.git
synced 2024-11-22 03:19:18 +00:00
news60s 修复报错
This commit is contained in:
parent
d286db0c2a
commit
01f1e28d77
@ -27,7 +27,7 @@ async def get_news60s() -> None:
|
|||||||
return
|
return
|
||||||
resp = await client.get("https://api.03c3.cn/api/zb?type=jsonImg")
|
resp = await client.get("https://api.03c3.cn/api/zb?type=jsonImg")
|
||||||
res = resp.json()
|
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()
|
news_date = datetime.strptime(res["data"]["datetime"], "%Y-%m-%d").date()
|
||||||
if news_date == news60s_cache_date and not force_update:
|
if news_date == news60s_cache_date and not force_update:
|
||||||
return
|
return
|
||||||
@ -61,7 +61,7 @@ async def news60s(message: Message):
|
|||||||
if not message.arguments:
|
if not message.arguments:
|
||||||
try:
|
try:
|
||||||
await get_news60s()
|
await get_news60s()
|
||||||
except ValueError as e:
|
except (ValueError, AssertionError) as e:
|
||||||
return await message.edit(e.__str__())
|
return await message.edit(e.__str__())
|
||||||
await message.safe_delete()
|
await message.safe_delete()
|
||||||
await push_news60s(message.chat.id)
|
await push_news60s(message.chat.id)
|
||||||
|
Loading…
Reference in New Issue
Block a user