idk what i did here but it works
This commit is contained in:
parent
31d8640281
commit
89baa867cc
|
@ -11,8 +11,10 @@ async def delete(client, message):
|
|||
if not getattr(reply, 'empty', True):
|
||||
messages.add(reply.message_id)
|
||||
else:
|
||||
async for i in client.search_messages(message.chat.id, offset=1, limit=1, from_user='me'):
|
||||
async for i in client.iter_history(message.chat.id, offset=1):
|
||||
if i.outgoing:
|
||||
messages.add(i.message_id)
|
||||
break
|
||||
await client.delete_messages(message.chat.id, messages)
|
||||
|
||||
@Client.on_message(~filters.sticker & ~filters.via_bot & ~filters.edited & filters.me & filters.command(['p', 'purge', 'sp', 'selfpurge'], prefixes=config['config']['prefixes']))
|
||||
|
@ -20,15 +22,25 @@ async def delete(client, message):
|
|||
@public_log_errors
|
||||
async def purge(client, message):
|
||||
command = message.command
|
||||
selfpurge = 'me' if 's' in message.command.pop(0) else None
|
||||
selfpurge = 's' in command.pop(0)
|
||||
command = ' '.join(command)
|
||||
ids = set((message.message_id,))
|
||||
reply = message.reply_to_message
|
||||
if command.isnumeric():
|
||||
async for i in client.search_messages(message.chat.id, limit=int(command), offset=1, from_user=selfpurge):
|
||||
command = int(command)
|
||||
if selfpurge:
|
||||
async for i in client.iter_history(message.chat.id, offset=1):
|
||||
if not (selfpurge and not i.outgoing):
|
||||
ids.add(i.message_id)
|
||||
command -= 1
|
||||
if command <= 0:
|
||||
break
|
||||
else:
|
||||
async for i in client.iter_history(message.chat.id, offset=1, limit=command):
|
||||
ids.add(i.message_id)
|
||||
elif not getattr(reply, 'empty', True):
|
||||
async for i in client.search_messages(message.chat.id, offset=1, from_user=selfpurge):
|
||||
async for i in client.iter_history(message.chat.id, offset=1):
|
||||
if not (selfpurge and not i.outgoing):
|
||||
ids.add(i.message_id)
|
||||
if reply.message_id >= i.message_id:
|
||||
break
|
||||
|
@ -53,7 +65,7 @@ async def yeetpurge(client, message):
|
|||
thing = [og_reply, reply.message_id]
|
||||
thing.sort()
|
||||
thing0, thing1 = thing
|
||||
async for i in client.iter_history(message.chat.id, offset_id=thing1):
|
||||
async for i in client.iter_history(message.chat.id, offset_id=thing1 + 1):
|
||||
if not ('s' in message.command[0] and not i.outgoing):
|
||||
messages.add(i.message_id)
|
||||
if thing0 >= i.message_id:
|
||||
|
|
Loading…
Reference in New Issue