diff --git a/plugins/admintools.py b/plugins/admintools.py index 0d402ff2d6..8853c9d36f 100644 --- a/plugins/admintools.py +++ b/plugins/admintools.py @@ -392,12 +392,13 @@ async def _(e): msg = await e.get_reply_message() name = msg.sender - try: - await e.client.delete_messages(e.chat_id, from_user=msg.sender_id) - await e.eor(get_string("purgeall_2").format(name.first_name), time=5) - except Exception as er: - return await e.eor(str(er), time=5) - + async for message in e.client.iter_messages(e.chat_id, from_user=msg.sender.id): + try: + await e.client.delete_messages(e.chat_id, [message.id]) + except Exception as er: + await e.eor(str(er), time=5) + return + await e.eor(get_string("purgeall_2").format(name.first_name), time=5) @ultroid_cmd(pattern="pinned", manager=True, groups_only=True) async def djshsh(event):