Spaces:
Running
Running
iamgojoof6eyes
commited on
Commit
·
9ccef81
1
Parent(s):
2630231
Looks good
Browse files- Powers/plugins/admin.py +4 -4
- Powers/plugins/greetings.py +1 -1
- Powers/plugins/purge.py +6 -6
- Powers/plugins/report.py +3 -3
- Powers/plugins/utils.py +2 -2
- Powers/utils/chat_type.py +4 -1
- Powers/utils/custom_filters.py +8 -8
- Powers/utils/string.py +2 -2
Powers/plugins/admin.py
CHANGED
|
@@ -35,8 +35,8 @@ from Powers.vars import Config
|
|
| 35 |
@Gojo.on_message(command("adminlist"))
|
| 36 |
async def adminlist_show(_, m: Message):
|
| 37 |
global ADMIN_CACHE
|
| 38 |
-
chat_type = chattype(
|
| 39 |
-
if chat_type != "
|
| 40 |
return await m.reply_text(
|
| 41 |
text="This command is made to be used in groups only!",
|
| 42 |
)
|
|
@@ -122,8 +122,8 @@ async def zombie_clean(c: Gojo, m: Message):
|
|
| 122 |
@Gojo.on_message(command("admincache"))
|
| 123 |
async def reload_admins(_, m: Message):
|
| 124 |
global TEMP_ADMIN_CACHE_BLOCK
|
| 125 |
-
chat_type = chattype(
|
| 126 |
-
if chat_type != "
|
| 127 |
return await m.reply_text(
|
| 128 |
"This command is made to be used in groups only!",
|
| 129 |
)
|
|
|
|
| 35 |
@Gojo.on_message(command("adminlist"))
|
| 36 |
async def adminlist_show(_, m: Message):
|
| 37 |
global ADMIN_CACHE
|
| 38 |
+
chat_type = chattype(m)
|
| 39 |
+
if chat_type != "supreme group":
|
| 40 |
return await m.reply_text(
|
| 41 |
text="This command is made to be used in groups only!",
|
| 42 |
)
|
|
|
|
| 122 |
@Gojo.on_message(command("admincache"))
|
| 123 |
async def reload_admins(_, m: Message):
|
| 124 |
global TEMP_ADMIN_CACHE_BLOCK
|
| 125 |
+
chat_type = chattype(m)
|
| 126 |
+
if chat_type != "supreme group":
|
| 127 |
return await m.reply_text(
|
| 128 |
"This command is made to be used in groups only!",
|
| 129 |
)
|
Powers/plugins/greetings.py
CHANGED
|
@@ -36,6 +36,7 @@ async def escape_mentions_using_curly_brackets_wl(
|
|
| 36 |
else:
|
| 37 |
user = m.old_chat_member.user if m.old_chat_member else m.from_user
|
| 38 |
if teks:
|
|
|
|
| 39 |
teks = teks.format(
|
| 40 |
first=escape(user.first_name),
|
| 41 |
last=escape(user.last_name or user.first_name),
|
|
@@ -54,7 +55,6 @@ async def escape_mentions_using_curly_brackets_wl(
|
|
| 54 |
),
|
| 55 |
mention=await (mention_html(escape(user.first_name), user.id)),
|
| 56 |
chatname=escape(m.chat.title)
|
| 57 |
-
chat_type = chattype(_, m)
|
| 58 |
if chat_type != "private"
|
| 59 |
else escape(user.first_name),
|
| 60 |
id=user.id,
|
|
|
|
| 36 |
else:
|
| 37 |
user = m.old_chat_member.user if m.old_chat_member else m.from_user
|
| 38 |
if teks:
|
| 39 |
+
chat_type = chattype(m)
|
| 40 |
teks = teks.format(
|
| 41 |
first=escape(user.first_name),
|
| 42 |
last=escape(user.last_name or user.first_name),
|
|
|
|
| 55 |
),
|
| 56 |
mention=await (mention_html(escape(user.first_name), user.id)),
|
| 57 |
chatname=escape(m.chat.title)
|
|
|
|
| 58 |
if chat_type != "private"
|
| 59 |
else escape(user.first_name),
|
| 60 |
id=user.id,
|
Powers/plugins/purge.py
CHANGED
|
@@ -11,8 +11,8 @@ from Powers.utils.custom_filters import admin_filter, command
|
|
| 11 |
|
| 12 |
@Gojo.on_message(command("purge") & admin_filter)
|
| 13 |
async def purge(c: Gojo, m: Message):
|
| 14 |
-
chat_type = chattype(
|
| 15 |
-
if chat_type != "
|
| 16 |
await m.reply_text(text="Cannot purge messages in a basic group")
|
| 17 |
return
|
| 18 |
|
|
@@ -59,8 +59,8 @@ async def purge(c: Gojo, m: Message):
|
|
| 59 |
|
| 60 |
@Gojo.on_message(command("spurge") & admin_filter)
|
| 61 |
async def spurge(c: Gojo, m: Message):
|
| 62 |
-
chat_type = chattype(
|
| 63 |
-
if chat_type != "
|
| 64 |
await m.reply_text(text="Cannot purge messages in a basic group")
|
| 65 |
return
|
| 66 |
|
|
@@ -101,8 +101,8 @@ async def spurge(c: Gojo, m: Message):
|
|
| 101 |
group=9,
|
| 102 |
)
|
| 103 |
async def del_msg(c: Gojo, m: Message):
|
| 104 |
-
chat_type = chattype(
|
| 105 |
-
if chat_type != "
|
| 106 |
return
|
| 107 |
|
| 108 |
if m.reply_to_message:
|
|
|
|
| 11 |
|
| 12 |
@Gojo.on_message(command("purge") & admin_filter)
|
| 13 |
async def purge(c: Gojo, m: Message):
|
| 14 |
+
chat_type = chattype(m)
|
| 15 |
+
if chat_type != "supreme group":
|
| 16 |
await m.reply_text(text="Cannot purge messages in a basic group")
|
| 17 |
return
|
| 18 |
|
|
|
|
| 59 |
|
| 60 |
@Gojo.on_message(command("spurge") & admin_filter)
|
| 61 |
async def spurge(c: Gojo, m: Message):
|
| 62 |
+
chat_type = chattype(m)
|
| 63 |
+
if chat_type != "supreme group":
|
| 64 |
await m.reply_text(text="Cannot purge messages in a basic group")
|
| 65 |
return
|
| 66 |
|
|
|
|
| 101 |
group=9,
|
| 102 |
)
|
| 103 |
async def del_msg(c: Gojo, m: Message):
|
| 104 |
+
chat_type = chattype(m)
|
| 105 |
+
if chat_type != "supreme group":
|
| 106 |
return
|
| 107 |
|
| 108 |
if m.reply_to_message:
|
Powers/plugins/report.py
CHANGED
|
@@ -20,7 +20,7 @@ async def report_setting(_, m: Message):
|
|
| 20 |
args = m.text.split()
|
| 21 |
db = Reporting(m.chat.id)
|
| 22 |
|
| 23 |
-
chat_type = chattype(
|
| 24 |
if chat_type == "private":
|
| 25 |
if len(args) >= 2:
|
| 26 |
option = args[1].lower()
|
|
@@ -65,8 +65,8 @@ async def report_setting(_, m: Message):
|
|
| 65 |
|
| 66 |
@Gojo.on_message(command("report") & filters.group)
|
| 67 |
async def report_watcher(c: Gojo, m: Message):
|
| 68 |
-
chat_type = chattype(
|
| 69 |
-
if chat_type != "
|
| 70 |
return
|
| 71 |
|
| 72 |
if not m.from_user:
|
|
|
|
| 20 |
args = m.text.split()
|
| 21 |
db = Reporting(m.chat.id)
|
| 22 |
|
| 23 |
+
chat_type = chattype(m)
|
| 24 |
if chat_type == "private":
|
| 25 |
if len(args) >= 2:
|
| 26 |
option = args[1].lower()
|
|
|
|
| 65 |
|
| 66 |
@Gojo.on_message(command("report") & filters.group)
|
| 67 |
async def report_watcher(c: Gojo, m: Message):
|
| 68 |
+
chat_type = chattype(m)
|
| 69 |
+
if chat_type != "supreme group":
|
| 70 |
return
|
| 71 |
|
| 72 |
if not m.from_user:
|
Powers/plugins/utils.py
CHANGED
|
@@ -131,8 +131,8 @@ async def get_lyrics(_, m: Message):
|
|
| 131 |
)
|
| 132 |
async def id_info(c: Gojo, m: Message):
|
| 133 |
|
| 134 |
-
chat_type = chattype(
|
| 135 |
-
if chat_type == "
|
| 136 |
await m.reply_text(text=f"This Group's ID is <code>{m.chat.id}</code>")
|
| 137 |
return
|
| 138 |
|
|
|
|
| 131 |
)
|
| 132 |
async def id_info(c: Gojo, m: Message):
|
| 133 |
|
| 134 |
+
chat_type = chattype(m)
|
| 135 |
+
if chat_type == "supreme group" and not m.reply_to_message:
|
| 136 |
await m.reply_text(text=f"This Group's ID is <code>{m.chat.id}</code>")
|
| 137 |
return
|
| 138 |
|
Powers/utils/chat_type.py
CHANGED
|
@@ -3,7 +3,7 @@ from pyrogram.enums import ChatType
|
|
| 3 |
from pyrogram.types import Message
|
| 4 |
|
| 5 |
|
| 6 |
-
async def chattype(
|
| 7 |
if bool(m.chat and m.chat.type in {ChatType.CHANNEL}):
|
| 8 |
ct = "channel"
|
| 9 |
|
|
@@ -16,6 +16,9 @@ async def chattype(_, m: Message):
|
|
| 16 |
if bool(m.chat and m.chat.type in {ChatType.SUPERGROUP}):
|
| 17 |
ct = "supergroup"
|
| 18 |
|
|
|
|
|
|
|
|
|
|
| 19 |
if bool(m.chat and m.chat.type in {ChatType.BOT}):
|
| 20 |
ct ="bot"
|
| 21 |
|
|
|
|
| 3 |
from pyrogram.types import Message
|
| 4 |
|
| 5 |
|
| 6 |
+
async def chattype(m: Message):
|
| 7 |
if bool(m.chat and m.chat.type in {ChatType.CHANNEL}):
|
| 8 |
ct = "channel"
|
| 9 |
|
|
|
|
| 16 |
if bool(m.chat and m.chat.type in {ChatType.SUPERGROUP}):
|
| 17 |
ct = "supergroup"
|
| 18 |
|
| 19 |
+
if bool(m.chat and m.chat.type in {ChatType.SUPERGROUP}) and bool(m.chat and m.chat.type in {ChatType.GROUP}):
|
| 20 |
+
ct = "supreme group"
|
| 21 |
+
|
| 22 |
if bool(m.chat and m.chat.type in {ChatType.BOT}):
|
| 23 |
ct ="bot"
|
| 24 |
|
Powers/utils/custom_filters.py
CHANGED
|
@@ -118,8 +118,8 @@ async def bot_admin_check_func(_, __, m: Message or CallbackQuery):
|
|
| 118 |
if isinstance(m, CallbackQuery):
|
| 119 |
m = m.message
|
| 120 |
|
| 121 |
-
chat_type = chattype(
|
| 122 |
-
if chat_type != "
|
| 123 |
return False
|
| 124 |
|
| 125 |
# Telegram and GroupAnonyamousBot
|
|
@@ -152,8 +152,8 @@ async def admin_check_func(_, __, m: Message or CallbackQuery):
|
|
| 152 |
if isinstance(m, CallbackQuery):
|
| 153 |
m = m.message
|
| 154 |
|
| 155 |
-
chat_type = chattype(
|
| 156 |
-
if chat_type != "
|
| 157 |
return False
|
| 158 |
|
| 159 |
# Telegram and GroupAnonyamousBot
|
|
@@ -215,8 +215,8 @@ async def restrict_check_func(_, __, m: Message or CallbackQuery):
|
|
| 215 |
if isinstance(m, CallbackQuery):
|
| 216 |
m = m.message
|
| 217 |
|
| 218 |
-
chat_type = chattype(
|
| 219 |
-
if chat_type != "
|
| 220 |
return False
|
| 221 |
|
| 222 |
# Bypass the bot devs, sudos and owner
|
|
@@ -262,8 +262,8 @@ async def changeinfo_check_func(_, __, m):
|
|
| 262 |
if isinstance(m, CallbackQuery):
|
| 263 |
m = m.message
|
| 264 |
|
| 265 |
-
chat_type = chattype(
|
| 266 |
-
if chat_type != "
|
| 267 |
await m.reply_text("This command is made to be used in groups not in pm!")
|
| 268 |
return False
|
| 269 |
|
|
|
|
| 118 |
if isinstance(m, CallbackQuery):
|
| 119 |
m = m.message
|
| 120 |
|
| 121 |
+
chat_type = chattype(m)
|
| 122 |
+
if chat_type != "supreme group":
|
| 123 |
return False
|
| 124 |
|
| 125 |
# Telegram and GroupAnonyamousBot
|
|
|
|
| 152 |
if isinstance(m, CallbackQuery):
|
| 153 |
m = m.message
|
| 154 |
|
| 155 |
+
chat_type = chattype(m)
|
| 156 |
+
if chat_type != "supreme group":
|
| 157 |
return False
|
| 158 |
|
| 159 |
# Telegram and GroupAnonyamousBot
|
|
|
|
| 215 |
if isinstance(m, CallbackQuery):
|
| 216 |
m = m.message
|
| 217 |
|
| 218 |
+
chat_type = chattype(m)
|
| 219 |
+
if chat_type != "supreme group":
|
| 220 |
return False
|
| 221 |
|
| 222 |
# Bypass the bot devs, sudos and owner
|
|
|
|
| 262 |
if isinstance(m, CallbackQuery):
|
| 263 |
m = m.message
|
| 264 |
|
| 265 |
+
chat_type = chattype(m)
|
| 266 |
+
if chat_type != "supreme group":
|
| 267 |
await m.reply_text("This command is made to be used in groups not in pm!")
|
| 268 |
return False
|
| 269 |
|
Powers/utils/string.py
CHANGED
|
@@ -124,7 +124,7 @@ async def escape_mentions_using_curly_brackets(
|
|
| 124 |
) -> str:
|
| 125 |
teks = await escape_invalid_curly_brackets(text, parse_words)
|
| 126 |
if teks:
|
| 127 |
-
chat_type = chattype(
|
| 128 |
teks = teks.format(
|
| 129 |
first=escape(m.from_user.first_name),
|
| 130 |
last=escape(m.from_user.last_name or m.from_user.first_name),
|
|
@@ -143,7 +143,7 @@ async def escape_mentions_using_curly_brackets(
|
|
| 143 |
else [escape(m.from_user.first_name)],
|
| 144 |
),
|
| 145 |
chatname=escape(m.chat.title)
|
| 146 |
-
if chat_type != "
|
| 147 |
else escape(m.from_user.first_name),
|
| 148 |
id=m.from_user.id,
|
| 149 |
)
|
|
|
|
| 124 |
) -> str:
|
| 125 |
teks = await escape_invalid_curly_brackets(text, parse_words)
|
| 126 |
if teks:
|
| 127 |
+
chat_type = chattype(m)
|
| 128 |
teks = teks.format(
|
| 129 |
first=escape(m.from_user.first_name),
|
| 130 |
last=escape(m.from_user.last_name or m.from_user.first_name),
|
|
|
|
| 143 |
else [escape(m.from_user.first_name)],
|
| 144 |
),
|
| 145 |
chatname=escape(m.chat.title)
|
| 146 |
+
if chat_type != "supreme group"
|
| 147 |
else escape(m.from_user.first_name),
|
| 148 |
id=m.from_user.id,
|
| 149 |
)
|