iamgojoof6eyes commited on
Commit
8f3b78a
·
1 Parent(s): eccddc1

Looks good

Browse files
Powers/plugins/admin.py CHANGED
@@ -36,7 +36,7 @@ from Powers.vars import Config
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
  )
@@ -123,7 +123,7 @@ async def zombie_clean(c: Gojo, m: Message):
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
  )
 
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!",
42
  )
 
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!",
129
  )
Powers/plugins/info.py CHANGED
@@ -8,6 +8,7 @@ from Powers import DEV_USERS, SUDO_USERS, WHITELIST_USERS, SUPPORT_STAFF, LOGGER
8
  from Powers.bot_class import Gojo
9
  from Powers.utils.custom_filters import command
10
  from Powers.utils.extract_user import extract_user
 
11
 
12
 
13
  escape = "\n"
@@ -104,7 +105,7 @@ async def chat_info(chat, already=False):
104
  chat_id = chat.id
105
  username = chat.username
106
  title = chat.title
107
- type_ = chat.type
108
  is_scam = chat.is_scam
109
  is_fake = chat.is_fake
110
  description = chat.description
 
8
  from Powers.bot_class import Gojo
9
  from Powers.utils.custom_filters import command
10
  from Powers.utils.extract_user import extract_user
11
+ from Powers.utils.chat_type import c_type
12
 
13
 
14
  escape = "\n"
 
105
  chat_id = chat.id
106
  username = chat.username
107
  title = chat.title
108
+ type_ = c_type(chat)
109
  is_scam = chat.is_scam
110
  is_fake = chat.is_fake
111
  description = chat.description
Powers/plugins/purge.py CHANGED
@@ -12,7 +12,7 @@ from Powers.utils.custom_filters import admin_filter, command
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
 
@@ -60,7 +60,7 @@ async def purge(c: Gojo, m: Message):
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
 
@@ -102,7 +102,7 @@ async def spurge(c: Gojo, m: Message):
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:
 
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
18
 
 
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
66
 
 
102
  )
103
  async def del_msg(c: Gojo, m: Message):
104
  chat_type = chattype(m)
105
+ if chat_type != "supergroup":
106
  return
107
 
108
  if m.reply_to_message:
Powers/plugins/report.py CHANGED
@@ -66,7 +66,7 @@ async def report_setting(_, m: Message):
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:
 
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
 
72
  if not m.from_user:
Powers/plugins/utils.py CHANGED
@@ -132,7 +132,7 @@ async def get_lyrics(_, m: Message):
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
 
 
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
138
 
Powers/utils/chat_type.py CHANGED
@@ -1,8 +1,10 @@
1
- import enum
 
2
  from pyrogram.enums import ChatType
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"
@@ -10,17 +12,32 @@ async def chattype(m: Message):
10
  if bool(m.chat and m.chat.type in {ChatType.PRIVATE}):
11
  ct = "private"
12
 
13
- if bool(m.chat and m.chat.type in {ChatType.GROUP}):
14
- ct = "group"
15
-
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
 
25
 
26
  return ct
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from Powers.bot_class import Gojo
2
+
3
  from pyrogram.enums import ChatType
4
  from pyrogram.types import Message
5
 
6
 
7
+
8
  async def chattype(m: Message):
9
  if bool(m.chat and m.chat.type in {ChatType.CHANNEL}):
10
  ct = "channel"
 
12
  if bool(m.chat and m.chat.type in {ChatType.PRIVATE}):
13
  ct = "private"
14
 
15
+ if bool(m.chat and m.chat.type in {ChatType.SUPERGROUP}) or bool(m.chat and m.chat.type in {ChatType.GROUP}):
 
 
 
16
  ct = "supergroup"
17
 
 
 
 
18
  if bool(m.chat and m.chat.type in {ChatType.BOT}):
19
  ct ="bot"
20
 
21
 
22
  return ct
23
+
24
+ async def c_type(chat_id):
25
+ c = Gojo.get_chat(chat_id)
26
+ mem = Gojo.get_chat_members_count(chat_id)
27
+
28
+ if c.type == ChatType.BOT:
29
+ ct = "bot"
30
+
31
+ if c.type == ChatType.CHANNEL:
32
+ ct = "channel"
33
+
34
+ if c.type == ChatType.GROUP:
35
+ ct = "group"
36
+
37
+ if c.type == ChatType.SUPERGROUP:
38
+ ct = "supergroup"
39
+
40
+ if c.type == ChatType.PRIVATE:
41
+ ct = "private"
42
+
43
+ return ct
Powers/utils/custom_filters.py CHANGED
@@ -119,7 +119,7 @@ async def bot_admin_check_func(_, __, m: Message or 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
@@ -153,7 +153,7 @@ async def admin_check_func(_, __, m: Message or 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
@@ -216,7 +216,7 @@ async def restrict_check_func(_, __, m: Message or 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
@@ -263,7 +263,7 @@ async def changeinfo_check_func(_, __, m):
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
 
 
119
  m = m.message
120
 
121
  chat_type = chattype(m)
122
+ if chat_type != "supergroup":
123
  return False
124
 
125
  # Telegram and GroupAnonyamousBot
 
153
  m = m.message
154
 
155
  chat_type = chattype(m)
156
+ if chat_type != "supergroup":
157
  return False
158
 
159
  # Telegram and GroupAnonyamousBot
 
216
  m = m.message
217
 
218
  chat_type = chattype(m)
219
+ if chat_type != "supergroup":
220
  return False
221
 
222
  # Bypass the bot devs, sudos and owner
 
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
269
 
Powers/utils/string.py CHANGED
@@ -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 != "supreme group"
147
  else escape(m.from_user.first_name),
148
  id=m.from_user.id,
149
  )
 
143
  else [escape(m.from_user.first_name)],
144
  ),
145
  chatname=escape(m.chat.title)
146
+ if chat_type != "supergroup"
147
  else escape(m.from_user.first_name),
148
  id=m.from_user.id,
149
  )