diff --git a/plugins/genshin/abyss.py b/plugins/genshin/abyss.py index cc793076..fca992a2 100644 --- a/plugins/genshin/abyss.py +++ b/plugins/genshin/abyss.py @@ -280,7 +280,7 @@ class AbyssPlugin(Plugin): def overview_task(): return -1, self.template_service.render( - "genshin/abyss/overview.html", render_data, viewport={"width": 750, "height": 580} + "genshin/abyss/overview.jinja2", render_data, viewport={"width": 750, "height": 580} ) def floor_task(floor_index: int): @@ -288,7 +288,7 @@ class AbyssPlugin(Plugin): return ( floor_d["floor"], self.template_service.render( - "genshin/abyss/floor.html", + "genshin/abyss/floor.jinja2", { **render_data, "floor": floor_d, @@ -314,7 +314,7 @@ class AbyssPlugin(Plugin): render_data["data"] = jsonlib.loads(result) return [ await self.template_service.render( - "genshin/abyss/overview.html", render_data, viewport={"width": 750, "height": 580} + "genshin/abyss/overview.jinja2", render_data, viewport={"width": 750, "height": 580} ) ] num_dic = { @@ -342,6 +342,6 @@ class AbyssPlugin(Plugin): render_data["total_stars"] = f"{floor_data[0]['stars']}/{floor_data[0]['max_stars']}" return [ await self.template_service.render( - "genshin/abyss/floor.html", render_data, viewport={"width": 690, "height": 500} + "genshin/abyss/floor.jinja2", render_data, viewport={"width": 690, "height": 500} ) ] diff --git a/plugins/genshin/abyss_team.py b/plugins/genshin/abyss_team.py index bc05e435..4a9b09fd 100644 --- a/plugins/genshin/abyss_team.py +++ b/plugins/genshin/abyss_team.py @@ -80,7 +80,7 @@ class AbyssTeamPlugin(Plugin): await message.reply_chat_action(ChatAction.UPLOAD_PHOTO) render_result = await self.template_service.render( - "genshin/abyss_team/abyss_team.html", + "genshin/abyss_team/abyss_team.jinja2", abyss_teams_data, {"width": 785, "height": 800}, full_page=True, diff --git a/plugins/genshin/avatar_list.py b/plugins/genshin/avatar_list.py index e1b96e3c..940cedab 100644 --- a/plugins/genshin/avatar_list.py +++ b/plugins/genshin/avatar_list.py @@ -239,7 +239,7 @@ class AvatarListPlugin(Plugin): await message.reply_chat_action(ChatAction.UPLOAD_DOCUMENT if as_document else ChatAction.UPLOAD_PHOTO) image = await self.template_service.render( - "genshin/avatar_list/main.html", + "genshin/avatar_list/main.jinja2", render_data, viewport={"width": 1040, "height": 500}, full_page=True, diff --git a/plugins/genshin/calendar.py b/plugins/genshin/calendar.py index 3a9d3f78..b7666853 100644 --- a/plugins/genshin/calendar.py +++ b/plugins/genshin/calendar.py @@ -52,7 +52,7 @@ class CalendarPlugin(Plugin): data = await self._fetch_data() data["display_mode"] = mode image = await self.template_service.render( - "genshin/calendar/calendar.html", + "genshin/calendar/calendar.jinja2", data, query_selector=".container", ) diff --git a/plugins/genshin/daily/material.py b/plugins/genshin/daily/material.py index 0d10793e..0d208c73 100644 --- a/plugins/genshin/daily/material.py +++ b/plugins/genshin/daily/material.py @@ -314,14 +314,14 @@ class DailyMaterial(Plugin): character_img_data, weapon_img_data = await asyncio.gather( self.template_service.render( # 渲染角色素材页 - "genshin/daily_material/character.html", + "genshin/daily_material/character.jinja2", {"data": render_data}, {"width": 1164, "height": 500}, file_type=file_type, ttl=30 * 24 * 60 * 60, ), self.template_service.render( # 渲染武器素材页 - "genshin/daily_material/weapon.html", + "genshin/daily_material/weapon.jinja2", {"data": render_data}, {"width": 1164, "height": 500}, file_type=file_type, diff --git a/plugins/genshin/daily_note.py b/plugins/genshin/daily_note.py index 021fd1ab..9f4ac147 100644 --- a/plugins/genshin/daily_note.py +++ b/plugins/genshin/daily_note.py @@ -82,7 +82,7 @@ class DailyNotePlugin(Plugin): "transformer_recovery_time": transformer_recovery_time, } render_result = await self.template_service.render( - "genshin/daily_note/daily_note.html", + "genshin/daily_note/daily_note.jinja2", render_data, {"width": 600, "height": 548}, full_page=False, diff --git a/plugins/genshin/help.py b/plugins/genshin/help.py index 51703837..bc18cf42 100644 --- a/plugins/genshin/help.py +++ b/plugins/genshin/help.py @@ -22,7 +22,7 @@ class HelpPlugin(Plugin): logger.info("用户 %s[%s] 发出help命令", user.full_name, user.id) await message.reply_chat_action(ChatAction.TYPING) render_result = await self.template_service.render( - "bot/help/help.html", + "bot/help/help.jinja2", {"bot_username": self.application.bot.username}, {"width": 1280, "height": 900}, ttl=30 * 24 * 60 * 60, diff --git a/plugins/genshin/ledger.py b/plugins/genshin/ledger.py index 68d5a9cf..efe40949 100644 --- a/plugins/genshin/ledger.py +++ b/plugins/genshin/ledger.py @@ -63,7 +63,7 @@ class LedgerPlugin(Plugin): "color": color, } render_result = await self.template_service.render( - "genshin/ledger/ledger.html", ledger_data, {"width": 580, "height": 610} + "genshin/ledger/ledger.jinja2", ledger_data, {"width": 580, "height": 610} ) return render_result diff --git a/plugins/genshin/material.py b/plugins/genshin/material.py index 1c93dfce..a5196314 100644 --- a/plugins/genshin/material.py +++ b/plugins/genshin/material.py @@ -181,7 +181,7 @@ class MaterialPlugin(Plugin): if not data: return return await self.template_service.render( - "genshin/material/roles_material.html", + "genshin/material/roles_material.jinja2", data, {"width": 960, "height": 1460}, full_page=True, diff --git a/plugins/genshin/player_cards.py b/plugins/genshin/player_cards.py index 5751cc7b..fd9c61af 100644 --- a/plugins/genshin/player_cards.py +++ b/plugins/genshin/player_cards.py @@ -228,7 +228,7 @@ class PlayerCards(Plugin): buttons = self.gen_button(data, user.id, uid, update_button=False) render_data = await self.parse_holder_data(data) holder = await self.template_service.render( - "genshin/player_card/holder.html", + "genshin/player_card/holder.jinja2", render_data, viewport={"width": 750, "height": 580}, ttl=60 * 10, @@ -492,13 +492,8 @@ class RenderTemplate: "DigitType": DigitType, } - # html = await self.template_service.render_async( - # "genshin/player_card/player_card.html", data - # ) - # logger.debug(html) - return await self.template_service.render( - "genshin/player_card/player_card.html", + "genshin/player_card/player_card.jinja2", data, {"width": 950, "height": 1080}, full_page=True, diff --git a/plugins/genshin/stats.py b/plugins/genshin/stats.py index 89a3ae49..94138127 100644 --- a/plugins/genshin/stats.py +++ b/plugins/genshin/stats.py @@ -113,15 +113,10 @@ class PlayerStatsPlugins(Plugin): "style": random.choice(["mondstadt", "liyue"]), # nosec } - # html = await self.template_service.render_async( - # "genshin/stats/stats.html", data - # ) - # logger.debug(html) - await self.cache_images(user_info) return await self.template_service.render( - "genshin/stats/stats.html", + "genshin/stats/stats.jinja2", data, {"width": 650, "height": 800}, full_page=True, diff --git a/plugins/genshin/weapon.py b/plugins/genshin/weapon.py index edfa983f..c3f8b412 100644 --- a/plugins/genshin/weapon.py +++ b/plugins/genshin/weapon.py @@ -120,7 +120,7 @@ class WeaponPlugin(Plugin): self.add_delete_message_job(reply_message) return png_data = await self.template_service.render( - "genshin/weapon/weapon.html", template_data, {"width": 540, "height": 540}, ttl=31 * 24 * 60 * 60 + "genshin/weapon/weapon.jinja2", template_data, {"width": 540, "height": 540}, ttl=31 * 24 * 60 * 60 ) await message.reply_chat_action(ChatAction.UPLOAD_PHOTO) reply_photo = await png_data.reply_photo( diff --git a/plugins/genshin/wish.py b/plugins/genshin/wish.py index 298b3e13..f51bf377 100644 --- a/plugins/genshin/wish.py +++ b/plugins/genshin/wish.py @@ -266,7 +266,7 @@ class WishSimulatorPlugin(Plugin): template_data["items"] = data await message.reply_chat_action(ChatAction.UPLOAD_PHOTO) png_data = await self.template_service.render( - "genshin/gacha/gacha.html", template_data, {"width": 1157, "height": 603}, False + "genshin/wish/wish.jinja2", template_data, {"width": 1157, "height": 603}, False ) reply_message = await message.reply_photo(png_data.photo) diff --git a/resources/bot/help/help.html b/resources/bot/help/example.html similarity index 99% rename from resources/bot/help/help.html rename to resources/bot/help/example.html index 69400a45..6a174540 100644 --- a/resources/bot/help/help.html +++ b/resources/bot/help/example.html @@ -11,7 +11,7 @@