From 0ce0034a5615edd3bcd193027f502af18761ae7a Mon Sep 17 00:00:00 2001 From: GuGuMur <222153315@qq.com> Date: Tue, 1 Aug 2023 16:43:50 +0800 Subject: [PATCH] =?UTF-8?q?:ambulance:=20=E4=BF=AE=E6=AD=A3=E5=9B=BE?= =?UTF-8?q?=E7=89=87=E6=B8=B2=E6=9F=93=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nonebot_bison/platform/arknights.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/nonebot_bison/platform/arknights.py b/nonebot_bison/platform/arknights.py index b988bd4..5f82aff 100644 --- a/nonebot_bison/platform/arknights.py +++ b/nonebot_bison/platform/arknights.py @@ -51,11 +51,13 @@ class Arknights(NewMessage): raw_data = raw_data.json()["data"] announce_title = raw_data.get("header") if raw_data.get("header") != "" else raw_data.get("title") - # text = "游戏公告更新:" + announce_title.replace('\n','') text = "" pics = [] - if "content" in raw_data: + if raw_data["bannerImageUrl"]: + pics.append(raw_post["bannerImageUrl"]) + + elif raw_data["content"]: require("nonebot_plugin_htmlrender") from nonebot_plugin_htmlrender import template_to_pic @@ -69,7 +71,7 @@ class Arknights(NewMessage): "content": raw_data["content"], }, pages={ - "viewport": {"width": 500, "height": 100}, + "viewport": {"width": 400, "height": 100}, "base_url": f"file://{template_path}", }, ) @@ -82,8 +84,6 @@ class Arknights(NewMessage): pics.append(pic_data) else: text = "图片渲染失败" - elif "bannerImageUrl" in raw_data: - pics.append(raw_post["bannerImageUrl"]) # type: ignore else: raise CategoryNotRecognize("未找到可渲染部分") return Post(