🐛 修复验证插件错误清理任务的问题

This commit is contained in:
洛水居室 2022-08-31 16:45:02 +08:00
parent c83770d11f
commit c44952fd3d
No known key found for this signature in database
GPG Key ID: C9DE87DA724B88FC

View File

@ -124,7 +124,7 @@ class GroupJoiningVerification:
if result == "pass": if result == "pass":
await callback_query.answer(text="放行", show_alert=False) await callback_query.answer(text="放行", show_alert=False)
await self.restore_member(context, chat.id, user_id) await self.restore_member(context, chat.id, user_id)
if schedule := context.job_queue.scheduler.get_job(f"{chat.id}|{user_id}|auth_clean_join_message"): if schedule := context.job_queue.scheduler.get_job(f"{chat.id}|{user_id}|auth_kick"):
schedule.remove() schedule.remove()
await message.edit_text(f"{user_info}{user.mention_markdown_v2()} 放行", await message.edit_text(f"{user_info}{user.mention_markdown_v2()} 放行",
parse_mode=ParseMode.MARKDOWN_V2) parse_mode=ParseMode.MARKDOWN_V2)
@ -138,7 +138,7 @@ class GroupJoiningVerification:
elif result == "unban": elif result == "unban":
await callback_query.answer(text="解除驱离", show_alert=False) await callback_query.answer(text="解除驱离", show_alert=False)
await self.restore_member(context, chat.id, user_id) await self.restore_member(context, chat.id, user_id)
if schedule := context.job_queue.scheduler.get_job(f"{chat.id}|{user_id}|auth_clean_join_message"): if schedule := context.job_queue.scheduler.get_job(f"{chat.id}|{user_id}|auth_kick"):
schedule.remove() schedule.remove()
await message.edit_text(f"{user_info}{user.mention_markdown_v2()} 解除驱离", await message.edit_text(f"{user_info}{user.mention_markdown_v2()} 解除驱离",
parse_mode=ParseMode.MARKDOWN_V2) parse_mode=ParseMode.MARKDOWN_V2)
@ -180,7 +180,7 @@ class GroupJoiningVerification:
buttons = [[InlineKeyboardButton("驱离", callback_data=f"auth_admin|kick|{user.id}")]] buttons = [[InlineKeyboardButton("驱离", callback_data=f"auth_admin|kick|{user.id}")]]
await callback_query.answer(text="验证成功", show_alert=False) await callback_query.answer(text="验证成功", show_alert=False)
await self.restore_member(context, chat.id, user_id) await self.restore_member(context, chat.id, user_id)
if schedule := context.job_queue.scheduler.get_job(f"{chat.id}|{user.id}|auth_clean_join_message"): if schedule := context.job_queue.scheduler.get_job(f"{chat.id}|{user.id}|auth_kick"):
schedule.remove() schedule.remove()
text = f"{user.mention_markdown_v2()} 验证成功,向着星辰与深渊!\n" \ text = f"{user.mention_markdown_v2()} 验证成功,向着星辰与深渊!\n" \
f"问题:{escape_markdown(question, version=2)} \n" \ f"问题:{escape_markdown(question, version=2)} \n" \
@ -289,4 +289,4 @@ class GroupJoiningVerification:
name=f"{chat.id}|{user.id}|auth_clean_question_message", name=f"{chat.id}|{user.id}|auth_clean_question_message",
chat_id=chat.id, user_id=user.id, chat_id=chat.id, user_id=user.id,
job_kwargs={"replace_existing": True, job_kwargs={"replace_existing": True,
"id": f"{chat.id}|{user.id}|auth_clean_join_message"}) "id": f"{chat.id}|{user.id}|auth_clean_question_message"})