From c25184f3de298c461a47a9e29bee2a2d24958278 Mon Sep 17 00:00:00 2001 From: LittleMengBot <79637933+LittleMengBot@users.noreply.github.com> Date: Thu, 16 Mar 2023 15:47:24 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=A8=20Optimize=20`/gacha=5Flog`=20long?= =?UTF-8?q?=20image=20send=20method?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/genshin/wish_log.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/plugins/genshin/wish_log.py b/plugins/genshin/wish_log.py index 1ae24242..9b248f65 100644 --- a/plugins/genshin/wish_log.py +++ b/plugins/genshin/wish_log.py @@ -317,9 +317,16 @@ class WishLogPlugin(Plugin.Conversation): else: await message.reply_chat_action(ChatAction.UPLOAD_PHOTO) png_data = await self.template_service.render( - "genshin/gacha_log/gacha_log.html", data, full_page=True, query_selector=".body_box" + "genshin/gacha_log/gacha_log.html", + data, + full_page=True, + file_type=FileType.DOCUMENT if len(data.get("fiveLog")) > 36 else FileType.PHOTO, + query_selector=".body_box", ) - await png_data.reply_photo(message) + if png_data.file_type == FileType.DOCUMENT: + await png_data.reply_document(message, filename="抽卡记录.png") + else: + await png_data.reply_photo(message) except GachaLogNotFound: logger.info("未找到用户 %s[%s] 的抽卡记录", user.full_name, user.id) buttons = [