mirror of
https://github.com/xuthus83/LittlePaimon.git
synced 2024-12-16 13:40:53 +08:00
✨ 优化错误提示
This commit is contained in:
parent
59bb191941
commit
4e80c1bc09
@ -198,6 +198,7 @@ async def _(event: MessageEvent):
|
||||
async def _(event: MessageEvent, players=CommandPlayer(only_cn=False), characters=CommandCharacter()):
|
||||
logger.info('原神角色面板', '开始执行')
|
||||
msg = Message()
|
||||
try:
|
||||
if len(players) == 1:
|
||||
# 当查询对象只有一个时,查询所有角色
|
||||
gim = GenshinInfoManager(players[0].user_id, players[0].uid)
|
||||
@ -225,6 +226,10 @@ async def _(event: MessageEvent, players=CommandPlayer(only_cn=False), character
|
||||
img = await draw_chara_detail(player.uid, character_info)
|
||||
logger.info('原神角色面板', '➤➤➤', {}, '制图完成', True)
|
||||
msg += img
|
||||
except KeyError as e:
|
||||
msg = f'获取角色信息失败,缺少{e}的数据,可能是Enka.Network接口出现问题'
|
||||
except Exception as e:
|
||||
msg = f'获取角色信息失败,错误信息:{e}'
|
||||
await ysd.finish(msg, at_sender=True)
|
||||
|
||||
|
||||
@ -248,7 +253,7 @@ async def _(event: MessageEvent, state: T_State, uid=CommandUID()):
|
||||
gim = GenshinInfoManager(str(event.user_id), uid)
|
||||
result = await gim.update_all(include_talent)
|
||||
except KeyError as e:
|
||||
result = f'更新失败,缺少{e}的数据,请尝试更新bot版本'
|
||||
result = f'更新失败,缺少{e}的数据,可能是Enka.Network接口出现问题'
|
||||
except Exception as e:
|
||||
result = f'更新失败,错误信息:{e}'
|
||||
running_udi.remove(f'{event.user_id}-{uid}')
|
||||
|
@ -173,7 +173,14 @@ class GenshinInfoManager:
|
||||
if not character or character.update_time < (
|
||||
datetime.datetime.now() - datetime.timedelta(hours=config.ysd_auto_update)).replace(
|
||||
tzinfo=pytz.timezone('UTC')):
|
||||
try:
|
||||
await self.update_from_enka()
|
||||
except Exception as e:
|
||||
logger.info('原神角色面板', '➤➤', {'角色': name or character_id}, f'数据更新失败,可能是Enka.Network接口出现问题:{e}', False)
|
||||
if character:
|
||||
return character
|
||||
else:
|
||||
raise e
|
||||
if character := await Character.get_or_none(**query, data_source='enka'):
|
||||
logger.info('原神角色面板', '➤➤', {'角色': name or character_id}, '数据更新成功', True)
|
||||
else:
|
||||
|
Loading…
x
Reference in New Issue
Block a user