Spaces:
Paused
Paused
Captain Ezio
commited on
Commit
·
36b5e1c
1
Parent(s):
9ab31c1
Working on `v 2.2.0`
Browse files- Powers/database/locks_db.py +18 -2
- Powers/plugins/admin.py +3 -2
- Powers/plugins/antispam.py +19 -1
- Powers/plugins/auto_join.py +5 -2
- Powers/plugins/bans.py +18 -1
- Powers/plugins/chat_blacklist.py +32 -0
- Powers/plugins/dev.py +6 -3
- Powers/plugins/disable.py +20 -0
- Powers/plugins/flood.py +2 -1
- Powers/plugins/info.py +9 -5
- Powers/plugins/locks.py +6 -4
- Powers/plugins/muting.py +9 -1
- Powers/plugins/report.py +2 -2
- Powers/plugins/warns.py +10 -3
- Powers/plugins/watchers.py +2 -2
- Powers/utils/admin_check.py +4 -3
- Powers/utils/custom_filters.py +6 -7
- Powers/utils/start_utils.py +3 -3
Powers/database/locks_db.py
CHANGED
|
@@ -5,6 +5,7 @@ from Powers.database import MongoDB
|
|
| 5 |
|
| 6 |
INSERTION_LOCK = RLock()
|
| 7 |
|
|
|
|
| 8 |
class LOCKS(MongoDB):
|
| 9 |
"""Class to store locks"""
|
| 10 |
|
|
@@ -15,8 +16,17 @@ class LOCKS(MongoDB):
|
|
| 15 |
|
| 16 |
def insert_lock_channel(self, chat: int, locktype: str):
|
| 17 |
"""
|
| 18 |
-
locktypes: anti_c_send, anti_fwd, anti_fwd_u, anti_fwd_c, anti_links
|
| 19 |
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
curr = self.find_one({"chat_id":chat,"locktype":locktype})
|
| 21 |
if curr:
|
| 22 |
return False
|
|
@@ -29,8 +39,14 @@ class LOCKS(MongoDB):
|
|
| 29 |
|
| 30 |
def remove_lock_channel(self, chat: int, locktype: str):
|
| 31 |
"""
|
| 32 |
-
locktypes: anti_c_send, anti_fwd, anti_fwd_u, anti_fwd_c, anti_links
|
| 33 |
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
curr = self.find_one({"chat_id":chat,"locktype":locktype})
|
| 35 |
if curr:
|
| 36 |
with INSERTION_LOCK:
|
|
|
|
| 5 |
|
| 6 |
INSERTION_LOCK = RLock()
|
| 7 |
|
| 8 |
+
lock_t = ["anti_c_send", "anti_fwd", "anti_fwd_u", "anti_fwd_c", "anti_links"]
|
| 9 |
class LOCKS(MongoDB):
|
| 10 |
"""Class to store locks"""
|
| 11 |
|
|
|
|
| 16 |
|
| 17 |
def insert_lock_channel(self, chat: int, locktype: str):
|
| 18 |
"""
|
| 19 |
+
locktypes: all, anti_c_send, anti_fwd, anti_fwd_u, anti_fwd_c, anti_links
|
| 20 |
"""
|
| 21 |
+
if locktype == "all":
|
| 22 |
+
for i in lock_t:
|
| 23 |
+
curr = self.find_one({"chat_id":chat,"locktype":i})
|
| 24 |
+
if curr:
|
| 25 |
+
continue
|
| 26 |
+
if i in ["anti_fwd_u", "anti_fwd_c"]:
|
| 27 |
+
continue
|
| 28 |
+
self.insert_one({"chat_id":chat,"locktype":i})
|
| 29 |
+
return True
|
| 30 |
curr = self.find_one({"chat_id":chat,"locktype":locktype})
|
| 31 |
if curr:
|
| 32 |
return False
|
|
|
|
| 39 |
|
| 40 |
def remove_lock_channel(self, chat: int, locktype: str):
|
| 41 |
"""
|
| 42 |
+
locktypes: all, anti_c_send, anti_fwd, anti_fwd_u, anti_fwd_c, anti_links
|
| 43 |
"""
|
| 44 |
+
if locktype == "all":
|
| 45 |
+
for i in lock_t:
|
| 46 |
+
curr = self.find_one({"chat_id":chat,"locktype":i})
|
| 47 |
+
if curr:
|
| 48 |
+
self.delete_one({"chat_id":chat,"locktype":i})
|
| 49 |
+
return True
|
| 50 |
curr = self.find_one({"chat_id":chat,"locktype":locktype})
|
| 51 |
if curr:
|
| 52 |
with INSERTION_LOCK:
|
Powers/plugins/admin.py
CHANGED
|
@@ -24,8 +24,6 @@ from Powers.utils.extract_user import extract_user
|
|
| 24 |
from Powers.utils.parser import mention_html
|
| 25 |
from Powers.vars import Config
|
| 26 |
|
| 27 |
-
SUPPORT_STAFF = get_support_staff()
|
| 28 |
-
DEV_LEVEL = get_support_staff("dev_level")
|
| 29 |
|
| 30 |
@Gojo.on_message(command("adminlist"))
|
| 31 |
async def adminlist_show(_, m: Message):
|
|
@@ -110,6 +108,7 @@ async def reload_admins(_, m: Message):
|
|
| 110 |
return await m.reply_text(
|
| 111 |
"This command is made to be used in groups only!",
|
| 112 |
)
|
|
|
|
| 113 |
if (
|
| 114 |
(m.chat.id in set(TEMP_ADMIN_CACHE_BLOCK.keys()))
|
| 115 |
and (m.from_user.id not in SUPPORT_STAFF)
|
|
@@ -420,6 +419,8 @@ async def demote_usr(c: Gojo, m: Message):
|
|
| 420 |
@Gojo.on_message(command("invitelink"))
|
| 421 |
async def get_invitelink(c: Gojo, m: Message):
|
| 422 |
# Bypass the bot devs, sudos and owner
|
|
|
|
|
|
|
| 423 |
if m.from_user.id not in DEV_LEVEL:
|
| 424 |
user = await m.chat.get_member(m.from_user.id)
|
| 425 |
if not user.privileges.can_invite_users and user.status != CMS.OWNER:
|
|
|
|
| 24 |
from Powers.utils.parser import mention_html
|
| 25 |
from Powers.vars import Config
|
| 26 |
|
|
|
|
|
|
|
| 27 |
|
| 28 |
@Gojo.on_message(command("adminlist"))
|
| 29 |
async def adminlist_show(_, m: Message):
|
|
|
|
| 108 |
return await m.reply_text(
|
| 109 |
"This command is made to be used in groups only!",
|
| 110 |
)
|
| 111 |
+
SUPPORT_STAFF = get_support_staff()
|
| 112 |
if (
|
| 113 |
(m.chat.id in set(TEMP_ADMIN_CACHE_BLOCK.keys()))
|
| 114 |
and (m.from_user.id not in SUPPORT_STAFF)
|
|
|
|
| 419 |
@Gojo.on_message(command("invitelink"))
|
| 420 |
async def get_invitelink(c: Gojo, m: Message):
|
| 421 |
# Bypass the bot devs, sudos and owner
|
| 422 |
+
|
| 423 |
+
DEV_LEVEL = get_support_staff("dev_level")
|
| 424 |
if m.from_user.id not in DEV_LEVEL:
|
| 425 |
user = await m.chat.get_member(m.from_user.id)
|
| 426 |
if not user.privileges.can_invite_users and user.status != CMS.OWNER:
|
Powers/plugins/antispam.py
CHANGED
|
@@ -18,7 +18,6 @@ from Powers.vars import Config
|
|
| 18 |
|
| 19 |
# Initialize
|
| 20 |
db = GBan()
|
| 21 |
-
SUPPORT_STAFF = get_support_staff()
|
| 22 |
|
| 23 |
@Gojo.on_message(command(["gban", "globalban"], sudo_cmd=True))
|
| 24 |
async def gban(c: Gojo, m: Message):
|
|
@@ -39,6 +38,8 @@ async def gban(c: Gojo, m: Message):
|
|
| 39 |
else:
|
| 40 |
gban_reason = m.text.split(None, 2)[2]
|
| 41 |
|
|
|
|
|
|
|
| 42 |
if user_id in SUPPORT_STAFF:
|
| 43 |
await m.reply_text(text="This user is part of my Support!, Can't ban our own!")
|
| 44 |
return
|
|
@@ -92,6 +93,8 @@ async def ungban(c: Gojo, m: Message):
|
|
| 92 |
|
| 93 |
user_id, user_first_name, _ = await extract_user(c, m)
|
| 94 |
|
|
|
|
|
|
|
| 95 |
if user_id in SUPPORT_STAFF:
|
| 96 |
await m.reply_text(text="This user is part of my Support!, Can't ban our own!")
|
| 97 |
return
|
|
@@ -169,3 +172,18 @@ async def gban_list(_, m: Message):
|
|
| 169 |
LOGGER.info(f"{m.from_user.id} exported gbanlist in {m.chat.id}")
|
| 170 |
|
| 171 |
return
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
|
| 19 |
# Initialize
|
| 20 |
db = GBan()
|
|
|
|
| 21 |
|
| 22 |
@Gojo.on_message(command(["gban", "globalban"], sudo_cmd=True))
|
| 23 |
async def gban(c: Gojo, m: Message):
|
|
|
|
| 38 |
else:
|
| 39 |
gban_reason = m.text.split(None, 2)[2]
|
| 40 |
|
| 41 |
+
SUPPORT_STAFF = get_support_staff()
|
| 42 |
+
|
| 43 |
if user_id in SUPPORT_STAFF:
|
| 44 |
await m.reply_text(text="This user is part of my Support!, Can't ban our own!")
|
| 45 |
return
|
|
|
|
| 93 |
|
| 94 |
user_id, user_first_name, _ = await extract_user(c, m)
|
| 95 |
|
| 96 |
+
SUPPORT_STAFF = get_support_staff()
|
| 97 |
+
|
| 98 |
if user_id in SUPPORT_STAFF:
|
| 99 |
await m.reply_text(text="This user is part of my Support!, Can't ban our own!")
|
| 100 |
return
|
|
|
|
| 172 |
LOGGER.info(f"{m.from_user.id} exported gbanlist in {m.chat.id}")
|
| 173 |
|
| 174 |
return
|
| 175 |
+
|
| 176 |
+
__PLUGIN__ = "global"
|
| 177 |
+
|
| 178 |
+
__alt_name__ = ["antispam", "global"]
|
| 179 |
+
|
| 180 |
+
|
| 181 |
+
__HELP__ = """
|
| 182 |
+
**Global**
|
| 183 |
+
|
| 184 |
+
**Sudo commands:**
|
| 185 |
+
• /gban [reply to user | user id | username]: Add the user in the global ban watchlist.
|
| 186 |
+
• /ungban [reply to user | user id | username]: Remove the user from the global ban watchlist.
|
| 187 |
+
• /numgbans : Give number of users who are banned globally.
|
| 188 |
+
• /gbanlist : Give list of globally banned users.
|
| 189 |
+
"""
|
Powers/plugins/auto_join.py
CHANGED
|
@@ -10,7 +10,6 @@ from Powers.database.autojoin_db import AUTOJOIN
|
|
| 10 |
from Powers.supports import get_support_staff
|
| 11 |
from Powers.utils.custom_filters import admin_filter, auto_join_filter, command
|
| 12 |
|
| 13 |
-
SUPPORT_STAFF = get_support_staff()
|
| 14 |
|
| 15 |
@Gojo.on_message(command(["joinreq"]) & admin_filter)
|
| 16 |
async def accept_join_requests(c: Gojo, m: Message):
|
|
@@ -21,6 +20,9 @@ async def accept_join_requests(c: Gojo, m: Message):
|
|
| 21 |
split = m.command
|
| 22 |
a_j = AUTOJOIN()
|
| 23 |
|
|
|
|
|
|
|
|
|
|
| 24 |
if len(split) == 1:
|
| 25 |
txt = "**USAGE**\n/joinreq [on | off]"
|
| 26 |
await m.reply_text(txt)
|
|
@@ -84,7 +86,8 @@ async def join_request_handler(c: Gojo, j: ChatJoinRequest):
|
|
| 84 |
chat = j.chat.id
|
| 85 |
aj = AUTOJOIN()
|
| 86 |
join_type = aj.get_autojoin(chat)
|
| 87 |
-
|
|
|
|
| 88 |
if not join_type:
|
| 89 |
return
|
| 90 |
if join_type == "auto" or user in SUPPORT_STAFF:
|
|
|
|
| 10 |
from Powers.supports import get_support_staff
|
| 11 |
from Powers.utils.custom_filters import admin_filter, auto_join_filter, command
|
| 12 |
|
|
|
|
| 13 |
|
| 14 |
@Gojo.on_message(command(["joinreq"]) & admin_filter)
|
| 15 |
async def accept_join_requests(c: Gojo, m: Message):
|
|
|
|
| 20 |
split = m.command
|
| 21 |
a_j = AUTOJOIN()
|
| 22 |
|
| 23 |
+
try:
|
| 24 |
+
await
|
| 25 |
+
|
| 26 |
if len(split) == 1:
|
| 27 |
txt = "**USAGE**\n/joinreq [on | off]"
|
| 28 |
await m.reply_text(txt)
|
|
|
|
| 86 |
chat = j.chat.id
|
| 87 |
aj = AUTOJOIN()
|
| 88 |
join_type = aj.get_autojoin(chat)
|
| 89 |
+
SUPPORT_STAFF = get_support_staff()
|
| 90 |
+
|
| 91 |
if not join_type:
|
| 92 |
return
|
| 93 |
if join_type == "auto" or user in SUPPORT_STAFF:
|
Powers/plugins/bans.py
CHANGED
|
@@ -20,7 +20,6 @@ from Powers.utils.parser import mention_html
|
|
| 20 |
from Powers.utils.string import extract_time
|
| 21 |
from Powers.vars import Config
|
| 22 |
|
| 23 |
-
SUPPORT_STAFF = get_support_staff()
|
| 24 |
|
| 25 |
@Gojo.on_message(command("tban") & restrict_filter)
|
| 26 |
async def tban_usr(c: Gojo, m: Message):
|
|
@@ -40,6 +39,8 @@ async def tban_usr(c: Gojo, m: Message):
|
|
| 40 |
await m.reply_text("WTF?? Why would I ban myself?")
|
| 41 |
await m.stop_propagation()
|
| 42 |
|
|
|
|
|
|
|
| 43 |
if user_id in SUPPORT_STAFF:
|
| 44 |
await m.reply_text(
|
| 45 |
text="This user is in my support staff, cannot restrict them."
|
|
@@ -160,6 +161,8 @@ async def stban_usr(c: Gojo, m: Message):
|
|
| 160 |
await m.reply_text(text="I can't ban nothing!")
|
| 161 |
await m.stop_propagation()
|
| 162 |
|
|
|
|
|
|
|
| 163 |
try:
|
| 164 |
user_id, _, _ = await extract_user(c, m)
|
| 165 |
except Exception:
|
|
@@ -266,6 +269,8 @@ async def dtban_usr(c: Gojo, m: Message):
|
|
| 266 |
await m.reply_text("Huh, why would I ban myself?")
|
| 267 |
await m.stop_propagation()
|
| 268 |
|
|
|
|
|
|
|
| 269 |
if user_id in SUPPORT_STAFF:
|
| 270 |
await m.reply_text(text="I am not going to ban one of my support staff")
|
| 271 |
LOGGER.info(
|
|
@@ -394,6 +399,8 @@ async def kick_usr(c: Gojo, m: Message):
|
|
| 394 |
await m.reply_text("Huh, why would I kick myself?")
|
| 395 |
await m.stop_propagation()
|
| 396 |
|
|
|
|
|
|
|
| 397 |
if user_id in SUPPORT_STAFF:
|
| 398 |
await m.reply_text(
|
| 399 |
text="This user is in my support staff, cannot restrict them."
|
|
@@ -483,6 +490,8 @@ async def skick_usr(c: Gojo, m: Message):
|
|
| 483 |
await m.reply_text("Huh, why would I kick myself?")
|
| 484 |
await m.stop_propagation()
|
| 485 |
|
|
|
|
|
|
|
| 486 |
if user_id in SUPPORT_STAFF:
|
| 487 |
await m.reply_text(
|
| 488 |
text="This user is in my support staff, cannot restrict them."
|
|
@@ -555,6 +564,8 @@ async def dkick_usr(c: Gojo, m: Message):
|
|
| 555 |
await m.reply_text("Huh, why would I kick myself?")
|
| 556 |
await m.stop_propagation()
|
| 557 |
|
|
|
|
|
|
|
| 558 |
if user_id in SUPPORT_STAFF:
|
| 559 |
await m.reply_text(
|
| 560 |
text="This user is in my support staff, cannot restrict them."
|
|
@@ -704,6 +715,8 @@ async def sban_usr(c: Gojo, m: Message):
|
|
| 704 |
await m.reply_text("Huh, why would I ban myself?")
|
| 705 |
await m.stop_propagation()
|
| 706 |
|
|
|
|
|
|
|
| 707 |
if user_id in SUPPORT_STAFF:
|
| 708 |
await m.reply_text(
|
| 709 |
text="This user is in my support staff, cannot restrict them."
|
|
@@ -783,6 +796,8 @@ async def dban_usr(c: Gojo, m: Message):
|
|
| 783 |
await m.reply_text("Huh, why would I ban myself?")
|
| 784 |
await m.stop_propagation()
|
| 785 |
|
|
|
|
|
|
|
| 786 |
if user_id in SUPPORT_STAFF:
|
| 787 |
await m.reply_text(
|
| 788 |
text="This user is in my support staff, cannot restrict them."
|
|
@@ -882,6 +897,8 @@ async def ban_usr(c: Gojo, m: Message):
|
|
| 882 |
await m.reply_text("Huh, why would I ban myself?")
|
| 883 |
await m.stop_propagation()
|
| 884 |
|
|
|
|
|
|
|
| 885 |
if user_id in SUPPORT_STAFF:
|
| 886 |
await m.reply_text(
|
| 887 |
text="This user is in my support staff, cannot restrict them."
|
|
|
|
| 20 |
from Powers.utils.string import extract_time
|
| 21 |
from Powers.vars import Config
|
| 22 |
|
|
|
|
| 23 |
|
| 24 |
@Gojo.on_message(command("tban") & restrict_filter)
|
| 25 |
async def tban_usr(c: Gojo, m: Message):
|
|
|
|
| 39 |
await m.reply_text("WTF?? Why would I ban myself?")
|
| 40 |
await m.stop_propagation()
|
| 41 |
|
| 42 |
+
SUPPORT_STAFF = get_support_staff()
|
| 43 |
+
|
| 44 |
if user_id in SUPPORT_STAFF:
|
| 45 |
await m.reply_text(
|
| 46 |
text="This user is in my support staff, cannot restrict them."
|
|
|
|
| 161 |
await m.reply_text(text="I can't ban nothing!")
|
| 162 |
await m.stop_propagation()
|
| 163 |
|
| 164 |
+
SUPPORT_STAFF = get_support_staff()
|
| 165 |
+
|
| 166 |
try:
|
| 167 |
user_id, _, _ = await extract_user(c, m)
|
| 168 |
except Exception:
|
|
|
|
| 269 |
await m.reply_text("Huh, why would I ban myself?")
|
| 270 |
await m.stop_propagation()
|
| 271 |
|
| 272 |
+
SUPPORT_STAFF = get_support_staff()
|
| 273 |
+
|
| 274 |
if user_id in SUPPORT_STAFF:
|
| 275 |
await m.reply_text(text="I am not going to ban one of my support staff")
|
| 276 |
LOGGER.info(
|
|
|
|
| 399 |
await m.reply_text("Huh, why would I kick myself?")
|
| 400 |
await m.stop_propagation()
|
| 401 |
|
| 402 |
+
SUPPORT_STAFF = get_support_staff()
|
| 403 |
+
|
| 404 |
if user_id in SUPPORT_STAFF:
|
| 405 |
await m.reply_text(
|
| 406 |
text="This user is in my support staff, cannot restrict them."
|
|
|
|
| 490 |
await m.reply_text("Huh, why would I kick myself?")
|
| 491 |
await m.stop_propagation()
|
| 492 |
|
| 493 |
+
SUPPORT_STAFF = get_support_staff()
|
| 494 |
+
|
| 495 |
if user_id in SUPPORT_STAFF:
|
| 496 |
await m.reply_text(
|
| 497 |
text="This user is in my support staff, cannot restrict them."
|
|
|
|
| 564 |
await m.reply_text("Huh, why would I kick myself?")
|
| 565 |
await m.stop_propagation()
|
| 566 |
|
| 567 |
+
SUPPORT_STAFF = get_support_staff()
|
| 568 |
+
|
| 569 |
if user_id in SUPPORT_STAFF:
|
| 570 |
await m.reply_text(
|
| 571 |
text="This user is in my support staff, cannot restrict them."
|
|
|
|
| 715 |
await m.reply_text("Huh, why would I ban myself?")
|
| 716 |
await m.stop_propagation()
|
| 717 |
|
| 718 |
+
SUPPORT_STAFF = get_support_staff()
|
| 719 |
+
|
| 720 |
if user_id in SUPPORT_STAFF:
|
| 721 |
await m.reply_text(
|
| 722 |
text="This user is in my support staff, cannot restrict them."
|
|
|
|
| 796 |
await m.reply_text("Huh, why would I ban myself?")
|
| 797 |
await m.stop_propagation()
|
| 798 |
|
| 799 |
+
SUPPORT_STAFF = get_support_staff()
|
| 800 |
+
|
| 801 |
if user_id in SUPPORT_STAFF:
|
| 802 |
await m.reply_text(
|
| 803 |
text="This user is in my support staff, cannot restrict them."
|
|
|
|
| 897 |
await m.reply_text("Huh, why would I ban myself?")
|
| 898 |
await m.stop_propagation()
|
| 899 |
|
| 900 |
+
SUPPORT_STAFF = get_support_staff()
|
| 901 |
+
|
| 902 |
if user_id in SUPPORT_STAFF:
|
| 903 |
await m.reply_text(
|
| 904 |
text="This user is in my support staff, cannot restrict them."
|
Powers/plugins/chat_blacklist.py
CHANGED
|
@@ -1,5 +1,6 @@
|
|
| 1 |
from traceback import format_exc
|
| 2 |
|
|
|
|
| 3 |
from pyrogram.errors import PeerIdInvalid, RPCError
|
| 4 |
from pyrogram.types import Message
|
| 5 |
|
|
@@ -33,6 +34,13 @@ async def blacklist_chat(c: Gojo, m: Message):
|
|
| 33 |
await replymsg.edit_text(
|
| 34 |
f"Added the following chats to Blacklist.\n<code>{', '.join(chat_ids)}</code>.",
|
| 35 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
return
|
| 37 |
|
| 38 |
|
|
@@ -63,6 +71,16 @@ async def unblacklist_chat(c: Gojo, m: Message):
|
|
| 63 |
await replymsg.edit_text(
|
| 64 |
f"Removed the following chats to Blacklist.\n<code>{', '.join(chat_ids)}</code>.",
|
| 65 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 66 |
return
|
| 67 |
|
| 68 |
|
|
@@ -84,3 +102,17 @@ async def list_blacklist_chats(_, m: Message):
|
|
| 84 |
txt = "No chats are currently blacklisted!"
|
| 85 |
await m.reply_text(txt)
|
| 86 |
return
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
from traceback import format_exc
|
| 2 |
|
| 3 |
+
from pyrogram.enums import ChatType as CT
|
| 4 |
from pyrogram.errors import PeerIdInvalid, RPCError
|
| 5 |
from pyrogram.types import Message
|
| 6 |
|
|
|
|
| 34 |
await replymsg.edit_text(
|
| 35 |
f"Added the following chats to Blacklist.\n<code>{', '.join(chat_ids)}</code>.",
|
| 36 |
)
|
| 37 |
+
else:
|
| 38 |
+
if m.chat.type == CT.PRIVATE:
|
| 39 |
+
await m.reply_text("Use in groups")
|
| 40 |
+
else:
|
| 41 |
+
chat_id = m.chat.id
|
| 42 |
+
db.add_chat(chat_id)
|
| 43 |
+
await m.reply_text("Added this chat to blacklist chats")
|
| 44 |
return
|
| 45 |
|
| 46 |
|
|
|
|
| 71 |
await replymsg.edit_text(
|
| 72 |
f"Removed the following chats to Blacklist.\n<code>{', '.join(chat_ids)}</code>.",
|
| 73 |
)
|
| 74 |
+
else:
|
| 75 |
+
if m.chat.type == CT.PRIVATE:
|
| 76 |
+
await m.reply_text("Use in groups")
|
| 77 |
+
else:
|
| 78 |
+
chat_id = m.chat.id
|
| 79 |
+
bl_chats = bl_chats = db.list_all_chats()
|
| 80 |
+
if chat_id not in bl_chats:
|
| 81 |
+
await m.reply_text("This chat is not in my list of blacklisted chats")
|
| 82 |
+
else:
|
| 83 |
+
await m.reply_text("Removed this chat from blacklist chats")
|
| 84 |
return
|
| 85 |
|
| 86 |
|
|
|
|
| 102 |
txt = "No chats are currently blacklisted!"
|
| 103 |
await m.reply_text(txt)
|
| 104 |
return
|
| 105 |
+
|
| 106 |
+
|
| 107 |
+
__PLUGIN__ = "Chat blacklist"
|
| 108 |
+
|
| 109 |
+
|
| 110 |
+
|
| 111 |
+
__HELP__ = """
|
| 112 |
+
**Chat blacklist**
|
| 113 |
+
|
| 114 |
+
**Dev commands:**
|
| 115 |
+
• /blchat [space separated id or username of chats]: Add chats to black list if given or the current chat.
|
| 116 |
+
• /rmblchat [space separated id or username of chats]: Remove chats from black list if given or the current chat.
|
| 117 |
+
• /blchats: Give the list of blacklisted chats
|
| 118 |
+
"""
|
Powers/plugins/dev.py
CHANGED
|
@@ -181,10 +181,13 @@ async def rm_support(c: Gojo, m: Message):
|
|
| 181 |
return
|
| 182 |
elif len(split) >= 2:
|
| 183 |
try:
|
| 184 |
-
curr
|
| 185 |
except Exception:
|
| 186 |
-
|
| 187 |
-
|
|
|
|
|
|
|
|
|
|
| 188 |
else:
|
| 189 |
await m.reply_text("**USAGE**\n/rmsupport [reply to user | user id | username]")
|
| 190 |
return
|
|
|
|
| 181 |
return
|
| 182 |
elif len(split) >= 2:
|
| 183 |
try:
|
| 184 |
+
curr = int(split[1])
|
| 185 |
except Exception:
|
| 186 |
+
try:
|
| 187 |
+
curr,_,_ = extract_user(m)
|
| 188 |
+
except Exception:
|
| 189 |
+
await m.reply_text("Dunno who u r talking abt")
|
| 190 |
+
return
|
| 191 |
else:
|
| 192 |
await m.reply_text("**USAGE**\n/rmsupport [reply to user | user id | username]")
|
| 193 |
return
|
Powers/plugins/disable.py
CHANGED
|
@@ -148,3 +148,23 @@ async def enablealll(_, q: CallbackQuery):
|
|
| 148 |
LOGGER.info(f"{user_id} enabled all in {q.message.chat.id}")
|
| 149 |
await q.message.edit_text("Enabled all!", show_alert=True)
|
| 150 |
return
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 148 |
LOGGER.info(f"{user_id} enabled all in {q.message.chat.id}")
|
| 149 |
await q.message.edit_text("Enabled all!", show_alert=True)
|
| 150 |
return
|
| 151 |
+
|
| 152 |
+
|
| 153 |
+
__PLUGIN__ = "disable able"
|
| 154 |
+
|
| 155 |
+
__alt_name__ = ["disable commands", "disable"]
|
| 156 |
+
|
| 157 |
+
|
| 158 |
+
__HELP__ = """
|
| 159 |
+
**Disable commands**
|
| 160 |
+
|
| 161 |
+
**Admin commands:**
|
| 162 |
+
• /disable [command]: To disable the given command.
|
| 163 |
+
• /disabledel [on | off]: Will delete the command which is disabled.
|
| 164 |
+
• /enable [command]: To enable the given command.
|
| 165 |
+
• /disableable : Give all disableable commands.
|
| 166 |
+
• /disabled : Give all disabled commands.
|
| 167 |
+
|
| 168 |
+
**Owner command:**
|
| 169 |
+
• /enableall : Enable all the disabled commands.
|
| 170 |
+
"""
|
Powers/plugins/flood.py
CHANGED
|
@@ -20,7 +20,6 @@ from Powers.utils.extras import BAN_GIFS, KICK_GIFS, MUTE_GIFS
|
|
| 20 |
from Powers.utils.kbhelpers import ikb
|
| 21 |
from Powers.vars import Config
|
| 22 |
|
| 23 |
-
SUPPORT_STAFF = get_support_staff()
|
| 24 |
|
| 25 |
on_key = ["on", "start", "disable"]
|
| 26 |
off_key = ["off", "end", "enable", "stop"]
|
|
@@ -192,6 +191,7 @@ async def flood_set(c: Gojo, m: Message):
|
|
| 192 |
|
| 193 |
@Gojo.on_callback_query(filters.regex("^f_"))
|
| 194 |
async def callbacks(c: Gojo, q: CallbackQuery):
|
|
|
|
| 195 |
data = q.data
|
| 196 |
if data == "f_close":
|
| 197 |
await q.answer("Closed")
|
|
@@ -291,6 +291,7 @@ async def reverse_callbacks(c: Gojo, q: CallbackQuery):
|
|
| 291 |
data = q.data.split("_")
|
| 292 |
action = data[1]
|
| 293 |
user_id = int(q.data.split("=")[1])
|
|
|
|
| 294 |
if not q.from_user:
|
| 295 |
return q.answer("Looks like you are not an user 👀")
|
| 296 |
if action == "ban":
|
|
|
|
| 20 |
from Powers.utils.kbhelpers import ikb
|
| 21 |
from Powers.vars import Config
|
| 22 |
|
|
|
|
| 23 |
|
| 24 |
on_key = ["on", "start", "disable"]
|
| 25 |
off_key = ["off", "end", "enable", "stop"]
|
|
|
|
| 191 |
|
| 192 |
@Gojo.on_callback_query(filters.regex("^f_"))
|
| 193 |
async def callbacks(c: Gojo, q: CallbackQuery):
|
| 194 |
+
SUPPORT_STAFF = get_support_staff()
|
| 195 |
data = q.data
|
| 196 |
if data == "f_close":
|
| 197 |
await q.answer("Closed")
|
|
|
|
| 291 |
data = q.data.split("_")
|
| 292 |
action = data[1]
|
| 293 |
user_id = int(q.data.split("=")[1])
|
| 294 |
+
SUPPORT_STAFF = get_support_staff()
|
| 295 |
if not q.from_user:
|
| 296 |
return q.answer("Looks like you are not an user 👀")
|
| 297 |
if action == "ban":
|
Powers/plugins/info.py
CHANGED
|
@@ -146,10 +146,15 @@ async def user_info(c: Gojo, user, already=False):
|
|
| 146 |
<b>🔅 Second Name</b>: <code>{last_name}</code>
|
| 147 |
<b>🔍 Username</b>: {("@" + username) if username else "NA"}
|
| 148 |
<b>✍️ Bio</b>: `{about}`
|
| 149 |
-
<b>🧑💻 Support</b>: {is_support}
|
| 150 |
-
|
| 151 |
-
<b>💣 Gbanned</b>: {gban}
|
| 152 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 153 |
<b>🌐 DC ID</b>: {dc_id}
|
| 154 |
<b>✋ RESTRICTED</b>: {is_restricted}
|
| 155 |
<b>✅ VERIFIED</b>: {is_verified}
|
|
@@ -157,7 +162,6 @@ async def user_info(c: Gojo, user, already=False):
|
|
| 157 |
<b>⚠️ SCAM</b> : {is_scam}
|
| 158 |
<b>🤖 BOT</b>: {is_bot}
|
| 159 |
<b>👀 Last seen</b>: <code>{last_date}</code>
|
| 160 |
-
|
| 161 |
"""
|
| 162 |
|
| 163 |
return caption, photo_id
|
|
|
|
| 146 |
<b>🔅 Second Name</b>: <code>{last_name}</code>
|
| 147 |
<b>🔍 Username</b>: {("@" + username) if username else "NA"}
|
| 148 |
<b>✍️ Bio</b>: `{about}`
|
| 149 |
+
<b>🧑💻 Support</b>: {is_support}\n"""
|
| 150 |
+
if is_support:
|
| 151 |
+
caption += f"<b>🥷 Support user type</b>: <code>{omp}</code>\n<b>💣 Gbanned</b>: {gban}\n"
|
| 152 |
+
else:
|
| 153 |
+
caption += f"<b>💣 Gbanned</b>: {gban}\n"
|
| 154 |
+
|
| 155 |
+
if gban:
|
| 156 |
+
caption += f"<b>☠️ Gban reason</b>: <code>{reason}</code>\n"
|
| 157 |
+
caption += f"""
|
| 158 |
<b>🌐 DC ID</b>: {dc_id}
|
| 159 |
<b>✋ RESTRICTED</b>: {is_restricted}
|
| 160 |
<b>✅ VERIFIED</b>: {is_verified}
|
|
|
|
| 162 |
<b>⚠️ SCAM</b> : {is_scam}
|
| 163 |
<b>🤖 BOT</b>: {is_bot}
|
| 164 |
<b>👀 Last seen</b>: <code>{last_date}</code>
|
|
|
|
| 165 |
"""
|
| 166 |
|
| 167 |
return caption, photo_id
|
Powers/plugins/locks.py
CHANGED
|
@@ -15,8 +15,6 @@ from Powers.utils.caching import ADMIN_CACHE, admin_cache_reload
|
|
| 15 |
from Powers.utils.custom_filters import command, restrict_filter
|
| 16 |
from Powers.vars import Config
|
| 17 |
|
| 18 |
-
SUDO_LEVEL = get_support_staff("sudo_level")
|
| 19 |
-
|
| 20 |
l_t = """
|
| 21 |
**Lock Types:**
|
| 22 |
- `all` = Everything
|
|
@@ -67,10 +65,12 @@ async def lock_perm(c: Gojo, m: Message):
|
|
| 67 |
invite = get_perm.can_invite_users
|
| 68 |
pin = get_perm.can_pin_messages
|
| 69 |
stickers = animations = games = inlinebots = None
|
|
|
|
| 70 |
|
| 71 |
if lock_type == "all":
|
| 72 |
try:
|
| 73 |
await c.set_chat_permissions(chat_id, ChatPermissions())
|
|
|
|
| 74 |
LOGGER.info(f"{m.from_user.id} locked all permissions in {m.chat.id}")
|
| 75 |
except ChatNotModified:
|
| 76 |
pass
|
|
@@ -80,7 +80,6 @@ async def lock_perm(c: Gojo, m: Message):
|
|
| 80 |
await prevent_approved(m)
|
| 81 |
return
|
| 82 |
|
| 83 |
-
lock = LOCKS()
|
| 84 |
|
| 85 |
if lock_type == "msg":
|
| 86 |
msg = False
|
|
@@ -280,6 +279,7 @@ async def unlock_perm(c: Gojo, m: Message):
|
|
| 280 |
return
|
| 281 |
|
| 282 |
if unlock_type == "all":
|
|
|
|
| 283 |
try:
|
| 284 |
await c.set_chat_permissions(
|
| 285 |
chat_id,
|
|
@@ -294,6 +294,7 @@ async def unlock_perm(c: Gojo, m: Message):
|
|
| 294 |
can_pin_messages=True,
|
| 295 |
),
|
| 296 |
)
|
|
|
|
| 297 |
LOGGER.info(f"{m.from_user.id} unlocked all permissions in {m.chat.id}")
|
| 298 |
except ChatNotModified:
|
| 299 |
pass
|
|
@@ -314,7 +315,6 @@ async def unlock_perm(c: Gojo, m: Message):
|
|
| 314 |
upin = get_uperm.can_pin_messages
|
| 315 |
ustickers = uanimations = ugames = uinlinebots = None
|
| 316 |
|
| 317 |
-
lock = LOCKS()
|
| 318 |
|
| 319 |
if unlock_type == "msg":
|
| 320 |
umsg = True
|
|
@@ -455,6 +455,8 @@ async def is_approved_user(c:Gojo, m: Message):
|
|
| 455 |
except KeyError:
|
| 456 |
admins_group = await admin_cache_reload(m, "lock")
|
| 457 |
|
|
|
|
|
|
|
| 458 |
if m.forward_from:
|
| 459 |
if m.from_user.id in ul or m.from_user.id in SUDO_LEVEL or m.from_user.id in admins_group or m.from_user.id == Config.BOT_ID:
|
| 460 |
return True
|
|
|
|
| 15 |
from Powers.utils.custom_filters import command, restrict_filter
|
| 16 |
from Powers.vars import Config
|
| 17 |
|
|
|
|
|
|
|
| 18 |
l_t = """
|
| 19 |
**Lock Types:**
|
| 20 |
- `all` = Everything
|
|
|
|
| 65 |
invite = get_perm.can_invite_users
|
| 66 |
pin = get_perm.can_pin_messages
|
| 67 |
stickers = animations = games = inlinebots = None
|
| 68 |
+
lock = LOCKS()
|
| 69 |
|
| 70 |
if lock_type == "all":
|
| 71 |
try:
|
| 72 |
await c.set_chat_permissions(chat_id, ChatPermissions())
|
| 73 |
+
lock.insert_lock_channel(m.chat.id, "all")
|
| 74 |
LOGGER.info(f"{m.from_user.id} locked all permissions in {m.chat.id}")
|
| 75 |
except ChatNotModified:
|
| 76 |
pass
|
|
|
|
| 80 |
await prevent_approved(m)
|
| 81 |
return
|
| 82 |
|
|
|
|
| 83 |
|
| 84 |
if lock_type == "msg":
|
| 85 |
msg = False
|
|
|
|
| 279 |
return
|
| 280 |
|
| 281 |
if unlock_type == "all":
|
| 282 |
+
lock = LOCKS()
|
| 283 |
try:
|
| 284 |
await c.set_chat_permissions(
|
| 285 |
chat_id,
|
|
|
|
| 294 |
can_pin_messages=True,
|
| 295 |
),
|
| 296 |
)
|
| 297 |
+
lock.remove_lock_channel(m.chat.id,"all")
|
| 298 |
LOGGER.info(f"{m.from_user.id} unlocked all permissions in {m.chat.id}")
|
| 299 |
except ChatNotModified:
|
| 300 |
pass
|
|
|
|
| 315 |
upin = get_uperm.can_pin_messages
|
| 316 |
ustickers = uanimations = ugames = uinlinebots = None
|
| 317 |
|
|
|
|
| 318 |
|
| 319 |
if unlock_type == "msg":
|
| 320 |
umsg = True
|
|
|
|
| 455 |
except KeyError:
|
| 456 |
admins_group = await admin_cache_reload(m, "lock")
|
| 457 |
|
| 458 |
+
SUDO_LEVEL = get_support_staff("sudo_level")
|
| 459 |
+
|
| 460 |
if m.forward_from:
|
| 461 |
if m.from_user.id in ul or m.from_user.id in SUDO_LEVEL or m.from_user.id in admins_group or m.from_user.id == Config.BOT_ID:
|
| 462 |
return True
|
Powers/plugins/muting.py
CHANGED
|
@@ -20,7 +20,6 @@ from Powers.utils.parser import mention_html
|
|
| 20 |
from Powers.utils.string import extract_time
|
| 21 |
from Powers.vars import Config
|
| 22 |
|
| 23 |
-
SUPPORT_STAFF = get_support_staff()
|
| 24 |
|
| 25 |
@Gojo.on_message(command("tmute") & restrict_filter)
|
| 26 |
async def tmute_usr(c: Gojo, m: Message):
|
|
@@ -40,6 +39,8 @@ async def tmute_usr(c: Gojo, m: Message):
|
|
| 40 |
await m.reply_text("Huh, why would I mute myself?")
|
| 41 |
return
|
| 42 |
|
|
|
|
|
|
|
| 43 |
if user_id in SUPPORT_STAFF:
|
| 44 |
LOGGER.info(
|
| 45 |
f"{m.from_user.id} trying to mute {user_id} (SUPPORT_STAFF) in {m.chat.id}",
|
|
@@ -152,6 +153,7 @@ async def dtmute_usr(c: Gojo, m: Message):
|
|
| 152 |
await m.reply_text("Huh, why would I mute myself?")
|
| 153 |
return
|
| 154 |
|
|
|
|
| 155 |
if user_id in SUPPORT_STAFF:
|
| 156 |
LOGGER.info(
|
| 157 |
f"{m.from_user.id} trying to mute {user_id} (SUPPORT_STAFF) in {m.chat.id}",
|
|
@@ -260,6 +262,7 @@ async def stmute_usr(c: Gojo, m: Message):
|
|
| 260 |
await m.reply_text("Huh, why would I mute myself?")
|
| 261 |
return
|
| 262 |
|
|
|
|
| 263 |
if user_id in SUPPORT_STAFF:
|
| 264 |
LOGGER.info(
|
| 265 |
f"{m.from_user.id} trying to mute {user_id} (SUPPORT_STAFF) in {m.chat.id}",
|
|
@@ -353,6 +356,7 @@ async def mute_usr(c: Gojo, m: Message):
|
|
| 353 |
await m.reply_text("Huh, why would I mute myself?")
|
| 354 |
return
|
| 355 |
|
|
|
|
| 356 |
if user_id in SUPPORT_STAFF:
|
| 357 |
LOGGER.info(
|
| 358 |
f"{m.from_user.id} trying to mute {user_id} (SUPPORT_STAFF) in {m.chat.id}",
|
|
@@ -438,6 +442,8 @@ async def smute_usr(c: Gojo, m: Message):
|
|
| 438 |
await m.reply_text("Huh, why would I mute myself?")
|
| 439 |
return
|
| 440 |
|
|
|
|
|
|
|
| 441 |
if user_id in SUPPORT_STAFF:
|
| 442 |
LOGGER.info(
|
| 443 |
f"{m.from_user.id} trying to mute {user_id} (SUPPORT_STAFF) in {m.chat.id}",
|
|
@@ -509,6 +515,8 @@ async def dmute_usr(c: Gojo, m: Message):
|
|
| 509 |
await m.reply_text("Huh, why would I mute myself?")
|
| 510 |
return
|
| 511 |
|
|
|
|
|
|
|
| 512 |
if user_id in SUPPORT_STAFF:
|
| 513 |
LOGGER.info(
|
| 514 |
f"{m.from_user.id} trying to mute {user_id} (SUPPORT_STAFF) in {m.chat.id}",
|
|
|
|
| 20 |
from Powers.utils.string import extract_time
|
| 21 |
from Powers.vars import Config
|
| 22 |
|
|
|
|
| 23 |
|
| 24 |
@Gojo.on_message(command("tmute") & restrict_filter)
|
| 25 |
async def tmute_usr(c: Gojo, m: Message):
|
|
|
|
| 39 |
await m.reply_text("Huh, why would I mute myself?")
|
| 40 |
return
|
| 41 |
|
| 42 |
+
SUPPORT_STAFF = get_support_staff()
|
| 43 |
+
|
| 44 |
if user_id in SUPPORT_STAFF:
|
| 45 |
LOGGER.info(
|
| 46 |
f"{m.from_user.id} trying to mute {user_id} (SUPPORT_STAFF) in {m.chat.id}",
|
|
|
|
| 153 |
await m.reply_text("Huh, why would I mute myself?")
|
| 154 |
return
|
| 155 |
|
| 156 |
+
SUPPORT_STAFF = get_support_staff()
|
| 157 |
if user_id in SUPPORT_STAFF:
|
| 158 |
LOGGER.info(
|
| 159 |
f"{m.from_user.id} trying to mute {user_id} (SUPPORT_STAFF) in {m.chat.id}",
|
|
|
|
| 262 |
await m.reply_text("Huh, why would I mute myself?")
|
| 263 |
return
|
| 264 |
|
| 265 |
+
SUPPORT_STAFF = get_support_staff()
|
| 266 |
if user_id in SUPPORT_STAFF:
|
| 267 |
LOGGER.info(
|
| 268 |
f"{m.from_user.id} trying to mute {user_id} (SUPPORT_STAFF) in {m.chat.id}",
|
|
|
|
| 356 |
await m.reply_text("Huh, why would I mute myself?")
|
| 357 |
return
|
| 358 |
|
| 359 |
+
SUPPORT_STAFF = get_support_staff()
|
| 360 |
if user_id in SUPPORT_STAFF:
|
| 361 |
LOGGER.info(
|
| 362 |
f"{m.from_user.id} trying to mute {user_id} (SUPPORT_STAFF) in {m.chat.id}",
|
|
|
|
| 442 |
await m.reply_text("Huh, why would I mute myself?")
|
| 443 |
return
|
| 444 |
|
| 445 |
+
SUPPORT_STAFF = get_support_staff()
|
| 446 |
+
|
| 447 |
if user_id in SUPPORT_STAFF:
|
| 448 |
LOGGER.info(
|
| 449 |
f"{m.from_user.id} trying to mute {user_id} (SUPPORT_STAFF) in {m.chat.id}",
|
|
|
|
| 515 |
await m.reply_text("Huh, why would I mute myself?")
|
| 516 |
return
|
| 517 |
|
| 518 |
+
|
| 519 |
+
SUPPORT_STAFF = get_support_staff()
|
| 520 |
if user_id in SUPPORT_STAFF:
|
| 521 |
LOGGER.info(
|
| 522 |
f"{m.from_user.id} trying to mute {user_id} (SUPPORT_STAFF) in {m.chat.id}",
|
Powers/plugins/report.py
CHANGED
|
@@ -14,7 +14,6 @@ from Powers.utils.custom_filters import admin_filter, command
|
|
| 14 |
from Powers.utils.kbhelpers import ikb
|
| 15 |
from Powers.utils.parser import mention_html
|
| 16 |
|
| 17 |
-
SUPPORT_STAFF = get_support_staff()
|
| 18 |
|
| 19 |
@Gojo.on_message(
|
| 20 |
command("reports") & (filters.private | admin_filter),
|
|
@@ -85,7 +84,8 @@ async def report_watcher(c: Gojo, m: Message):
|
|
| 85 |
if reported_user.id == me.id:
|
| 86 |
await m.reply_text("Nice try.")
|
| 87 |
return
|
| 88 |
-
|
|
|
|
| 89 |
if reported_user.id in SUPPORT_STAFF:
|
| 90 |
await m.reply_text("Uh? You reporting my support team?")
|
| 91 |
return
|
|
|
|
| 14 |
from Powers.utils.kbhelpers import ikb
|
| 15 |
from Powers.utils.parser import mention_html
|
| 16 |
|
|
|
|
| 17 |
|
| 18 |
@Gojo.on_message(
|
| 19 |
command("reports") & (filters.private | admin_filter),
|
|
|
|
| 84 |
if reported_user.id == me.id:
|
| 85 |
await m.reply_text("Nice try.")
|
| 86 |
return
|
| 87 |
+
|
| 88 |
+
SUPPORT_STAFF = get_support_staff()
|
| 89 |
if reported_user.id in SUPPORT_STAFF:
|
| 90 |
await m.reply_text("Uh? You reporting my support team?")
|
| 91 |
return
|
Powers/plugins/warns.py
CHANGED
|
@@ -18,7 +18,6 @@ from Powers.utils.extract_user import extract_user
|
|
| 18 |
from Powers.utils.parser import mention_html
|
| 19 |
from Powers.vars import Config
|
| 20 |
|
| 21 |
-
SUPPORT_STAFF = get_support_staff()
|
| 22 |
|
| 23 |
@Gojo.on_message(
|
| 24 |
command(["warn", "swarn", "dwarn"]) & restrict_filter,
|
|
@@ -49,6 +48,7 @@ async def warn(c: Gojo, m: Message):
|
|
| 49 |
await m.reply_text("Huh, why would I warn myself?")
|
| 50 |
return
|
| 51 |
|
|
|
|
| 52 |
if user_id in SUPPORT_STAFF:
|
| 53 |
await m.reply_text(
|
| 54 |
text="This user is in my support staff, cannot restrict them."
|
|
@@ -151,6 +151,7 @@ async def reset_warn(c: Gojo, m: Message):
|
|
| 151 |
await m.reply_text("Huh, why would I warn myself?")
|
| 152 |
return
|
| 153 |
|
|
|
|
| 154 |
if user_id in SUPPORT_STAFF:
|
| 155 |
await m.reply_text(
|
| 156 |
"They are support users, cannot be restriced, how am I then supposed to unrestrict them?",
|
|
@@ -186,6 +187,7 @@ async def list_warns(c: Gojo, m: Message):
|
|
| 186 |
await m.reply_text("Huh, why would I warn myself?")
|
| 187 |
return
|
| 188 |
|
|
|
|
| 189 |
if user_id in SUPPORT_STAFF:
|
| 190 |
await m.reply_text("This user has no warns!")
|
| 191 |
LOGGER.info(
|
|
@@ -234,6 +236,7 @@ async def remove_warn(c: Gojo, m: Message):
|
|
| 234 |
await m.reply_text("Huh, why would I warn myself?")
|
| 235 |
return
|
| 236 |
|
|
|
|
| 237 |
if user_id in SUPPORT_STAFF:
|
| 238 |
await m.reply_text("This user has no warns!")
|
| 239 |
LOGGER.info(
|
|
@@ -300,15 +303,17 @@ async def remove_last_warn_btn(c: Gojo, q: CallbackQuery):
|
|
| 300 |
)
|
| 301 |
if action == "kick":
|
| 302 |
try:
|
| 303 |
-
timee =
|
| 304 |
await c.ban_chat_member(chat_id, user_id, until_date=timee)
|
| 305 |
await q.message.edit_text(
|
| 306 |
(
|
| 307 |
f"Admin {(await mention_html(q.from_user.first_name, q.from_user.id))} "
|
| 308 |
-
"kicked user "
|
| 309 |
f"{(await mention_html(user_first_name, user_id))} for last warning!"
|
| 310 |
),
|
| 311 |
)
|
|
|
|
|
|
|
| 312 |
except RPCError as err:
|
| 313 |
await q.message.edit_text(
|
| 314 |
f"🛑 Failed to Kick\n<b>Error:</b>\n</code>{err}</code>",
|
|
@@ -388,5 +393,7 @@ __HELP__ = """
|
|
| 388 |
• /warnmode `<ban/kick/mute>`: Set the chat's warn mode.
|
| 389 |
• /warnlimit `<number>`: Set the number of warnings before users are punished.
|
| 390 |
|
|
|
|
|
|
|
| 391 |
**Examples:**
|
| 392 |
`/warn @user`: this warns a user in the chat."""
|
|
|
|
| 18 |
from Powers.utils.parser import mention_html
|
| 19 |
from Powers.vars import Config
|
| 20 |
|
|
|
|
| 21 |
|
| 22 |
@Gojo.on_message(
|
| 23 |
command(["warn", "swarn", "dwarn"]) & restrict_filter,
|
|
|
|
| 48 |
await m.reply_text("Huh, why would I warn myself?")
|
| 49 |
return
|
| 50 |
|
| 51 |
+
SUPPORT_STAFF = get_support_staff()
|
| 52 |
if user_id in SUPPORT_STAFF:
|
| 53 |
await m.reply_text(
|
| 54 |
text="This user is in my support staff, cannot restrict them."
|
|
|
|
| 151 |
await m.reply_text("Huh, why would I warn myself?")
|
| 152 |
return
|
| 153 |
|
| 154 |
+
SUPPORT_STAFF = get_support_staff()
|
| 155 |
if user_id in SUPPORT_STAFF:
|
| 156 |
await m.reply_text(
|
| 157 |
"They are support users, cannot be restriced, how am I then supposed to unrestrict them?",
|
|
|
|
| 187 |
await m.reply_text("Huh, why would I warn myself?")
|
| 188 |
return
|
| 189 |
|
| 190 |
+
SUPPORT_STAFF = get_support_staff()
|
| 191 |
if user_id in SUPPORT_STAFF:
|
| 192 |
await m.reply_text("This user has no warns!")
|
| 193 |
LOGGER.info(
|
|
|
|
| 236 |
await m.reply_text("Huh, why would I warn myself?")
|
| 237 |
return
|
| 238 |
|
| 239 |
+
SUPPORT_STAFF = get_support_staff()
|
| 240 |
if user_id in SUPPORT_STAFF:
|
| 241 |
await m.reply_text("This user has no warns!")
|
| 242 |
LOGGER.info(
|
|
|
|
| 303 |
)
|
| 304 |
if action == "kick":
|
| 305 |
try:
|
| 306 |
+
timee = datetime.now(TIME_ZONE) + timedelta(minutes=45)
|
| 307 |
await c.ban_chat_member(chat_id, user_id, until_date=timee)
|
| 308 |
await q.message.edit_text(
|
| 309 |
(
|
| 310 |
f"Admin {(await mention_html(q.from_user.first_name, q.from_user.id))} "
|
| 311 |
+
"kicked user they can't join the chat for 45 minutes"
|
| 312 |
f"{(await mention_html(user_first_name, user_id))} for last warning!"
|
| 313 |
),
|
| 314 |
)
|
| 315 |
+
warn_db = Warns(q.message.chat.id)
|
| 316 |
+
warn_db.reset_warns(user_id)
|
| 317 |
except RPCError as err:
|
| 318 |
await q.message.edit_text(
|
| 319 |
f"🛑 Failed to Kick\n<b>Error:</b>\n</code>{err}</code>",
|
|
|
|
| 393 |
• /warnmode `<ban/kick/mute>`: Set the chat's warn mode.
|
| 394 |
• /warnlimit `<number>`: Set the number of warnings before users are punished.
|
| 395 |
|
| 396 |
+
**IF THE USER IS KICKED THEN THEY WILL BE TEMPORARILY BANNED FOR 45 MINUTES**
|
| 397 |
+
|
| 398 |
**Examples:**
|
| 399 |
`/warn @user`: this warns a user in the chat."""
|
Powers/plugins/watchers.py
CHANGED
|
@@ -22,7 +22,6 @@ from Powers.utils.regex_utils import regex_searcher
|
|
| 22 |
|
| 23 |
# Initialise
|
| 24 |
gban_db = GBan()
|
| 25 |
-
SUPPORT_STAFF = get_support_staff()
|
| 26 |
|
| 27 |
@Gojo.on_message(filters.linked_channel)
|
| 28 |
async def antichanpin_cleanlinked(c: Gojo, m: Message):
|
|
@@ -124,7 +123,8 @@ async def bl_watcher(_, m: Message):
|
|
| 124 |
),
|
| 125 |
)
|
| 126 |
return
|
| 127 |
-
|
|
|
|
| 128 |
if m.from_user.id in SUPPORT_STAFF:
|
| 129 |
# Don't work on Support Staff!
|
| 130 |
return
|
|
|
|
| 22 |
|
| 23 |
# Initialise
|
| 24 |
gban_db = GBan()
|
|
|
|
| 25 |
|
| 26 |
@Gojo.on_message(filters.linked_channel)
|
| 27 |
async def antichanpin_cleanlinked(c: Gojo, m: Message):
|
|
|
|
| 123 |
),
|
| 124 |
)
|
| 125 |
return
|
| 126 |
+
|
| 127 |
+
SUPPORT_STAFF = get_support_staff()
|
| 128 |
if m.from_user.id in SUPPORT_STAFF:
|
| 129 |
# Don't work on Support Staff!
|
| 130 |
return
|
Powers/utils/admin_check.py
CHANGED
|
@@ -5,9 +5,6 @@ from pyrogram.types import CallbackQuery, Message
|
|
| 5 |
|
| 6 |
from Powers import DEV_USERS, LOGGER, OWNER_ID, SUDO_USERS
|
| 7 |
|
| 8 |
-
SUDO_LEVEL = SUDO_USERS + DEV_USERS + [int(OWNER_ID)]
|
| 9 |
-
DEV_LEVEL = DEV_USERS + [int(OWNER_ID)]
|
| 10 |
-
|
| 11 |
|
| 12 |
async def admin_check(m: Message or CallbackQuery) -> bool:
|
| 13 |
"""Checks if user is admin or not."""
|
|
@@ -16,6 +13,8 @@ async def admin_check(m: Message or CallbackQuery) -> bool:
|
|
| 16 |
if isinstance(m, CallbackQuery):
|
| 17 |
user_id = m.message.from_user.id
|
| 18 |
|
|
|
|
|
|
|
| 19 |
try:
|
| 20 |
if user_id in SUDO_LEVEL:
|
| 21 |
return True
|
|
@@ -66,6 +65,8 @@ async def owner_check(m: Message or CallbackQuery) -> bool:
|
|
| 66 |
user_id = m.message.from_user.id
|
| 67 |
m = m.message
|
| 68 |
|
|
|
|
|
|
|
| 69 |
try:
|
| 70 |
if user_id in SUDO_LEVEL:
|
| 71 |
return True
|
|
|
|
| 5 |
|
| 6 |
from Powers import DEV_USERS, LOGGER, OWNER_ID, SUDO_USERS
|
| 7 |
|
|
|
|
|
|
|
|
|
|
| 8 |
|
| 9 |
async def admin_check(m: Message or CallbackQuery) -> bool:
|
| 10 |
"""Checks if user is admin or not."""
|
|
|
|
| 13 |
if isinstance(m, CallbackQuery):
|
| 14 |
user_id = m.message.from_user.id
|
| 15 |
|
| 16 |
+
SUDO_LEVEL = SUDO_USERS + DEV_USERS + [int(OWNER_ID)]
|
| 17 |
+
|
| 18 |
try:
|
| 19 |
if user_id in SUDO_LEVEL:
|
| 20 |
return True
|
|
|
|
| 65 |
user_id = m.message.from_user.id
|
| 66 |
m = m.message
|
| 67 |
|
| 68 |
+
SUDO_LEVEL = SUDO_USERS + DEV_USERS + [int(OWNER_ID)]
|
| 69 |
+
|
| 70 |
try:
|
| 71 |
if user_id in SUDO_LEVEL:
|
| 72 |
return True
|
Powers/utils/custom_filters.py
CHANGED
|
@@ -18,9 +18,6 @@ from Powers.database.flood_db import Floods
|
|
| 18 |
from Powers.utils.caching import ADMIN_CACHE, admin_cache_reload
|
| 19 |
from Powers.vars import Config
|
| 20 |
|
| 21 |
-
SUDO_LEVEL = set(SUDO_USERS + DEV_USERS + [int(OWNER_ID)])
|
| 22 |
-
DEV_LEVEL = set(DEV_USERS + [int(OWNER_ID)])
|
| 23 |
-
|
| 24 |
|
| 25 |
def command(
|
| 26 |
commands: Union[str, List[str]],
|
|
@@ -52,11 +49,11 @@ def command(
|
|
| 52 |
if owner_cmd and (m.from_user.id != OWNER_ID):
|
| 53 |
# Only owner allowed to use this...!
|
| 54 |
return False
|
| 55 |
-
|
| 56 |
if dev_cmd and (m.from_user.id not in DEV_LEVEL):
|
| 57 |
# Only devs allowed to use this...!
|
| 58 |
return False
|
| 59 |
-
|
| 60 |
if sudo_cmd and (m.from_user.id not in SUDO_LEVEL):
|
| 61 |
# Only sudos and above allowed to use it
|
| 62 |
return False
|
|
@@ -73,7 +70,7 @@ def command(
|
|
| 73 |
m.command = [matches.group(1)]
|
| 74 |
if matches.group(1) not in flt.commands:
|
| 75 |
return False
|
| 76 |
-
if bool(m.chat and m.chat.type in {ChatType.SUPERGROUP}):
|
| 77 |
try:
|
| 78 |
user_status = (await m.chat.get_member(m.from_user.id)).status
|
| 79 |
except UserNotParticipant:
|
|
@@ -293,6 +290,7 @@ async def can_pin_message_func(_, __, m):
|
|
| 293 |
return True
|
| 294 |
|
| 295 |
# Bypass the bot devs, sudos and owner
|
|
|
|
| 296 |
if m.from_user.id in SUDO_LEVEL:
|
| 297 |
return True
|
| 298 |
|
|
@@ -362,7 +360,8 @@ async def flood_check_filter(_, __, m: Message):
|
|
| 362 |
is_flood = Flood.is_chat(c_id)
|
| 363 |
|
| 364 |
app_users = Approve(m.chat.id).list_approved()
|
| 365 |
-
|
|
|
|
| 366 |
if not is_flood or u_id in SUDO_LEVEL:
|
| 367 |
return False
|
| 368 |
|
|
|
|
| 18 |
from Powers.utils.caching import ADMIN_CACHE, admin_cache_reload
|
| 19 |
from Powers.vars import Config
|
| 20 |
|
|
|
|
|
|
|
|
|
|
| 21 |
|
| 22 |
def command(
|
| 23 |
commands: Union[str, List[str]],
|
|
|
|
| 49 |
if owner_cmd and (m.from_user.id != OWNER_ID):
|
| 50 |
# Only owner allowed to use this...!
|
| 51 |
return False
|
| 52 |
+
DEV_LEVEL = set(DEV_USERS + [int(OWNER_ID)])
|
| 53 |
if dev_cmd and (m.from_user.id not in DEV_LEVEL):
|
| 54 |
# Only devs allowed to use this...!
|
| 55 |
return False
|
| 56 |
+
SUDO_LEVEL = set(SUDO_USERS + DEV_USERS + [int(OWNER_ID)])
|
| 57 |
if sudo_cmd and (m.from_user.id not in SUDO_LEVEL):
|
| 58 |
# Only sudos and above allowed to use it
|
| 59 |
return False
|
|
|
|
| 70 |
m.command = [matches.group(1)]
|
| 71 |
if matches.group(1) not in flt.commands:
|
| 72 |
return False
|
| 73 |
+
if bool(m.chat and m.chat.type in {ChatType.SUPERGROUP, ChatType.GROUP}):
|
| 74 |
try:
|
| 75 |
user_status = (await m.chat.get_member(m.from_user.id)).status
|
| 76 |
except UserNotParticipant:
|
|
|
|
| 290 |
return True
|
| 291 |
|
| 292 |
# Bypass the bot devs, sudos and owner
|
| 293 |
+
SUDO_LEVEL = set(SUDO_USERS + DEV_USERS + [int(OWNER_ID)])
|
| 294 |
if m.from_user.id in SUDO_LEVEL:
|
| 295 |
return True
|
| 296 |
|
|
|
|
| 360 |
is_flood = Flood.is_chat(c_id)
|
| 361 |
|
| 362 |
app_users = Approve(m.chat.id).list_approved()
|
| 363 |
+
SUDO_LEVEL = set(SUDO_USERS + DEV_USERS + [int(OWNER_ID)])
|
| 364 |
+
|
| 365 |
if not is_flood or u_id in SUDO_LEVEL:
|
| 366 |
return False
|
| 367 |
|
Powers/utils/start_utils.py
CHANGED
|
@@ -53,7 +53,7 @@ async def gen_start_kb(q: Message or CallbackQuery):
|
|
| 53 |
"📚 Commands & Help", "commands"
|
| 54 |
),
|
| 55 |
(
|
| 56 |
-
"
|
| 57 |
"bot_curr_info"
|
| 58 |
)
|
| 59 |
],
|
|
@@ -71,12 +71,12 @@ async def gen_start_kb(q: Message or CallbackQuery):
|
|
| 71 |
],
|
| 72 |
[
|
| 73 |
(
|
| 74 |
-
"Essential",
|
| 75 |
"https://t.me/+PcVYvdzNt4E1YjM1",
|
| 76 |
"url",
|
| 77 |
),
|
| 78 |
(
|
| 79 |
-
"Powered by",
|
| 80 |
f"https://{Config.SUPPORT_CHANNEL}.t.me",
|
| 81 |
"url",
|
| 82 |
),
|
|
|
|
| 53 |
"📚 Commands & Help", "commands"
|
| 54 |
),
|
| 55 |
(
|
| 56 |
+
"Bot info 👾",
|
| 57 |
"bot_curr_info"
|
| 58 |
)
|
| 59 |
],
|
|
|
|
| 71 |
],
|
| 72 |
[
|
| 73 |
(
|
| 74 |
+
"❗️ Essential",
|
| 75 |
"https://t.me/+PcVYvdzNt4E1YjM1",
|
| 76 |
"url",
|
| 77 |
),
|
| 78 |
(
|
| 79 |
+
"Powered by ⚡️",
|
| 80 |
f"https://{Config.SUPPORT_CHANNEL}.t.me",
|
| 81 |
"url",
|
| 82 |
),
|