From d69d487ebc0c2d50b46a60a0f9450eaa091f1385 Mon Sep 17 00:00:00 2001 From: Avinash Reddy Date: Sat, 4 Jan 2020 18:31:00 +0530 Subject: [PATCH] [Mutes, GMutes] Improvements and fixes --- userbot/modules/admin.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/userbot/modules/admin.py b/userbot/modules/admin.py index 7b5e7c863..fe4134614 100644 --- a/userbot/modules/admin.py +++ b/userbot/modules/admin.py @@ -429,12 +429,18 @@ async def muter(moot): if muted: for i in muted: if str(i.sender) == str(moot.sender_id): - await moot.delete() - await moot.client( - EditBannedRequest(moot.chat_id, moot.sender_id, rights)) + try: + await moot.delete() + await moot.client( + EditBannedRequest(moot.chat_id, moot.sender_id, rights)) + except (BadRequestError, UserAdminInvalidError): + await moot.client.send_read_acknowledge(moot.chat_id, moot.id) for i in gmuted: if i.sender == str(moot.sender_id): - await moot.delete() + try: + await moot.delete() + except BadRequestError: + await moot.client.send_read_acknowledge(moot.chat_id, moot.id) @register(outgoing=True, pattern="^.ungmute(?: |$)(.*)", groups_only=True)