Przeglądaj źródła

Fixed anon admin permissions (decorator)

TheHamkerCat 4 lat temu
rodzic
commit
a65e065cf9
1 zmienionych plików z 12 dodań i 10 usunięć
  1. 12 10
      wbb/core/decorators/permissions.py

+ 12 - 10
wbb/core/decorators/permissions.py

@@ -67,16 +67,18 @@ def adminsOnly(permission):
             chatID = message.chat.id
             if not message.from_user:
                 # For anonymous admins
-                #### It's a big security risk, Removing for a while
-                # if message.sender_chat:
-                #    return await authorised(
-                #        func,
-                #        subFunc2,
-                #        client,
-                #        message,
-                #        *args,
-                #        **kwargs,
-                #    )
+                if (
+                    message.sender_chat
+                    and message.sender_chat.id == message.chat.id
+                ):
+                    return await authorised(
+                        func,
+                        subFunc2,
+                        client,
+                        message,
+                        *args,
+                        **kwargs,
+                    )
                 return await unauthorised(message, permission, subFunc2)
             # For admins and sudo users
             userID = message.from_user.id