Captain Ezio commited on
Commit
cd78ac1
·
1 Parent(s): b215a1f

Update custom_filters.py

Browse files
Files changed (1) hide show
  1. Powers/utils/custom_filters.py +7 -11
Powers/utils/custom_filters.py CHANGED
@@ -184,9 +184,7 @@ async def owner_check_func(_, __, m: Message or CallbackQuery):
184
  if isinstance(m, CallbackQuery):
185
  m = m.message
186
 
187
- if (
188
- m.chat and m.chat.type == ChatType.SUPERGROUP
189
- ) and m.chat.id != -1001586309125: # testing chat of the bot
190
  return False
191
 
192
  # Bypass the bot devs, sudos and owner
@@ -238,9 +236,7 @@ async def promote_check_func(_, __, m):
238
  if isinstance(m, CallbackQuery):
239
  m = m.message
240
 
241
- if (
242
- m.chat and m.chat.type == ChatType.SUPERGROUP
243
- ) and m.chat.id != -1001586309125: # testing chat of the bot
244
  return False
245
 
246
  # Bypass the bot devs, sudos and owner
@@ -249,7 +245,7 @@ async def promote_check_func(_, __, m):
249
 
250
  user = await m.chat.get_member(m.from_user.id)
251
 
252
- if user.can_promote_members or user.status == CMS.OWNER:
253
  status = True
254
  else:
255
  status = False
@@ -263,7 +259,7 @@ async def changeinfo_check_func(_, __, m):
263
  if isinstance(m, CallbackQuery):
264
  m = m.message
265
 
266
- if m.chat.type == ChatType.PRIVATE:
267
  await m.reply_text("This command is made to be used in groups not in pm!")
268
  return False
269
 
@@ -277,7 +273,7 @@ async def changeinfo_check_func(_, __, m):
277
 
278
  user = await m.chat.get_member(m.from_user.id)
279
 
280
- if user.can_change_info or user.status == CMS.OWNER:
281
  status = True
282
  else:
283
  status = False
@@ -291,7 +287,7 @@ async def can_pin_message_func(_, __, m):
291
  if isinstance(m, CallbackQuery):
292
  m = m.message
293
 
294
- if m.chat.type == ChatType.PRIVATE:
295
  await m.reply_text("This command is made to be used in groups not in pm!")
296
  return False
297
 
@@ -305,7 +301,7 @@ async def can_pin_message_func(_, __, m):
305
 
306
  user = await m.chat.get_member(m.from_user.id)
307
 
308
- if user.can_pin_messages or user.status == CMS.OWNER:
309
  status = True
310
  else:
311
  status = False
 
184
  if isinstance(m, CallbackQuery):
185
  m = m.message
186
 
187
+ if (m.chat.type != ChatType.SUPERGROUP) and m.chat.id != -1001586309125: # testing chat of the bot
 
 
188
  return False
189
 
190
  # Bypass the bot devs, sudos and owner
 
236
  if isinstance(m, CallbackQuery):
237
  m = m.message
238
 
239
+ if (m.chat.type != ChatType.SUPERGROUP) and m.chat.id != -1001586309125: # testing chat of the bot
 
 
240
  return False
241
 
242
  # Bypass the bot devs, sudos and owner
 
245
 
246
  user = await m.chat.get_member(m.from_user.id)
247
 
248
+ if user.privileges.can_promote_members or user.status == CMS.OWNER:
249
  status = True
250
  else:
251
  status = False
 
259
  if isinstance(m, CallbackQuery):
260
  m = m.message
261
 
262
+ if m.chat.type != ChatType.SUPERGROUP:
263
  await m.reply_text("This command is made to be used in groups not in pm!")
264
  return False
265
 
 
273
 
274
  user = await m.chat.get_member(m.from_user.id)
275
 
276
+ if user.privileges.can_change_info or user.status == CMS.OWNER:
277
  status = True
278
  else:
279
  status = False
 
287
  if isinstance(m, CallbackQuery):
288
  m = m.message
289
 
290
+ if m.chat.type != ChatType.SUPERGROUP:
291
  await m.reply_text("This command is made to be used in groups not in pm!")
292
  return False
293
 
 
301
 
302
  user = await m.chat.get_member(m.from_user.id)
303
 
304
+ if user.privileges.can_pin_messages or user.status == CMS.OWNER:
305
  status = True
306
  else:
307
  status = False