Spaces:
Paused
Paused
iamgojoof6eyes
commited on
Commit
·
029db6d
1
Parent(s):
2697fb5
OwO
Browse files- Powers/plugins/admin.py +2 -2
- Powers/plugins/greetings.py +1 -1
- Powers/plugins/purge.py +3 -3
- Powers/plugins/report.py +2 -2
- Powers/plugins/start.py +3 -3
- Powers/plugins/utils.py +1 -1
- Powers/utils/custom_filters.py +4 -4
- Powers/utils/string.py +1 -1
Powers/plugins/admin.py
CHANGED
|
@@ -35,7 +35,7 @@ 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(m)
|
| 39 |
if chat_type != "supergroup":
|
| 40 |
return await m.reply_text(
|
| 41 |
text="This command is made to be used in groups only!",
|
|
@@ -122,7 +122,7 @@ 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(m)
|
| 126 |
if chat_type != "supergroup":
|
| 127 |
return await m.reply_text(
|
| 128 |
"This command is made to be used in groups only!",
|
|
|
|
| 35 |
@Gojo.on_message(command("adminlist"))
|
| 36 |
async def adminlist_show(_, m: Message):
|
| 37 |
global ADMIN_CACHE
|
| 38 |
+
chat_type = await chattype(m)
|
| 39 |
if chat_type != "supergroup":
|
| 40 |
return await m.reply_text(
|
| 41 |
text="This command is made to be used in groups only!",
|
|
|
|
| 122 |
@Gojo.on_message(command("admincache"))
|
| 123 |
async def reload_admins(_, m: Message):
|
| 124 |
global TEMP_ADMIN_CACHE_BLOCK
|
| 125 |
+
chat_type = await chattype(m)
|
| 126 |
if chat_type != "supergroup":
|
| 127 |
return await m.reply_text(
|
| 128 |
"This command is made to be used in groups only!",
|
Powers/plugins/greetings.py
CHANGED
|
@@ -36,7 +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 |
-
chat_type = chattype(m)
|
| 40 |
teks = teks.format(
|
| 41 |
first=escape(user.first_name),
|
| 42 |
last=escape(user.last_name or user.first_name),
|
|
|
|
| 36 |
else:
|
| 37 |
user = m.old_chat_member.user if m.old_chat_member else m.from_user
|
| 38 |
if teks:
|
| 39 |
+
chat_type = await chattype(m)
|
| 40 |
teks = teks.format(
|
| 41 |
first=escape(user.first_name),
|
| 42 |
last=escape(user.last_name or user.first_name),
|
Powers/plugins/purge.py
CHANGED
|
@@ -11,7 +11,7 @@ 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(m)
|
| 15 |
if chat_type != "supergroup":
|
| 16 |
await m.reply_text(text="Cannot purge messages in a basic group")
|
| 17 |
return
|
|
@@ -59,7 +59,7 @@ 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(m)
|
| 63 |
if chat_type != "supergroup":
|
| 64 |
await m.reply_text(text="Cannot purge messages in a basic group")
|
| 65 |
return
|
|
@@ -101,7 +101,7 @@ async def spurge(c: Gojo, m: Message):
|
|
| 101 |
group=9,
|
| 102 |
)
|
| 103 |
async def del_msg(c: Gojo, m: Message):
|
| 104 |
-
chat_type = chattype(m)
|
| 105 |
if chat_type != "supergroup":
|
| 106 |
return
|
| 107 |
|
|
|
|
| 11 |
|
| 12 |
@Gojo.on_message(command("purge") & admin_filter)
|
| 13 |
async def purge(c: Gojo, m: Message):
|
| 14 |
+
chat_type = await chattype(m)
|
| 15 |
if chat_type != "supergroup":
|
| 16 |
await m.reply_text(text="Cannot purge messages in a basic group")
|
| 17 |
return
|
|
|
|
| 59 |
|
| 60 |
@Gojo.on_message(command("spurge") & admin_filter)
|
| 61 |
async def spurge(c: Gojo, m: Message):
|
| 62 |
+
chat_type = await chattype(m)
|
| 63 |
if chat_type != "supergroup":
|
| 64 |
await m.reply_text(text="Cannot purge messages in a basic group")
|
| 65 |
return
|
|
|
|
| 101 |
group=9,
|
| 102 |
)
|
| 103 |
async def del_msg(c: Gojo, m: Message):
|
| 104 |
+
chat_type = await chattype(m)
|
| 105 |
if chat_type != "supergroup":
|
| 106 |
return
|
| 107 |
|
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(m)
|
| 24 |
if chat_type == "private":
|
| 25 |
if len(args) >= 2:
|
| 26 |
option = args[1].lower()
|
|
@@ -65,7 +65,7 @@ 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(m)
|
| 69 |
if chat_type != "supergroup":
|
| 70 |
return
|
| 71 |
|
|
|
|
| 20 |
args = m.text.split()
|
| 21 |
db = Reporting(m.chat.id)
|
| 22 |
|
| 23 |
+
chat_type = await 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 = await chattype(m)
|
| 69 |
if chat_type != "supergroup":
|
| 70 |
return
|
| 71 |
|
Powers/plugins/start.py
CHANGED
|
@@ -67,7 +67,7 @@ async def close_admin_callback(_, q: CallbackQuery):
|
|
| 67 |
command("start") & (filters.group | filters.private),
|
| 68 |
)
|
| 69 |
async def start(c: Gojo, m: Message):
|
| 70 |
-
chat_type = await chattype(m)
|
| 71 |
if chat_type == "private":
|
| 72 |
if len(m.text.split()) > 1:
|
| 73 |
help_option = (m.text.split(None, 1)[1]).lower()
|
|
@@ -187,7 +187,7 @@ async def help_menu(_, m: Message):
|
|
| 187 |
LOGGER.info(
|
| 188 |
f"{m.from_user.id} fetched help for '{help_option}' text in {m.chat.id}",
|
| 189 |
)
|
| 190 |
-
chat_type = chattype(m)
|
| 191 |
if chat_type == "private":
|
| 192 |
await m.reply_photo(
|
| 193 |
photo=StartPic,
|
|
@@ -214,7 +214,7 @@ async def help_menu(_, m: Message):
|
|
| 214 |
),
|
| 215 |
)
|
| 216 |
else:
|
| 217 |
-
chat_type = chattype(m)
|
| 218 |
if chat_type == "privaate":
|
| 219 |
keyboard = ikb(
|
| 220 |
[
|
|
|
|
| 67 |
command("start") & (filters.group | filters.private),
|
| 68 |
)
|
| 69 |
async def start(c: Gojo, m: Message):
|
| 70 |
+
chat_type = await await chattype(m)
|
| 71 |
if chat_type == "private":
|
| 72 |
if len(m.text.split()) > 1:
|
| 73 |
help_option = (m.text.split(None, 1)[1]).lower()
|
|
|
|
| 187 |
LOGGER.info(
|
| 188 |
f"{m.from_user.id} fetched help for '{help_option}' text in {m.chat.id}",
|
| 189 |
)
|
| 190 |
+
chat_type = await chattype(m)
|
| 191 |
if chat_type == "private":
|
| 192 |
await m.reply_photo(
|
| 193 |
photo=StartPic,
|
|
|
|
| 214 |
),
|
| 215 |
)
|
| 216 |
else:
|
| 217 |
+
chat_type = await chattype(m)
|
| 218 |
if chat_type == "privaate":
|
| 219 |
keyboard = ikb(
|
| 220 |
[
|
Powers/plugins/utils.py
CHANGED
|
@@ -131,7 +131,7 @@ async def get_lyrics(_, m: Message):
|
|
| 131 |
)
|
| 132 |
async def id_info(c: Gojo, m: Message):
|
| 133 |
|
| 134 |
-
chat_type = chattype(m)
|
| 135 |
if chat_type == "supergroup" 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
|
|
|
|
| 131 |
)
|
| 132 |
async def id_info(c: Gojo, m: Message):
|
| 133 |
|
| 134 |
+
chat_type = await chattype(m)
|
| 135 |
if chat_type == "supergroup" 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
|
Powers/utils/custom_filters.py
CHANGED
|
@@ -118,7 +118,7 @@ async def bot_admin_check_func(_, __, m: Message or CallbackQuery):
|
|
| 118 |
if isinstance(m, CallbackQuery):
|
| 119 |
m = m.message
|
| 120 |
|
| 121 |
-
chat_type = chattype(m)
|
| 122 |
if chat_type != "supergroup":
|
| 123 |
return False
|
| 124 |
|
|
@@ -152,7 +152,7 @@ async def admin_check_func(_, __, m: Message or CallbackQuery):
|
|
| 152 |
if isinstance(m, CallbackQuery):
|
| 153 |
m = m.message
|
| 154 |
|
| 155 |
-
chat_type = chattype(m)
|
| 156 |
if chat_type != "supergroup":
|
| 157 |
return False
|
| 158 |
|
|
@@ -215,7 +215,7 @@ async def restrict_check_func(_, __, m: Message or CallbackQuery):
|
|
| 215 |
if isinstance(m, CallbackQuery):
|
| 216 |
m = m.message
|
| 217 |
|
| 218 |
-
chat_type = chattype(m)
|
| 219 |
if chat_type != "supergroup":
|
| 220 |
return False
|
| 221 |
|
|
@@ -262,7 +262,7 @@ async def changeinfo_check_func(_, __, m):
|
|
| 262 |
if isinstance(m, CallbackQuery):
|
| 263 |
m = m.message
|
| 264 |
|
| 265 |
-
chat_type = chattype(m)
|
| 266 |
if chat_type != "supergroup":
|
| 267 |
await m.reply_text("This command is made to be used in groups not in pm!")
|
| 268 |
return False
|
|
|
|
| 118 |
if isinstance(m, CallbackQuery):
|
| 119 |
m = m.message
|
| 120 |
|
| 121 |
+
chat_type = await chattype(m)
|
| 122 |
if chat_type != "supergroup":
|
| 123 |
return False
|
| 124 |
|
|
|
|
| 152 |
if isinstance(m, CallbackQuery):
|
| 153 |
m = m.message
|
| 154 |
|
| 155 |
+
chat_type = await chattype(m)
|
| 156 |
if chat_type != "supergroup":
|
| 157 |
return False
|
| 158 |
|
|
|
|
| 215 |
if isinstance(m, CallbackQuery):
|
| 216 |
m = m.message
|
| 217 |
|
| 218 |
+
chat_type = await chattype(m)
|
| 219 |
if chat_type != "supergroup":
|
| 220 |
return False
|
| 221 |
|
|
|
|
| 262 |
if isinstance(m, CallbackQuery):
|
| 263 |
m = m.message
|
| 264 |
|
| 265 |
+
chat_type = await chattype(m)
|
| 266 |
if chat_type != "supergroup":
|
| 267 |
await m.reply_text("This command is made to be used in groups not in pm!")
|
| 268 |
return False
|
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(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),
|
|
|
|
| 124 |
) -> str:
|
| 125 |
teks = await escape_invalid_curly_brackets(text, parse_words)
|
| 126 |
if teks:
|
| 127 |
+
chat_type = await 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),
|