new function

if bot kicked by admin in the group ~ "userbot will left from group also" ~ and vice versa
This commit is contained in:
levina 2021-11-26 13:44:44 +07:00 committed by GitHub
parent 81ee121069
commit 69f1dbc9d5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -79,3 +79,15 @@ async def leave_all(client, message):
await client.send_message(
message.chat.id, f"✅ Left from: {left} chats.\n❌ Failed in: {failed} chats."
)
@Client.on_message(filters.left_chat_members)
async def ubot_leave(c: Client, m: Message):
ass_id = (await user.get_me()).id
bot_id = (await c.get_me()).id
chat_id = m.chat.id
left_member = m.left_chat_member
if left_member.id == bot_id:
await user.leave_chat(chat_id)
elif left_member.id == ass_id:
await c.leave_chat(chat_id)