something
This commit is contained in:
parent
55165f5613
commit
b74a52a6db
@ -62,32 +62,34 @@ async def leave_all(client, message):
|
|||||||
|
|
||||||
left = 0
|
left = 0
|
||||||
failed = 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():
|
async for dialog in user.iter_dialogs():
|
||||||
try:
|
try:
|
||||||
await user.leave_chat(dialog.chat.id)
|
await user.leave_chat(dialog.chat.id)
|
||||||
left += 1
|
left += 1
|
||||||
await lol.edit(
|
await msg.edit(
|
||||||
f"Userbot leaving all group...\n\nLeft: {left} chats.\nFailed: {failed} chats."
|
f"Userbot leaving all Group...\n\nLeft: {left} chats.\nFailed: {failed} chats."
|
||||||
)
|
)
|
||||||
except BaseException:
|
except BaseException:
|
||||||
failed += 1
|
failed += 1
|
||||||
await lol.edit(
|
await msg.edit(
|
||||||
f"Userbot leaving...\n\nLeft: {left} chats.\nFailed: {failed} chats."
|
f"Userbot leaving...\n\nLeft: {left} chats.\nFailed: {failed} chats."
|
||||||
)
|
)
|
||||||
await asyncio.sleep(0.7)
|
await asyncio.sleep(0.7)
|
||||||
|
await msg.delete()
|
||||||
await client.send_message(
|
await client.send_message(
|
||||||
message.chat.id, f"✅ Left from: {left} chats.\n❌ Failed in: {failed} chats."
|
message.chat.id, f"✅ Left from: {left} chats.\n❌ Failed in: {failed} chats."
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@Client.on_message(filters.left_chat_member)
|
# @Client.on_message(filters.left_chat_member)
|
||||||
async def ubot_leave(c: Client, m: Message):
|
# async def ubot_leave(c: Client, m: Message):
|
||||||
ass_id = (await user.get_me()).id
|
# ass_id = (await user.get_me()).id
|
||||||
bot_id = (await c.get_me()).id
|
# bot_id = (await c.get_me()).id
|
||||||
chat_id = m.chat.id
|
# chat_id = m.chat.id
|
||||||
left_member = m.left_chat_member
|
# left_member = m.left_chat_member
|
||||||
if left_member.id == bot_id:
|
# if left_member.id == bot_id:
|
||||||
await user.leave_chat(chat_id)
|
# await user.leave_chat(chat_id)
|
||||||
elif left_member.id == ass_id:
|
# elif left_member.id == ass_id:
|
||||||
await c.leave_chat(chat_id)
|
# await c.leave_chat(chat_id)
|
||||||
|
Loading…
Reference in New Issue
Block a user