mirror of
https://github.com/PaiGramTeam/PaiGram.git
synced 2024-11-25 09:37:30 +00:00
✨ Add New Authkey Exception for Wish Log
This commit is contained in:
parent
6371db3b5e
commit
f5ebe19ff1
@ -14,7 +14,15 @@ class GachaLogAccountNotFound(GachaLogException):
|
||||
pass
|
||||
|
||||
|
||||
class GachaLogInvalidAuthkey(GachaLogException):
|
||||
class GachaLogAuthkeyException(GachaLogException):
|
||||
pass
|
||||
|
||||
|
||||
class GachaLogAuthkeyTimeout(GachaLogAuthkeyException):
|
||||
pass
|
||||
|
||||
|
||||
class GachaLogInvalidAuthkey(GachaLogAuthkeyException):
|
||||
pass
|
||||
|
||||
|
||||
|
@ -6,7 +6,7 @@ from pathlib import Path
|
||||
from typing import Dict, IO, List, Optional, Tuple, Union
|
||||
|
||||
import aiofiles
|
||||
from genshin import Client, InvalidAuthkey
|
||||
from genshin import Client, InvalidAuthkey, AuthkeyTimeout
|
||||
from genshin.models import BannerType
|
||||
from openpyxl import load_workbook
|
||||
|
||||
@ -22,6 +22,7 @@ from modules.gacha_log.error import (
|
||||
GachaLogMixedProvider,
|
||||
GachaLogNotFound,
|
||||
PaimonMoeGachaLogFileError,
|
||||
GachaLogAuthkeyTimeout,
|
||||
)
|
||||
from modules.gacha_log.models import (
|
||||
FiveStarItem,
|
||||
@ -241,6 +242,8 @@ class GachaLog:
|
||||
gacha_log.item_list[pool_name].append(item)
|
||||
temp_id_data[pool_name].append(item.id)
|
||||
new_num += 1
|
||||
except AuthkeyTimeout as exc:
|
||||
raise GachaLogAuthkeyTimeout from exc
|
||||
except InvalidAuthkey as exc:
|
||||
raise GachaLogInvalidAuthkey from exc
|
||||
for i in gacha_log.item_list.values():
|
||||
|
@ -3,6 +3,7 @@ from io import BytesIO
|
||||
|
||||
import genshin
|
||||
from aiofiles import open as async_open
|
||||
from genshin import AuthkeyTimeout
|
||||
from genshin.models import BannerType
|
||||
from telegram import Update, User, Message, Document, InlineKeyboardButton, InlineKeyboardMarkup
|
||||
from telegram.constants import ChatAction
|
||||
@ -26,6 +27,7 @@ from modules.gacha_log.error import (
|
||||
GachaLogNotFound,
|
||||
GachaLogAccountNotFound,
|
||||
GachaLogMixedProvider,
|
||||
GachaLogAuthkeyTimeout,
|
||||
)
|
||||
from modules.gacha_log.helpers import from_url_get_authkey
|
||||
from modules.gacha_log.log import GachaLog
|
||||
@ -89,6 +91,8 @@ class GachaLogPlugin(Plugin.Conversation, BasePlugin.Conversation):
|
||||
return "导入失败,数据格式错误"
|
||||
except GachaLogInvalidAuthkey:
|
||||
return "更新数据失败,authkey 无效"
|
||||
except GachaLogAuthkeyTimeout:
|
||||
return "更新数据失败,authkey 已经过期"
|
||||
except GachaLogMixedProvider:
|
||||
return "导入失败,你已经通过其他方式导入过抽卡记录了,本次无法导入"
|
||||
except UserNotFoundError:
|
||||
|
Loading…
Reference in New Issue
Block a user