Spaces:
Sleeping
Sleeping
Captain D. Ezio
commited on
Commit
·
a3db4ff
1
Parent(s):
2ecb070
fixed few bugs
Browse files- Powers/utils/custom_filters.py +21 -15
Powers/utils/custom_filters.py
CHANGED
@@ -42,23 +42,26 @@ def command(
|
|
42 |
if m and not m.from_user and not m.chat.is_admin:
|
43 |
return False
|
44 |
|
45 |
-
if m.from_user and m.from_user.is_bot:
|
46 |
-
return False
|
47 |
-
|
48 |
if any([m.forward_from_chat, m.forward_from]):
|
49 |
return False
|
50 |
|
51 |
-
if
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
62 |
|
63 |
text: str = m.text or m.caption
|
64 |
if not text:
|
@@ -74,7 +77,10 @@ def command(
|
|
74 |
return False
|
75 |
if bool(m.chat and m.chat.type in {ChatType.SUPERGROUP, ChatType.GROUP}):
|
76 |
try:
|
77 |
-
|
|
|
|
|
|
|
78 |
except UserNotParticipant:
|
79 |
# i.e anon admin
|
80 |
user_status = CMS.ADMINISTRATOR
|
|
|
42 |
if m and not m.from_user and not m.chat.is_admin:
|
43 |
return False
|
44 |
|
|
|
|
|
|
|
45 |
if any([m.forward_from_chat, m.forward_from]):
|
46 |
return False
|
47 |
|
48 |
+
if m.from_user:
|
49 |
+
if m.from_user.is_bot:
|
50 |
+
return False
|
51 |
+
|
52 |
+
if owner_cmd and (m.from_user.id != OWNER_ID):
|
53 |
+
# Only owner allowed to use this...!
|
54 |
+
return False
|
55 |
+
|
56 |
+
DEV_LEVEL = get_support_staff("dev_level")
|
57 |
+
if dev_cmd and (m.from_user.id not in DEV_LEVEL):
|
58 |
+
# Only devs allowed to use this...!
|
59 |
+
return False
|
60 |
+
|
61 |
+
SUDO_LEVEL = get_support_staff("sudo_level")
|
62 |
+
if sudo_cmd and (m.from_user.id not in SUDO_LEVEL):
|
63 |
+
# Only sudos and above allowed to use it
|
64 |
+
return False
|
65 |
|
66 |
text: str = m.text or m.caption
|
67 |
if not text:
|
|
|
77 |
return False
|
78 |
if bool(m.chat and m.chat.type in {ChatType.SUPERGROUP, ChatType.GROUP}):
|
79 |
try:
|
80 |
+
if m.chat.is_admin:
|
81 |
+
user_status = CMS.ADMINISTRATOR
|
82 |
+
else:
|
83 |
+
user_status = (await m.chat.get_member(m.from_user.id)).status
|
84 |
except UserNotParticipant:
|
85 |
# i.e anon admin
|
86 |
user_status = CMS.ADMINISTRATOR
|