From f3fe7139f7eedd7f262fc10c3f61f75b7f92fc39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B4=9B=E6=B0=B4=E5=B1=85=E5=AE=A4?= Date: Wed, 10 May 2023 17:30:28 +0800 Subject: [PATCH] :bug: Fix bug --- core/plugin/_funcs.py | 2 +- plugins/genshin/help_raw.py | 2 +- plugins/tools/player_info.py | 5 ++--- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/core/plugin/_funcs.py b/core/plugin/_funcs.py index 93722fb4..9266f94f 100644 --- a/core/plugin/_funcs.py +++ b/core/plugin/_funcs.py @@ -68,7 +68,7 @@ class PluginFuncs: except Forbidden as exc: logger.warning("删除消息 %s message_id[%s] 失败 %s", chat_info, message_id, exc.message) except Exception as exc: - logger.error("删除消息 %s message_id[%s] 失败 %s", chat_info, message_id, exc_info=exc) + logger.error("删除消息 %s message_id[%s] 失败", chat_info, message_id, exc_info=exc) async def get_chat(self, chat_id: Union[str, int], redis_db: Optional[RedisDB] = None, expire: int = 86400) -> Chat: application = self.application diff --git a/plugins/genshin/help_raw.py b/plugins/genshin/help_raw.py index 91211210..458bfdff 100644 --- a/plugins/genshin/help_raw.py +++ b/plugins/genshin/help_raw.py @@ -17,7 +17,7 @@ class HelpRawPlugin(Plugin): self.help_raw: Optional[str] = None async def initialize(self): - file_path = os.path.join(os.getcwd(), "resources", "bot", "help", "help.html") # resources/bot/help/help.html + file_path = os.path.join(os.getcwd(), "resources", "bot", "help", "help.jinja2") async with aiofiles.open(file_path, mode="r", encoding="utf-8") as f: html_content = await f.read() soup = BeautifulSoup(html_content, "lxml") diff --git a/plugins/tools/player_info.py b/plugins/tools/player_info.py index f1882382..9e4e168e 100644 --- a/plugins/tools/player_info.py +++ b/plugins/tools/player_info.py @@ -51,9 +51,8 @@ class PlayerInfoSystem(Plugin): player_info = await self.player_info_service.get(player) name_card: Optional[str] = None try: - if player_info is not None: - if player_info.name_card is not None: - name_card = (await self.assets_service.namecard(int(player_info.name_card)).navbar()).as_uri() + if player_info is not None and player_info.name_card is not None: + name_card = (await self.assets_service.namecard(int(player_info.name_card)).navbar()).as_uri() except Exception as exc: # pylint: disable=W0703 logger.error("卡片信息请求失败 %s", str(exc)) if name_card is None: # 默认