🐛 Fix FileNotFoundError in pay_log plugin

This commit is contained in:
xtaodada 2023-03-06 17:04:31 +08:00
parent fc4be627b4
commit 34bdd0ef53
Signed by: xtaodada
GPG Key ID: 4CBB3F4FA8C85659
2 changed files with 3 additions and 1 deletions

View File

@ -39,7 +39,7 @@ class PayLog:
user_id: str, user_id: str,
uid: str, uid: str,
bak: bool = False, bak: bool = False,
): ) -> Path:
"""获取文件路径 """获取文件路径
:param user_id: 用户 ID :param user_id: 用户 ID
:param uid: UID :param uid: UID

View File

@ -218,6 +218,8 @@ class PayLogPlugin(Plugin.Conversation, BasePlugin.Conversation):
client = await get_genshin_client(user.id, need_cookie=False) client = await get_genshin_client(user.id, need_cookie=False)
await message.reply_chat_action(ChatAction.TYPING) await message.reply_chat_action(ChatAction.TYPING)
path = self.pay_log.get_file_path(str(user.id), str(client.uid)) path = self.pay_log.get_file_path(str(user.id), str(client.uid))
if not path.exists():
raise PayLogNotFound
await message.reply_chat_action(ChatAction.UPLOAD_DOCUMENT) await message.reply_chat_action(ChatAction.UPLOAD_DOCUMENT)
await message.reply_document(document=open(path, "rb+"), caption="充值记录导出文件") await message.reply_document(document=open(path, "rb+"), caption="充值记录导出文件")
except PayLogNotFound: except PayLogNotFound: