mirror of
https://github.com/PaiGramTeam/PamGram.git
synced 2024-11-16 12:02:16 +00:00
🐛 修复回复消息时 photo
为 None
引发的错误
This commit is contained in:
parent
ab2c0226b8
commit
55f3086c4c
@ -1,4 +1,4 @@
|
||||
from typing import Any, List, Tuple, Union
|
||||
from typing import Any, List, Tuple, Union, Optional
|
||||
|
||||
from enkanetwork import (
|
||||
CharacterInfo,
|
||||
@ -44,7 +44,7 @@ class PlayerCards(Plugin, BasePlugin):
|
||||
self.user_service = user_service
|
||||
self.client = EnkaNetworkAPI(lang="chs", agent=config.enka_network_api_agent)
|
||||
self.template_service = template_service
|
||||
self.temp_photo = open("resources/img/kitsune.png", "rb")
|
||||
self.temp_photo: Optional[str] = None
|
||||
|
||||
async def _fetch_user(self, uid) -> Union[EnkaNetworkResponse, str]:
|
||||
try:
|
||||
@ -115,8 +115,12 @@ class PlayerCards(Plugin, BasePlugin):
|
||||
temp = []
|
||||
if len(temp) > 0:
|
||||
buttons.append(temp)
|
||||
if isinstance(self.temp_photo, str):
|
||||
photo = self.temp_photo
|
||||
else:
|
||||
photo = open("resources/img/kitsune.png", "rb")
|
||||
reply_message = await message.reply_photo(
|
||||
photo=self.temp_photo, caption="请选择你要查询的角色", reply_markup=InlineKeyboardMarkup(buttons)
|
||||
photo=photo, caption="请选择你要查询的角色", reply_markup=InlineKeyboardMarkup(buttons)
|
||||
)
|
||||
if reply_message.photo:
|
||||
self.temp_photo = reply_message.photo[-1].file_id
|
||||
|
Loading…
Reference in New Issue
Block a user