From 5dcf17392ed421275608d832bc9ffe8d76858d91 Mon Sep 17 00:00:00 2001 From: SCUOP <92345079+SCUOP@users.noreply.github.com> Date: Mon, 8 Aug 2022 01:00:31 +0800 Subject: [PATCH] Update __init__.py --- Paimon_Info/__init__.py | 33 ++++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/Paimon_Info/__init__.py b/Paimon_Info/__init__.py index 5dffcb4..e48e7dc 100644 --- a/Paimon_Info/__init__.py +++ b/Paimon_Info/__init__.py @@ -700,22 +700,29 @@ async def coin_auto_sign(): logger.info('---派蒙开始执行米游币自动获取---') for user_id, uid, remind_id in data: sk = await get_private_stoken(uid, key='uid') - stoken = sk[0][4] - get_coin_task = MihoyoBBSCoin(stoken, user_id, uid) - data = await get_coin_task.run() - if get_coin_task.state is False: + try: + stoken = sk[0][4] + get_coin_task = MihoyoBBSCoin(stoken, user_id, uid) + data = await get_coin_task.run() + if get_coin_task.state is False: + await delete_coin_auto_sign(user_id, uid) + if remind_id.startswith('q'): + await get_bot().send_private_msg(user_id=remind_id[1:], + message=f'你的uid{uid}米游币获取失败,请重新绑定stoken再开启') + else: + ann[remind_id]['失败'].append(f'.UID{uid}') + else: + if remind_id.startswith('q'): + await get_bot().send_private_msg(user_id=remind_id[1:], + message=f'你的uid{uid}米游币自动获取成功') + else: + ann[remind_id]['成功'].append(f'.UID{uid}') + except: await delete_coin_auto_sign(user_id, uid) if remind_id.startswith('q'): await get_bot().send_private_msg(user_id=remind_id[1:], - message=f'你的uid{uid}米游币获取失败,请重新绑定cookie再开启') - else: - ann[remind_id]['失败'].append(f'.UID{uid}') - else: - if remind_id.startswith('q'): - await get_bot().send_private_msg(user_id=remind_id[1:], - message=f'你的uid{uid}米游币自动获取成功') - else: - ann[remind_id]['成功'].append(f'.UID{uid}') + message=f'你的uid{uid}米游币获取失败,请重新绑定stoken再开启') + logger.info('该成员未绑定stoken 获取失败, 已删除自动获取任务') for group_id, content in ann.items(): group_str = '米游币自动获取结果:\n' for type, ann_list in content.items():