Merge pull request #164 from nicklly/nonebot2

修复无法判断已绑定cookie导致报错
This commit is contained in:
惜月 2022-08-06 11:51:57 -05:00 committed by GitHub
commit da10f4c7ed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -57,11 +57,13 @@ async def _(event: Union[GroupMessageEvent, MessageEvent], choice: str = ArgPlai
if choice == '':
user_id = str(event.user_id)
data = load_json(Path() / 'data' / 'LittlePaimon' / 'CloudGenshin.json')
del data[user_id]
if scheduler.get_job(f'cloud_genshin_{user_id}'):
scheduler.remove_job(f"cloud_genshin_{user_id}")
save_json(data, Path() / 'data' / 'LittlePaimon' / 'CloudGenshin.json')
try:
del data[user_id]
if scheduler.get_job(f'cloud_genshin_{user_id}'):
scheduler.remove_job(f"cloud_genshin_{user_id}")
save_json(data, Path() / 'data' / 'LittlePaimon' / 'CloudGenshin.json')
except:
await rm_cloud_ys.finish("你尚未绑定cookie 解绑失败", at_sender=True)
await rm_cloud_ys.finish('token已解绑并取消自动签到~', at_sender=True)
else: