mirror of
https://github.com/PaiGramTeam/PamGram.git
synced 2024-11-16 03:55:26 +00:00
🐛 Fix query copper_man data
This commit is contained in:
parent
fed24a60f4
commit
a64d9a04bc
@ -22,6 +22,8 @@ if TYPE_CHECKING:
|
||||
|
||||
|
||||
__all__ = ("PlayerActivityPlugins",)
|
||||
ACTIVITY_DATA_ERROR = "活动数据有误"
|
||||
ACTIVITY_ATTR_ERROR = "活动数据有误 估计是彦卿晕了"
|
||||
|
||||
|
||||
class NotSupport(Exception):
|
||||
@ -31,6 +33,8 @@ class NotSupport(Exception):
|
||||
class NotHaveData(Exception):
|
||||
"""没有数据"""
|
||||
|
||||
MSG = "没有查找到此活动数据"
|
||||
|
||||
|
||||
class PlayerActivityPlugins(Plugin):
|
||||
"""玩家活动信息查询"""
|
||||
@ -79,12 +83,12 @@ class PlayerActivityPlugins(Plugin):
|
||||
async with self.helper.genshin(user.id) as client:
|
||||
render_result = await self.fantastic_story_render(client, uid)
|
||||
except AttributeError as exc:
|
||||
logger.error("活动数据有误")
|
||||
logger.error(ACTIVITY_DATA_ERROR)
|
||||
logger.exception(exc)
|
||||
await message.reply_text("活动数据有误 估计是彦卿晕了")
|
||||
await message.reply_text(ACTIVITY_ATTR_ERROR)
|
||||
return
|
||||
except NotHaveData:
|
||||
reply_message = await message.reply_text("没有查找到此活动数据")
|
||||
except NotHaveData as e:
|
||||
reply_message = await message.reply_text(e.MSG)
|
||||
if filters.ChatType.GROUPS.filter(reply_message):
|
||||
self.add_delete_message_job(message)
|
||||
self.add_delete_message_job(reply_message)
|
||||
@ -137,12 +141,12 @@ class PlayerActivityPlugins(Plugin):
|
||||
if render_result is None:
|
||||
raise NotHaveData
|
||||
except AttributeError as exc:
|
||||
logger.error("活动数据有误")
|
||||
logger.error(ACTIVITY_DATA_ERROR)
|
||||
logger.exception(exc)
|
||||
await message.reply_text("活动数据有误 估计是彦卿晕了")
|
||||
await message.reply_text(ACTIVITY_ATTR_ERROR)
|
||||
return
|
||||
except NotHaveData:
|
||||
reply_message = await message.reply_text("没有查找到此活动数据")
|
||||
except NotHaveData as e:
|
||||
reply_message = await message.reply_text(e.MSG)
|
||||
if filters.ChatType.GROUPS.filter(reply_message):
|
||||
self.add_delete_message_job(message)
|
||||
self.add_delete_message_job(reply_message)
|
||||
@ -202,12 +206,12 @@ class PlayerActivityPlugins(Plugin):
|
||||
async with self.helper.genshin(user.id) as client:
|
||||
render_result = await self.copper_man_render(client, uid)
|
||||
except AttributeError as exc:
|
||||
logger.error("活动数据有误")
|
||||
logger.error(ACTIVITY_DATA_ERROR)
|
||||
logger.exception(exc)
|
||||
await message.reply_text("活动数据有误 估计是彦卿晕了")
|
||||
await message.reply_text(ACTIVITY_ATTR_ERROR)
|
||||
return
|
||||
except NotHaveData:
|
||||
reply_message = await message.reply_text("没有查找到此活动数据")
|
||||
except NotHaveData as e:
|
||||
reply_message = await message.reply_text(e.MSG)
|
||||
if filters.ChatType.GROUPS.filter(reply_message):
|
||||
self.add_delete_message_job(message)
|
||||
self.add_delete_message_job(reply_message)
|
||||
@ -219,10 +223,10 @@ class PlayerActivityPlugins(Plugin):
|
||||
if uid is None:
|
||||
uid = client.player_id
|
||||
|
||||
act_data = await client.get_starrail_activity(uid)
|
||||
act_data = await client.get_starrail_resident(uid)
|
||||
try:
|
||||
copper_man_data = act_data.copper_man
|
||||
if not copper_man_data.exists_data:
|
||||
if not copper_man_data.base.exists_data:
|
||||
raise ValueError
|
||||
if not copper_man_data.info.exists_data:
|
||||
raise ValueError
|
||||
|
Loading…
Reference in New Issue
Block a user