mirror of
https://github.com/PaiGramTeam/PamGram.git
synced 2024-11-25 07:36:27 +00:00
🐛 修复验证插件在获取 job 时返回 None
的问题
`kick_member_job` 日记等级修改为 `info`
This commit is contained in:
parent
781dd99ab6
commit
77fc4d3358
@ -62,7 +62,7 @@ class GroupJoiningVerification:
|
|||||||
|
|
||||||
async def kick_member_job(self, context: CallbackContext):
|
async def kick_member_job(self, context: CallbackContext):
|
||||||
job = context.job
|
job = context.job
|
||||||
Log.debug(f"踢出用户 user_id[{job.user_id}] 在 chat_id[{job.chat_id}]")
|
Log.info(f"踢出用户 user_id[{job.user_id}] 在 chat_id[{job.chat_id}]")
|
||||||
try:
|
try:
|
||||||
await context.bot.ban_chat_member(chat_id=job.chat_id, user_id=job.user_id,
|
await context.bot.ban_chat_member(chat_id=job.chat_id, user_id=job.user_id,
|
||||||
until_date=int(time.time()) + self.kick_time)
|
until_date=int(time.time()) + self.kick_time)
|
||||||
@ -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}|clean_join"):
|
if schedule := context.job_queue.scheduler.get_job(f"{chat.id}|{user_id}|auth_clean_join_message"):
|
||||||
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}|clean_join"):
|
if schedule := context.job_queue.scheduler.get_job(f"{chat.id}|{user_id}|auth_clean_join_message"):
|
||||||
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}|clean_join"):
|
if schedule := context.job_queue.scheduler.get_job(f"{chat.id}|{user.id}|auth_clean_join_message"):
|
||||||
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" \
|
||||||
@ -278,13 +278,13 @@ class GroupJoiningVerification:
|
|||||||
raise error
|
raise error
|
||||||
context.job_queue.run_once(callback=self.kick_member_job, when=self.time_out,
|
context.job_queue.run_once(callback=self.kick_member_job, when=self.time_out,
|
||||||
name=f"{chat.id}|{user.id}|auth_kick", chat_id=chat.id, user_id=user.id,
|
name=f"{chat.id}|{user.id}|auth_kick", 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_kick"})
|
||||||
context.job_queue.run_once(callback=self.clean_message_job, when=self.time_out, data=message.message_id,
|
context.job_queue.run_once(callback=self.clean_message_job, when=self.time_out, data=message.message_id,
|
||||||
name=f"{chat.id}|{user.id}|auth_clean_join_message",
|
name=f"{chat.id}|{user.id}|auth_clean_join_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_kick"})
|
||||||
context.job_queue.run_once(callback=self.clean_message_job, when=self.time_out,
|
context.job_queue.run_once(callback=self.clean_message_job, when=self.time_out,
|
||||||
data=question_message.message_id,
|
data=question_message.message_id,
|
||||||
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_kick"})
|
||||||
|
Loading…
Reference in New Issue
Block a user