mirror of
https://github.com/PaiGramTeam/PaiGram.git
synced 2024-11-25 18:04:10 +00:00
🎨 Delete NEW_CHAT_MEMBERS
message during group captcha
This commit is contained in:
parent
aef1cb4c02
commit
c2bcd0bf19
@ -379,13 +379,6 @@ class GroupCaptcha(Plugin):
|
|||||||
),
|
),
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
if new_chat_members_message:
|
|
||||||
reply_message = (
|
|
||||||
f"*欢迎来到「提瓦特」世界!* \n"
|
|
||||||
f"问题: {escape_markdown(question.text, version=2)} \n"
|
|
||||||
f"请在*{self.time_out}*秒内回答问题"
|
|
||||||
)
|
|
||||||
else:
|
|
||||||
reply_message = (
|
reply_message = (
|
||||||
f"*欢迎 {user.mention_markdown_v2()} 来到「提瓦特」世界!* \n"
|
f"*欢迎 {user.mention_markdown_v2()} 来到「提瓦特」世界!* \n"
|
||||||
f"问题: {escape_markdown(question.text, version=2)} \n"
|
f"问题: {escape_markdown(question.text, version=2)} \n"
|
||||||
@ -401,11 +394,6 @@ class GroupCaptcha(Plugin):
|
|||||||
chat.id,
|
chat.id,
|
||||||
)
|
)
|
||||||
try:
|
try:
|
||||||
if new_chat_members_message:
|
|
||||||
question_message = await new_chat_members_message.reply_markdown_v2(
|
|
||||||
reply_message, reply_markup=InlineKeyboardMarkup(buttons), allow_sending_without_reply=True
|
|
||||||
)
|
|
||||||
else:
|
|
||||||
question_message = await chat.send_message(
|
question_message = await chat.send_message(
|
||||||
reply_message,
|
reply_message,
|
||||||
reply_markup=InlineKeyboardMarkup(buttons),
|
reply_markup=InlineKeyboardMarkup(buttons),
|
||||||
@ -422,16 +410,6 @@ class GroupCaptcha(Plugin):
|
|||||||
user_id=user.id,
|
user_id=user.id,
|
||||||
job_kwargs={"replace_existing": True, "id": f"{chat.id}|{user.id}|auth_kick"},
|
job_kwargs={"replace_existing": True, "id": f"{chat.id}|{user.id}|auth_kick"},
|
||||||
)
|
)
|
||||||
if new_chat_members_message:
|
|
||||||
context.job_queue.run_once(
|
|
||||||
callback=self.clean_message_job,
|
|
||||||
when=self.time_out,
|
|
||||||
data=new_chat_members_message.message_id,
|
|
||||||
name=f"{chat.id}|{user.id}|auth_clean_join_message",
|
|
||||||
chat_id=chat.id,
|
|
||||||
user_id=user.id,
|
|
||||||
job_kwargs={"replace_existing": True, "id": f"{chat.id}|{user.id}|auth_clean_join_message"},
|
|
||||||
)
|
|
||||||
context.job_queue.run_once(
|
context.job_queue.run_once(
|
||||||
callback=self.clean_message_job,
|
callback=self.clean_message_job,
|
||||||
when=self.time_out,
|
when=self.time_out,
|
||||||
@ -441,6 +419,11 @@ class GroupCaptcha(Plugin):
|
|||||||
user_id=user.id,
|
user_id=user.id,
|
||||||
job_kwargs={"replace_existing": True, "id": f"{chat.id}|{user.id}|auth_clean_question_message"},
|
job_kwargs={"replace_existing": True, "id": f"{chat.id}|{user.id}|auth_clean_question_message"},
|
||||||
)
|
)
|
||||||
|
try:
|
||||||
|
if new_chat_members_message:
|
||||||
|
await new_chat_members_message.delete()
|
||||||
|
except BadRequest as exc:
|
||||||
|
logger.warning("无法删除 Chat Members Message [%s]", exc.message)
|
||||||
if PYROGRAM_AVAILABLE and self.mtp:
|
if PYROGRAM_AVAILABLE and self.mtp:
|
||||||
try:
|
try:
|
||||||
if new_chat_members_message:
|
if new_chat_members_message:
|
||||||
|
Loading…
Reference in New Issue
Block a user