something

This commit is contained in:
levina 2022-01-20 21:49:59 +07:00 committed by GitHub
parent 55165f5613
commit b74a52a6db
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -62,32 +62,34 @@ async def leave_all(client, message):
left = 0
failed = 0
lol = await message.reply("🔄 **userbot** leaving all chats !")
msg = await message.reply("🔄 Userbot leaving all Group !")
async for dialog in user.iter_dialogs():
try:
await user.leave_chat(dialog.chat.id)
left += 1
await lol.edit(
f"Userbot leaving all group...\n\nLeft: {left} chats.\nFailed: {failed} chats."
await msg.edit(
f"Userbot leaving all Group...\n\nLeft: {left} chats.\nFailed: {failed} chats."
)
except BaseException:
failed += 1
await lol.edit(
await msg.edit(
f"Userbot leaving...\n\nLeft: {left} chats.\nFailed: {failed} chats."
)
await asyncio.sleep(0.7)
await msg.delete()
await client.send_message(
message.chat.id, f"✅ Left from: {left} chats.\n❌ Failed in: {failed} chats."
)
@Client.on_message(filters.left_chat_member)
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)
# @Client.on_message(filters.left_chat_member)
# 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)