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