mirror of
https://github.com/PaiGramTeam/PamGram.git
synced 2024-11-21 21:58:04 +00:00
🐛 Fix plugin not handling notice correctly in InvalidCookies
exception
This commit is contained in:
parent
b7d2e1962a
commit
762c9bc907
@ -4,7 +4,7 @@ from typing import Iterable, List, Optional, Sequence
|
|||||||
|
|
||||||
from arkowrapper import ArkoWrapper
|
from arkowrapper import ArkoWrapper
|
||||||
from enkanetwork import Assets as EnkaAssets, EnkaNetworkAPI
|
from enkanetwork import Assets as EnkaAssets, EnkaNetworkAPI
|
||||||
from genshin import Client, GenshinException
|
from genshin import Client, GenshinException, InvalidCookies
|
||||||
from genshin.models import CalculatorCharacterDetails, CalculatorTalent, Character
|
from genshin.models import CalculatorCharacterDetails, CalculatorTalent, Character
|
||||||
from telegram import InlineKeyboardButton, InlineKeyboardMarkup, Message, Update, User
|
from telegram import InlineKeyboardButton, InlineKeyboardMarkup, Message, Update, User
|
||||||
from telegram.constants import ChatAction, ParseMode
|
from telegram.constants import ChatAction, ParseMode
|
||||||
@ -198,6 +198,9 @@ class AvatarListPlugin(Plugin, BasePlugin):
|
|||||||
avatar_datas: List[AvatarData] = await self.get_avatars_data(
|
avatar_datas: List[AvatarData] = await self.get_avatars_data(
|
||||||
characters, client, None if all_avatars else 20
|
characters, client, None if all_avatars else 20
|
||||||
)
|
)
|
||||||
|
except InvalidCookies as e:
|
||||||
|
await notice.delete()
|
||||||
|
raise e
|
||||||
except GenshinException as e:
|
except GenshinException as e:
|
||||||
if e.retcode == -502002:
|
if e.retcode == -502002:
|
||||||
self._add_delete_message_job(context, notice.chat_id, notice.message_id, 5)
|
self._add_delete_message_job(context, notice.chat_id, notice.message_id, 5)
|
||||||
|
@ -274,6 +274,8 @@ class DailyMaterial(Plugin, BasePlugin):
|
|||||||
try:
|
try:
|
||||||
skills = await self._get_skills_data(client, i.gid)
|
skills = await self._get_skills_data(client, i.gid)
|
||||||
i.skills = skills
|
i.skills = skills
|
||||||
|
except InvalidCookies:
|
||||||
|
calculator_sync = False
|
||||||
except GenshinException as e:
|
except GenshinException as e:
|
||||||
if e.retcode == -502002:
|
if e.retcode == -502002:
|
||||||
calculator_sync = False # 发现角色养成计算器没启用 设置状态为 False 并防止下次继续获取
|
calculator_sync = False # 发现角色养成计算器没启用 设置状态为 False 并防止下次继续获取
|
||||||
|
Loading…
Reference in New Issue
Block a user