Captain Ezio commited on
Commit
56e6de1
·
1 Parent(s): d7d7f4e

without test....

Browse files
Powers/plugins/admin.py CHANGED
@@ -73,14 +73,14 @@ async def adminlist_show(_, m: Message):
73
  else:
74
  ef = str(ef) + f"{admin_list}\n"
75
  await m.reply_text(
76
- text=f"Some error occured, report to @{SUPPORT_GROUP} \n <b>Error:</b> <code>{ef}</code>"
77
  )
78
  LOGGER.error(ef)
79
  LOGGER.error(format_exc())
80
  return
81
 
82
 
83
- @Gojo.on_message(command("zombies") & owner_filter)
84
  async def zombie_clean(c: Gojo, m: Message):
85
  zombie = 0
86
  wait = await m.reply_text("Searching ... and banning ...")
@@ -121,7 +121,7 @@ async def reload_admins(_, m: Message):
121
  LOGGER.info(f"Admincache cmd use in {m.chat.id} by {m.from_user.id}")
122
  except RPCError as ef:
123
  await m.reply_text(
124
- text=f"Some error occured, report to @{SUPPORT_GROUP} \n <b>Error:</b> <code>{ef}</code>"
125
  )
126
  LOGGER.error(ef)
127
  LOGGER.error(format_exc())
@@ -238,7 +238,7 @@ async def fullpromote_usr(c: Gojo, m: Message):
238
  )
239
  except RPCError as e:
240
  await m.reply_text(
241
- text=f"Some error occured, report to @{SUPPORT_GROUP} \n <b>Error:</b> <code>{e}</code>"
242
  )
243
  LOGGER.error(e)
244
  LOGGER.error(format_exc())
@@ -339,7 +339,7 @@ async def promote_usr(c: Gojo, m: Message):
339
  )
340
  except RPCError as e:
341
  await m.reply_text(
342
- text=f"Some error occured, report to @{SUPPORT_GROUP} \n <b>Error:</b> <code>{e}</code>"
343
  )
344
  LOGGER.error(e)
345
  LOGGER.error(format_exc())
@@ -407,7 +407,7 @@ async def demote_usr(c: Gojo, m: Message):
407
  )
408
  except RPCError as ef:
409
  await m.reply_text(
410
- f"Some error occured, report to @{SUPPORT_GROUP} \n <b>Error:</b> <code>{ef}</code>"
411
  )
412
  LOGGER.error(ef)
413
  LOGGER.error(format_exc())
@@ -437,7 +437,7 @@ async def get_invitelink(c: Gojo, m: Message):
437
  await m.reply_text(text="You don't have permissions to invite users.")
438
  except RPCError as ef:
439
  await m.reply_text(
440
- text=f"Some error occured, report to @{SUPPORT_GROUP} \n <b>Error:</b> <code>{ef}</code>"
441
  )
442
  LOGGER.error(ef)
443
  LOGGER.error(format_exc())
 
73
  else:
74
  ef = str(ef) + f"{admin_list}\n"
75
  await m.reply_text(
76
+ text=f"Some error occured, report it using `/bug` \n <b>Error:</b> <code>{ef}</code>"
77
  )
78
  LOGGER.error(ef)
79
  LOGGER.error(format_exc())
80
  return
81
 
82
 
83
+ @Gojo.on_message(command("zombies") & admin_filter)
84
  async def zombie_clean(c: Gojo, m: Message):
85
  zombie = 0
86
  wait = await m.reply_text("Searching ... and banning ...")
 
121
  LOGGER.info(f"Admincache cmd use in {m.chat.id} by {m.from_user.id}")
122
  except RPCError as ef:
123
  await m.reply_text(
124
+ text=f"Some error occured, report it using `/bug` \n <b>Error:</b> <code>{ef}</code>"
125
  )
126
  LOGGER.error(ef)
127
  LOGGER.error(format_exc())
 
238
  )
239
  except RPCError as e:
240
  await m.reply_text(
241
+ text=f"Some error occured, report it using `/bug` \n <b>Error:</b> <code>{e}</code>"
242
  )
243
  LOGGER.error(e)
244
  LOGGER.error(format_exc())
 
339
  )
340
  except RPCError as e:
341
  await m.reply_text(
342
+ text=f"Some error occured, report it using `/bug` \n <b>Error:</b> <code>{e}</code>"
343
  )
344
  LOGGER.error(e)
345
  LOGGER.error(format_exc())
 
407
  )
408
  except RPCError as ef:
409
  await m.reply_text(
410
+ f"Some error occured, report it using `/bug` \n <b>Error:</b> <code>{ef}</code>"
411
  )
412
  LOGGER.error(ef)
413
  LOGGER.error(format_exc())
 
437
  await m.reply_text(text="You don't have permissions to invite users.")
438
  except RPCError as ef:
439
  await m.reply_text(
440
+ text=f"Some error occured, report it using `/bug` \n <b>Error:</b> <code>{ef}</code>"
441
  )
442
  LOGGER.error(ef)
443
  LOGGER.error(format_exc())
Powers/plugins/bans.py CHANGED
@@ -3,13 +3,13 @@ from traceback import format_exc
3
 
4
  from pyrogram import enums
5
  from pyrogram.errors import (ChatAdminRequired, PeerIdInvalid, RightForbidden,
6
- RPCError, UserAdminInvalid)
7
  from pyrogram.filters import regex
8
  from pyrogram.types import (CallbackQuery, ChatPrivileges,
9
  InlineKeyboardButton, InlineKeyboardMarkup,
10
  Message)
11
 
12
- from Powers import LOGGER, OWNER_ID, SUPPORT_GROUP, SUPPORT_STAFF
13
  from Powers.bot_class import Gojo
14
  from Powers.utils.caching import ADMIN_CACHE, admin_cache_reload
15
  from Powers.utils.custom_filters import command, restrict_filter
@@ -95,6 +95,8 @@ async def tban_usr(c: Gojo, m: Message):
95
  txt += f"\n<b>Reason</b>: {reason}"
96
  else:
97
  txt += "\n<b>Reason</b>: Not Specified"
 
 
98
  keyboard = InlineKeyboardMarkup(
99
  [
100
  [
@@ -105,13 +107,24 @@ async def tban_usr(c: Gojo, m: Message):
105
  ],
106
  ],
107
  )
108
- await m.reply_animation(
109
- reply_to_message_id=r_id,
110
- animation=str(choice(BAN_GIFS)),
111
- caption=txt,
112
- reply_markup=keyboard,
113
- parse_mode=enums.ParseMode.HTML,
114
- )
 
 
 
 
 
 
 
 
 
 
 
115
  # await m.reply_text(txt, reply_markup=keyboard,
116
  # reply_to_message_id=r_id)
117
  except ChatAdminRequired:
@@ -129,7 +142,7 @@ async def tban_usr(c: Gojo, m: Message):
129
  except RPCError as ef:
130
  await m.reply_text(
131
  (
132
- f"""Some error occured, report to @{SUPPORT_GROUP}
133
 
134
  <b>Error:</b> <code>{ef}</code>"""
135
  )
@@ -218,7 +231,7 @@ async def stban_usr(c: Gojo, m: Message):
218
  await m.reply_text(text="I don't have enough rights to ban this user.")
219
  except RPCError as ef:
220
  await m.reply_text(
221
- text=f"""Some error occured, report to @{SUPPORT_GROUP}
222
 
223
  <b>Error:</b> <code>{ef}</code>"""
224
  )
@@ -298,6 +311,9 @@ async def dtban_usr(c: Gojo, m: Message):
298
  txt += f"\n<b>Reason</b>: {reason}"
299
  else:
300
  txt += "\n<b>Reason</b>: Not Specified"
 
 
 
301
  keyboard = InlineKeyboardMarkup(
302
  [
303
  [
@@ -308,13 +324,22 @@ async def dtban_usr(c: Gojo, m: Message):
308
  ],
309
  ],
310
  )
311
- await c.send_animation(
312
- chat_id=m.chat.id,
313
- animation=str(choice(BAN_GIFS)),
314
- caption=txt,
315
- reply_markup=keyboard,
316
- parse_mode=enums.ParseMode.HTML,
317
- )
 
 
 
 
 
 
 
 
 
318
  # await c.send_message(m.chat.id, txt, reply_markup=keyboard)
319
  except ChatAdminRequired:
320
  await m.reply_text(text="I'm not admin or I don't have rights.")
@@ -330,7 +355,7 @@ async def dtban_usr(c: Gojo, m: Message):
330
  await m.reply_text(text="I don't have enough rights to ban this user.")
331
  except RPCError as ef:
332
  await m.reply_text(
333
- text=f"""Some error occured, report to @{SUPPORT_GROUP}
334
 
335
  <b>Error:</b> <code>{ef}</code>"""
336
  )
@@ -398,12 +423,21 @@ async def kick_usr(c: Gojo, m: Message):
398
  else:
399
  txt += "\n<b>Reason</b>: Not Specified"
400
  # await m.reply_text(txt, reply_to_message_id=r_id)
401
- await m.reply_animation(
402
- reply_to_message_id=r_id,
403
- animation=str(choice(KICK_GIFS)),
404
- caption=txt,
405
- parse_mode=enums.ParseMode.HTML,
406
- )
 
 
 
 
 
 
 
 
 
407
  await m.chat.unban_member(user_id)
408
  except ChatAdminRequired:
409
  await m.reply_text(text="I'm not admin or I don't have rights.")
@@ -419,7 +453,7 @@ async def kick_usr(c: Gojo, m: Message):
419
  await m.reply_text(text="I don't have enough rights to ban this user.")
420
  except RPCError as ef:
421
  await m.reply_text(
422
- text=f"""Some error occured, report to @{SUPPORT_GROUP}
423
 
424
  <b>Error:</b> <code>{ef}</code>"""
425
  )
@@ -487,7 +521,7 @@ async def skick_usr(c: Gojo, m: Message):
487
  await m.reply_text(text="I don't have enough rights to kick this user.")
488
  except RPCError as ef:
489
  await m.reply_text(
490
- text=f"""Some error occured, report to @{SUPPORT_GROUP}
491
 
492
  <b>Error:</b> <code>{ef}</code>"""
493
  )
@@ -548,13 +582,19 @@ async def dkick_usr(c: Gojo, m: Message):
548
  txt += f"\n<b>Reason</b>: {reason}"
549
  else:
550
  txt += "\n<b>Reason</b>: Not Specified"
551
- await c.send_message(m.chat.id, txt)
552
- await c.send_animation(
553
- chat_id=m.chat.id,
554
- animation=str(choice(KICK_GIFS)),
555
- caption=txt,
556
- parse_mode=enums.ParseMode.HTML,
557
- )
 
 
 
 
 
 
558
  await m.chat.unban_member(user_id)
559
  except ChatAdminRequired:
560
  await m.reply_text(text="I'm not admin or I don't have rights.")
@@ -570,7 +610,7 @@ async def dkick_usr(c: Gojo, m: Message):
570
  await m.reply_text(text="I don't have enough rights to kick this user.")
571
  except RPCError as ef:
572
  await m.reply_text(
573
- text=f"""Some error occured, report to @{SUPPORT_GROUP}
574
 
575
  <b>Error:</b> <code>{ef}</code>"""
576
  )
@@ -629,7 +669,7 @@ async def unban_usr(c: Gojo, m: Message):
629
  await m.reply_text(text="I don't have enough rights to unban this user.")
630
  except RPCError as ef:
631
  await m.reply_text(
632
- text=f"""Some error occured, report to @{SUPPORT_GROUP}
633
 
634
  <b>Error:</b> <code>{ef}</code>"""
635
  )
@@ -701,7 +741,7 @@ async def sban_usr(c: Gojo, m: Message):
701
  await m.reply_text(text="I don't have enough rights to ban this user.")
702
  except RPCError as ef:
703
  await m.reply_text(
704
- text=f"""Some error occured, report to @{SUPPORT_GROUP}
705
 
706
  <b>Error:</b> <code>{ef}</code>"""
707
  )
@@ -781,9 +821,14 @@ async def dban_usr(c: Gojo, m: Message):
781
  ],
782
  ],
783
  )
784
- await c.send_animation(
785
- m.chat.id, animation=str(choice(BAN_GIFS)), caption=txt, reply_markup=keyboard
786
- )
 
 
 
 
 
787
  except ChatAdminRequired:
788
  await m.reply_text(text="I'm not admin or I don't have rights.")
789
  except PeerIdInvalid:
@@ -798,7 +843,7 @@ async def dban_usr(c: Gojo, m: Message):
798
  await m.reply_text(text="I don't have enough rights to ban this user.")
799
  except RPCError as ef:
800
  await m.reply_text(
801
- text=f"""Some error occured, report to @{SUPPORT_GROUP}
802
 
803
  <b>Error:</b> <code>{ef}</code>"""
804
  )
@@ -881,12 +926,24 @@ async def ban_usr(c: Gojo, m: Message):
881
  ],
882
  ],
883
  )
884
- await m.reply_animation(
885
- animation=str(choice(BAN_GIFS)),
886
- caption=txt,
887
- reply_markup=keyboard,
888
- reply_to_message_id=r_id,
889
- )
 
 
 
 
 
 
 
 
 
 
 
 
890
  except ChatAdminRequired:
891
  await m.reply_text(text="I'm not admin or I don't have rights.")
892
  except PeerIdInvalid:
@@ -901,7 +958,7 @@ async def ban_usr(c: Gojo, m: Message):
901
  await m.reply_text(text="I don't have enough rights to ban this user.")
902
  except RPCError as ef:
903
  await m.reply_text(
904
- text=f"""Some error occured, report to @{SUPPORT_GROUP}
905
 
906
  <b>Error:</b> <code>{ef}</code>"""
907
  )
@@ -968,13 +1025,13 @@ async def kickme(c: Gojo, m: Message):
968
  return
969
  else:
970
  await m.reply_text(
971
- text=f"""Some error occured, report to @{SUPPORT_GROUP}
972
 
973
  <b>Error:</b> <code>{ef}</code>"""
974
  )
975
  except Exception as ef:
976
  await m.reply_text(
977
- text=f"""Some error occured, report to @{SUPPORT_GROUP}
978
 
979
  <b>Error:</b> <code>{ef}</code>"""
980
  )
 
3
 
4
  from pyrogram import enums
5
  from pyrogram.errors import (ChatAdminRequired, PeerIdInvalid, RightForbidden,
6
+ RPCError, UserAdminInvalid, WebpageCurlFailed)
7
  from pyrogram.filters import regex
8
  from pyrogram.types import (CallbackQuery, ChatPrivileges,
9
  InlineKeyboardButton, InlineKeyboardMarkup,
10
  Message)
11
 
12
+ from Powers import LOGGER, MESSAGE_DUMP, OWNER_ID, SUPPORT_STAFF
13
  from Powers.bot_class import Gojo
14
  from Powers.utils.caching import ADMIN_CACHE, admin_cache_reload
15
  from Powers.utils.custom_filters import command, restrict_filter
 
95
  txt += f"\n<b>Reason</b>: {reason}"
96
  else:
97
  txt += "\n<b>Reason</b>: Not Specified"
98
+ if time_val:
99
+ txt += f"\n<b>Banned till</b>:{bantime}"
100
  keyboard = InlineKeyboardMarkup(
101
  [
102
  [
 
107
  ],
108
  ],
109
  )
110
+ anim = choice(BAN_GIFS)
111
+ try:
112
+ await m.reply_animation(
113
+ reply_to_message_id=r_id,
114
+ animation=str(anim),
115
+ caption=txt,
116
+ reply_markup=keyboard,
117
+ parse_mode=enums.ParseMode.HTML,
118
+ )
119
+ except WebpageCurlFailed:
120
+
121
+ await m.reply_text(
122
+ reply_to_message_id=r_id,
123
+ caption=txt,
124
+ reply_markup=keyboard,
125
+ parse_mode=enums.ParseMode.HTML,
126
+ )
127
+ await c.send_message(MESSAGE_DUMP,f"#REMOVE from BAN_GFIS\n{anim}")
128
  # await m.reply_text(txt, reply_markup=keyboard,
129
  # reply_to_message_id=r_id)
130
  except ChatAdminRequired:
 
142
  except RPCError as ef:
143
  await m.reply_text(
144
  (
145
+ f"""Some error occured, report it using `/bug`
146
 
147
  <b>Error:</b> <code>{ef}</code>"""
148
  )
 
231
  await m.reply_text(text="I don't have enough rights to ban this user.")
232
  except RPCError as ef:
233
  await m.reply_text(
234
+ text=f"""Some error occured, report it using `/bug`
235
 
236
  <b>Error:</b> <code>{ef}</code>"""
237
  )
 
311
  txt += f"\n<b>Reason</b>: {reason}"
312
  else:
313
  txt += "\n<b>Reason</b>: Not Specified"
314
+
315
+ if bantime:
316
+ txt += f"\n<b>Banned till</b>: {bantime}"
317
  keyboard = InlineKeyboardMarkup(
318
  [
319
  [
 
324
  ],
325
  ],
326
  )
327
+ anim = choice(BAN_GIFS)
328
+ try:
329
+ await m.reply_animation(
330
+ animation=str(anim),
331
+ caption=txt,
332
+ reply_markup=keyboard,
333
+ parse_mode=enums.ParseMode.HTML,
334
+ )
335
+ except WebpageCurlFailed:
336
+
337
+ await m.reply_text(
338
+ caption=txt,
339
+ reply_markup=keyboard,
340
+ parse_mode=enums.ParseMode.HTML,
341
+ )
342
+ await c.send_message(MESSAGE_DUMP,f"#REMOVE from BAN_GFIS\n{anim}")
343
  # await c.send_message(m.chat.id, txt, reply_markup=keyboard)
344
  except ChatAdminRequired:
345
  await m.reply_text(text="I'm not admin or I don't have rights.")
 
355
  await m.reply_text(text="I don't have enough rights to ban this user.")
356
  except RPCError as ef:
357
  await m.reply_text(
358
+ text=f"""Some error occured, report it using `/bug`
359
 
360
  <b>Error:</b> <code>{ef}</code>"""
361
  )
 
423
  else:
424
  txt += "\n<b>Reason</b>: Not Specified"
425
  # await m.reply_text(txt, reply_to_message_id=r_id)
426
+ kickk = choice(KICK_GIFS)
427
+ try:
428
+ await m.reply_animation(
429
+ reply_to_message_id=r_id,
430
+ animation=str(kickk),
431
+ caption=txt,
432
+ parse_mode=enums.ParseMode.HTML,
433
+ )
434
+ except:
435
+ await m.reply_text(
436
+ reply_to_message_id=r_id,
437
+ caption=txt,
438
+ parse_mode=enums.ParseMode.HTML,
439
+ )
440
+ await c.send_message(MESSAGE_DUMP,f"#REMOVE from KICK_GFIS\n{kickk}")
441
  await m.chat.unban_member(user_id)
442
  except ChatAdminRequired:
443
  await m.reply_text(text="I'm not admin or I don't have rights.")
 
453
  await m.reply_text(text="I don't have enough rights to ban this user.")
454
  except RPCError as ef:
455
  await m.reply_text(
456
+ text=f"""Some error occured, report it using `/bug`
457
 
458
  <b>Error:</b> <code>{ef}</code>"""
459
  )
 
521
  await m.reply_text(text="I don't have enough rights to kick this user.")
522
  except RPCError as ef:
523
  await m.reply_text(
524
+ text=f"""Some error occured, report it using `/bug`
525
 
526
  <b>Error:</b> <code>{ef}</code>"""
527
  )
 
582
  txt += f"\n<b>Reason</b>: {reason}"
583
  else:
584
  txt += "\n<b>Reason</b>: Not Specified"
585
+ kickk = choice(KICK_GIFS)
586
+ try:
587
+ await m.reply_animation(
588
+ animation=str(kickk),
589
+ caption=txt,
590
+ parse_mode=enums.ParseMode.HTML,
591
+ )
592
+ except:
593
+ await m.reply_text(
594
+ caption=txt,
595
+ parse_mode=enums.ParseMode.HTML,
596
+ )
597
+ await c.send_message(MESSAGE_DUMP,f"#REMOVE from KICK_GFIS\n{kickk}")
598
  await m.chat.unban_member(user_id)
599
  except ChatAdminRequired:
600
  await m.reply_text(text="I'm not admin or I don't have rights.")
 
610
  await m.reply_text(text="I don't have enough rights to kick this user.")
611
  except RPCError as ef:
612
  await m.reply_text(
613
+ text=f"""Some error occured, report it using `/bug`
614
 
615
  <b>Error:</b> <code>{ef}</code>"""
616
  )
 
669
  await m.reply_text(text="I don't have enough rights to unban this user.")
670
  except RPCError as ef:
671
  await m.reply_text(
672
+ text=f"""Some error occured, report it using `/bug`
673
 
674
  <b>Error:</b> <code>{ef}</code>"""
675
  )
 
741
  await m.reply_text(text="I don't have enough rights to ban this user.")
742
  except RPCError as ef:
743
  await m.reply_text(
744
+ text=f"""Some error occured, report it using `/bug`
745
 
746
  <b>Error:</b> <code>{ef}</code>"""
747
  )
 
821
  ],
822
  ],
823
  )
824
+ animm = choice(BAN_GIFS)
825
+ try:
826
+ await c.send_animation(
827
+ m.chat.id, animation=str(animm), caption=txt, reply_markup=keyboard
828
+ )
829
+ except WebpageCurlFailed:
830
+ await c.send_message(m.chat.id,txt,enums.ParseMode.HTML,reply_markup=keyboard)
831
+ await c.send_messagea(MESSAGE_DUMP,f"#REMOVE from BAN_GIFS\n{animm}")
832
  except ChatAdminRequired:
833
  await m.reply_text(text="I'm not admin or I don't have rights.")
834
  except PeerIdInvalid:
 
843
  await m.reply_text(text="I don't have enough rights to ban this user.")
844
  except RPCError as ef:
845
  await m.reply_text(
846
+ text=f"""Some error occured, report it using `/bug`
847
 
848
  <b>Error:</b> <code>{ef}</code>"""
849
  )
 
926
  ],
927
  ],
928
  )
929
+ anim = choice(BAN_GIFS)
930
+ try:
931
+ await m.reply_animation(
932
+ reply_to_message_id=r_id,
933
+ animation=str(anim),
934
+ caption=txt,
935
+ reply_markup=keyboard,
936
+ parse_mode=enums.ParseMode.HTML,
937
+ )
938
+ except WebpageCurlFailed:
939
+
940
+ await m.reply_text(
941
+ reply_to_message_id=r_id,
942
+ caption=txt,
943
+ reply_markup=keyboard,
944
+ parse_mode=enums.ParseMode.HTML,
945
+ )
946
+ await c.send_message(MESSAGE_DUMP,f"#REMOVE from BAN_GFIS\n{anim}")
947
  except ChatAdminRequired:
948
  await m.reply_text(text="I'm not admin or I don't have rights.")
949
  except PeerIdInvalid:
 
958
  await m.reply_text(text="I don't have enough rights to ban this user.")
959
  except RPCError as ef:
960
  await m.reply_text(
961
+ text=f"""Some error occured, report it using `/bug`
962
 
963
  <b>Error:</b> <code>{ef}</code>"""
964
  )
 
1025
  return
1026
  else:
1027
  await m.reply_text(
1028
+ text=f"""Some error occured, report it using `/bug`
1029
 
1030
  <b>Error:</b> <code>{ef}</code>"""
1031
  )
1032
  except Exception as ef:
1033
  await m.reply_text(
1034
+ text=f"""Some error occured, report it using `/bug`
1035
 
1036
  <b>Error:</b> <code>{ef}</code>"""
1037
  )
Powers/plugins/flood.py CHANGED
@@ -288,6 +288,8 @@ async def reverse_callbacks(c: Gojo, q: CallbackQuery):
288
  data = q.data.split("_")
289
  action = data[1]
290
  user_id = int(q.data.split("=")[1])
 
 
291
  if action == "ban":
292
  user = await q.message.chat.get_member(q.from_user.id)
293
  if not user.privileges.can_restrict_members and q.from_user.id in SUPPORT_STAFF:
@@ -328,6 +330,8 @@ dic = {}
328
  @Gojo.on_message(filters.all & ~filters.bot | ~filters.private, 10)
329
  async def flood_watcher(c: Gojo, m: Message):
330
  c_id = m.chat.id
 
 
331
  Flood = Floods()
332
  try:
333
  u_id = m.from_user.id
@@ -403,7 +407,7 @@ async def flood_watcher(c: Gojo, m: Message):
403
  return
404
  except RPCError as ef:
405
  await m.reply_text(
406
- text=f"""Some error occured, report to @{SUPPORT_GROUP}
407
 
408
  <b>Error:</b> <code>{ef}</code>"""
409
  )
@@ -434,7 +438,7 @@ async def flood_watcher(c: Gojo, m: Message):
434
  return
435
  except RPCError as ef:
436
  await m.reply_text(
437
- text=f"""Some error occured, report to @{SUPPORT_GROUP}
438
 
439
  <b>Error:</b> <code>{ef}</code>"""
440
  )
@@ -477,7 +481,7 @@ async def flood_watcher(c: Gojo, m: Message):
477
  return
478
  except RPCError as ef:
479
  await m.reply_text(
480
- text=f"""Some error occured, report to @{SUPPORT_GROUP}
481
 
482
  <b>Error:</b> <code>{ef}</code>"""
483
  )
 
288
  data = q.data.split("_")
289
  action = data[1]
290
  user_id = int(q.data.split("=")[1])
291
+ if not q.from_user:
292
+ return q.answer("Looks like you are not an user 👀")
293
  if action == "ban":
294
  user = await q.message.chat.get_member(q.from_user.id)
295
  if not user.privileges.can_restrict_members and q.from_user.id in SUPPORT_STAFF:
 
330
  @Gojo.on_message(filters.all & ~filters.bot | ~filters.private, 10)
331
  async def flood_watcher(c: Gojo, m: Message):
332
  c_id = m.chat.id
333
+ if not m.chat:
334
+ return
335
  Flood = Floods()
336
  try:
337
  u_id = m.from_user.id
 
407
  return
408
  except RPCError as ef:
409
  await m.reply_text(
410
+ text=f"""Some error occured, report it using `/bug`
411
 
412
  <b>Error:</b> <code>{ef}</code>"""
413
  )
 
438
  return
439
  except RPCError as ef:
440
  await m.reply_text(
441
+ text=f"""Some error occured, report it using `/bug`
442
 
443
  <b>Error:</b> <code>{ef}</code>"""
444
  )
 
481
  return
482
  except RPCError as ef:
483
  await m.reply_text(
484
+ text=f"""Some error occured, report it using `/bug`
485
 
486
  <b>Error:</b> <code>{ef}</code>"""
487
  )
Powers/plugins/locks.py CHANGED
@@ -491,6 +491,8 @@ async def lock_del_mess(c:Gojo, m: Message):
491
  if m.chat.id not in all_chats:
492
  return
493
  if m.sender_chat and not (m.forward_from_chat or m.forward_from):
 
 
494
  await delete_messages(c,m)
495
  return
496
  is_approved = await is_approved_user(c,m)
 
491
  if m.chat.id not in all_chats:
492
  return
493
  if m.sender_chat and not (m.forward_from_chat or m.forward_from):
494
+ if m.sender_chat == m.chat.id:
495
+ return
496
  await delete_messages(c,m)
497
  return
498
  is_approved = await is_approved_user(c,m)
Powers/plugins/muting.py CHANGED
@@ -3,13 +3,13 @@ from traceback import format_exc
3
 
4
  from pyrogram import enums
5
  from pyrogram.errors import (ChatAdminRequired, RightForbidden, RPCError,
6
- UserNotParticipant)
7
  from pyrogram.filters import regex
8
  from pyrogram.types import (CallbackQuery, ChatPermissions,
9
  InlineKeyboardButton, InlineKeyboardMarkup,
10
  Message)
11
 
12
- from Powers import LOGGER, OWNER_ID, SUPPORT_GROUP, SUPPORT_STAFF
13
  from Powers.bot_class import Gojo
14
  from Powers.utils.caching import ADMIN_CACHE, admin_cache_reload
15
  from Powers.utils.custom_filters import command, restrict_filter
@@ -92,6 +92,8 @@ async def tmute_usr(c: Gojo, m: Message):
92
  txt += f"\n<b>Reason</b>: {reason}"
93
  else:
94
  txt += "\n<b>Reason</b>: Not Specified"
 
 
95
  keyboard = InlineKeyboardMarkup(
96
  [
97
  [
@@ -102,12 +104,17 @@ async def tmute_usr(c: Gojo, m: Message):
102
  ],
103
  ],
104
  )
105
- await m.reply_animation(
106
- animation=str(choice(MUTE_GIFS)),
107
- caption=txt,
108
- reply_markup=keyboard,
109
- reply_to_message_id=r_id,
110
- )
 
 
 
 
 
111
  except ChatAdminRequired:
112
  await m.reply_text(text="I'm not admin or I don't have rights.")
113
  except RightForbidden:
@@ -116,7 +123,7 @@ async def tmute_usr(c: Gojo, m: Message):
116
  await m.reply_text("How can I mute a user who is not a part of this chat?")
117
  except RPCError as ef:
118
  await m.reply_text(
119
- text=f"""Some error occured, report to @{SUPPORT_GROUP}
120
 
121
  <b>Error:</b> <code>{ef}</code>"""
122
  )
@@ -183,7 +190,6 @@ async def dtmute_usr(c: Gojo, m: Message):
183
 
184
  if not mutetime:
185
  return
186
-
187
  try:
188
  await m.chat.restrict_member(
189
  user_id,
@@ -199,6 +205,8 @@ async def dtmute_usr(c: Gojo, m: Message):
199
  txt += f"\n<b>Reason</b>: {reason}"
200
  else:
201
  txt += "\n<b>Reason</b>: Not Specified"
 
 
202
  keyboard = InlineKeyboardMarkup(
203
  [
204
  [
@@ -209,13 +217,16 @@ async def dtmute_usr(c: Gojo, m: Message):
209
  ],
210
  ],
211
  )
212
- await c.send_animation(
213
- animation=str(choice(MUTE_GIFS)),
214
- chat_id=m.chat.id,
215
- caption=txt,
216
- reply_markup=keyboard,
217
- unsave=True,
218
- )
 
 
 
219
  except ChatAdminRequired:
220
  await m.reply_text(text="I'm not admin or I don't have rights.")
221
  except RightForbidden:
@@ -224,7 +235,7 @@ async def dtmute_usr(c: Gojo, m: Message):
224
  await m.reply_text("How can I mute a user who is not a part of this chat?")
225
  except RPCError as ef:
226
  await m.reply_text(
227
- text=f"""Some error occured, report to @{SUPPORT_GROUP}
228
 
229
  <b>Error:</b> <code>{ef}</code>"""
230
  )
@@ -308,7 +319,7 @@ async def stmute_usr(c: Gojo, m: Message):
308
  await m.reply_text("How can I mute a user who is not a part of this chat?")
309
  except RPCError as ef:
310
  await m.reply_text(
311
- text=f"""Some error occured, report to @{SUPPORT_GROUP}
312
 
313
  <b>Error:</b> <code>{ef}</code>"""
314
  )
@@ -385,12 +396,17 @@ async def mute_usr(c: Gojo, m: Message):
385
  ],
386
  ],
387
  )
388
- await m.reply_animation(
389
- animation=str(choice(MUTE_GIFS)),
390
- caption=txt,
391
- reply_markup=keyboard,
392
- reply_to_message_id=r_id,
393
- )
 
 
 
 
 
394
  except ChatAdminRequired:
395
  await m.reply_text(text="I'm not admin or I don't have rights.")
396
  except RightForbidden:
@@ -399,7 +415,7 @@ async def mute_usr(c: Gojo, m: Message):
399
  await m.reply_text("How can I mute a user who is not a part of this chat?")
400
  except RPCError as ef:
401
  await m.reply_text(
402
- text=f"""Some error occured, report to @{SUPPORT_GROUP}
403
 
404
  <b>Error:</b> <code>{ef}</code>"""
405
  )
@@ -463,7 +479,7 @@ async def smute_usr(c: Gojo, m: Message):
463
  await m.reply_text("How can I mute a user who is not a part of this chat?")
464
  except RPCError as ef:
465
  await m.reply_text(
466
- text=f"""Some error occured, report to @{SUPPORT_GROUP}
467
 
468
  <b>Error:</b> <code>{ef}</code>"""
469
  )
@@ -539,12 +555,16 @@ async def dmute_usr(c: Gojo, m: Message):
539
  ],
540
  ],
541
  )
542
- await c.send_animation(
543
- animation=str(choice(MUTE_GIFS)),
544
- chat_id=m.chat.id,
545
- caption=txt,
546
- reply_markup=keyboard,
547
- )
 
 
 
 
548
  except ChatAdminRequired:
549
  await m.reply_text(text="I'm not admin or I don't have rights.")
550
  except RightForbidden:
@@ -553,7 +573,7 @@ async def dmute_usr(c: Gojo, m: Message):
553
  await m.reply_text("How can I mute a user who is not a part of this chat?")
554
  except RPCError as ef:
555
  await m.reply_text(
556
- text=f"""Some error occured, report to @{SUPPORT_GROUP}
557
 
558
  <b>Error:</b> <code>{ef}</code>"""
559
  )
@@ -598,7 +618,7 @@ async def unmute_usr(c: Gojo, m: Message):
598
  await m.reply_text(text="I don't have enough rights to ban this user.")
599
  except RPCError as ef:
600
  await m.reply_text(
601
- text=f"""Some error occured, report to @{SUPPORT_GROUP}
602
 
603
  <b>Error:</b> <code>{ef}</code>"""
604
  )
 
3
 
4
  from pyrogram import enums
5
  from pyrogram.errors import (ChatAdminRequired, RightForbidden, RPCError,
6
+ UserNotParticipant, WebpageCurlFailed)
7
  from pyrogram.filters import regex
8
  from pyrogram.types import (CallbackQuery, ChatPermissions,
9
  InlineKeyboardButton, InlineKeyboardMarkup,
10
  Message)
11
 
12
+ from Powers import LOGGER, MESSAGE_DUMP, OWNER_ID, SUPPORT_STAFF
13
  from Powers.bot_class import Gojo
14
  from Powers.utils.caching import ADMIN_CACHE, admin_cache_reload
15
  from Powers.utils.custom_filters import command, restrict_filter
 
92
  txt += f"\n<b>Reason</b>: {reason}"
93
  else:
94
  txt += "\n<b>Reason</b>: Not Specified"
95
+ if mutetime:
96
+ txt += f"\n<b>Muted till</b>: {mutetime}"
97
  keyboard = InlineKeyboardMarkup(
98
  [
99
  [
 
104
  ],
105
  ],
106
  )
107
+ mutt = choice(MUTE_GIFS)
108
+ try:
109
+ await m.reply_animation(
110
+ animation=str(mutt),
111
+ caption=txt,
112
+ reply_markup=keyboard,
113
+ reply_to_message_id=r_id,
114
+ )
115
+ except WebpageCurlFailed:
116
+ await m.reply_text(txt,reply_markup=keyboard, reply_to_message_id=r_id)
117
+ await c.send_message(MESSAGE_DUMP,f"#REMOVE from MUTE_GIFS\n{mutt}")
118
  except ChatAdminRequired:
119
  await m.reply_text(text="I'm not admin or I don't have rights.")
120
  except RightForbidden:
 
123
  await m.reply_text("How can I mute a user who is not a part of this chat?")
124
  except RPCError as ef:
125
  await m.reply_text(
126
+ text=f"""Some error occured, report it using `/bug`
127
 
128
  <b>Error:</b> <code>{ef}</code>"""
129
  )
 
190
 
191
  if not mutetime:
192
  return
 
193
  try:
194
  await m.chat.restrict_member(
195
  user_id,
 
205
  txt += f"\n<b>Reason</b>: {reason}"
206
  else:
207
  txt += "\n<b>Reason</b>: Not Specified"
208
+ if mutetime:
209
+ txt += f"\n<b>Muted till</b>: {mutetime}"
210
  keyboard = InlineKeyboardMarkup(
211
  [
212
  [
 
217
  ],
218
  ],
219
  )
220
+ mutt = choice(MUTE_GIFS)
221
+ try:
222
+ await m.reply_animation(
223
+ animation=str(mutt),
224
+ caption=txt,
225
+ reply_markup=keyboard,
226
+ )
227
+ except WebpageCurlFailed:
228
+ await m.reply_text(txt,reply_markup=keyboard)
229
+ await c.send_message(MESSAGE_DUMP,f"#REMOVE from MUTE_GIFS\n{mutt}")
230
  except ChatAdminRequired:
231
  await m.reply_text(text="I'm not admin or I don't have rights.")
232
  except RightForbidden:
 
235
  await m.reply_text("How can I mute a user who is not a part of this chat?")
236
  except RPCError as ef:
237
  await m.reply_text(
238
+ text=f"""Some error occured, report it using `/bug`
239
 
240
  <b>Error:</b> <code>{ef}</code>"""
241
  )
 
319
  await m.reply_text("How can I mute a user who is not a part of this chat?")
320
  except RPCError as ef:
321
  await m.reply_text(
322
+ text=f"""Some error occured, report it using `/bug`
323
 
324
  <b>Error:</b> <code>{ef}</code>"""
325
  )
 
396
  ],
397
  ],
398
  )
399
+ mutt = choice(MUTE_GIFS)
400
+ try:
401
+ await m.reply_animation(
402
+ animation=str(mutt),
403
+ caption=txt,
404
+ reply_markup=keyboard,
405
+ reply_to_message_id=r_id,
406
+ )
407
+ except WebpageCurlFailed:
408
+ await m.reply_text(txt,reply_markup=keyboard, reply_to_message_id=r_id)
409
+ await c.send_message(MESSAGE_DUMP,f"#REMOVE from MUTE_GIFS\n{mutt}")
410
  except ChatAdminRequired:
411
  await m.reply_text(text="I'm not admin or I don't have rights.")
412
  except RightForbidden:
 
415
  await m.reply_text("How can I mute a user who is not a part of this chat?")
416
  except RPCError as ef:
417
  await m.reply_text(
418
+ text=f"""Some error occured, report it using `/bug`
419
 
420
  <b>Error:</b> <code>{ef}</code>"""
421
  )
 
479
  await m.reply_text("How can I mute a user who is not a part of this chat?")
480
  except RPCError as ef:
481
  await m.reply_text(
482
+ text=f"""Some error occured, report it using `/bug`
483
 
484
  <b>Error:</b> <code>{ef}</code>"""
485
  )
 
555
  ],
556
  ],
557
  )
558
+ mutt = choice(MUTE_GIFS)
559
+ try:
560
+ await m.reply_animation(
561
+ animation=str(mutt),
562
+ caption=txt,
563
+ reply_markup=keyboard,
564
+ )
565
+ except WebpageCurlFailed:
566
+ await m.reply_text(txt,reply_markup=keyboard)
567
+ await c.send_message(MESSAGE_DUMP,f"#REMOVE from MUTE_GIFS\n{mutt}")
568
  except ChatAdminRequired:
569
  await m.reply_text(text="I'm not admin or I don't have rights.")
570
  except RightForbidden:
 
573
  await m.reply_text("How can I mute a user who is not a part of this chat?")
574
  except RPCError as ef:
575
  await m.reply_text(
576
+ text=f"""Some error occured, report it using `/bug`
577
 
578
  <b>Error:</b> <code>{ef}</code>"""
579
  )
 
618
  await m.reply_text(text="I don't have enough rights to ban this user.")
619
  except RPCError as ef:
620
  await m.reply_text(
621
+ text=f"""Some error occured, report it using `/bug`
622
 
623
  <b>Error:</b> <code>{ef}</code>"""
624
  )
Powers/plugins/pin.py CHANGED
@@ -55,7 +55,7 @@ async def pin_message(_, m: Message):
55
  await m.reply_text(text="I don't have enough rights to pin messages.")
56
  except RPCError as ef:
57
  await m.reply_text(
58
- text=f"""Some error occured, report to @{SUPPORT_GROUP}
59
 
60
  <b>Error:</b> <code>{ef}</code>"""
61
  )
@@ -84,7 +84,7 @@ async def unpin_message(c: Gojo, m: Message):
84
  await m.reply_text(text="I don't have enough rights to unpin messages.")
85
  except RPCError as ef:
86
  await m.reply_text(
87
- text=f"""Some error occured, report to @{SUPPORT_GROUP}
88
 
89
  <b>Error:</b> <code>{ef}</code>"""
90
  )
@@ -128,7 +128,7 @@ async def unpinall_calllback(c: Gojo, q: CallbackQuery):
128
  await q.message.edit_text(text="I don't have enough rights to unpin messages.")
129
  except RPCError as ef:
130
  await q.message.edit_text(
131
- text=f"""Some error occured, report to @{SUPPORT_GROUP}
132
 
133
  <b>Error:</b> <code>{ef}</code>"""
134
  )
 
55
  await m.reply_text(text="I don't have enough rights to pin messages.")
56
  except RPCError as ef:
57
  await m.reply_text(
58
+ text=f"""Some error occured, report it using `/bug`
59
 
60
  <b>Error:</b> <code>{ef}</code>"""
61
  )
 
84
  await m.reply_text(text="I don't have enough rights to unpin messages.")
85
  except RPCError as ef:
86
  await m.reply_text(
87
+ text=f"""Some error occured, report it using `/bug`
88
 
89
  <b>Error:</b> <code>{ef}</code>"""
90
  )
 
128
  await q.message.edit_text(text="I don't have enough rights to unpin messages.")
129
  except RPCError as ef:
130
  await q.message.edit_text(
131
+ text=f"""Some error occured, report it using `/bug`
132
 
133
  <b>Error:</b> <code>{ef}</code>"""
134
  )
Powers/plugins/purge.py CHANGED
@@ -41,7 +41,7 @@ async def purge(c: Gojo, m: Message):
41
  return
42
  except RPCError as ef:
43
  await m.reply_text(
44
- text=f"""Some error occured, report to @{SUPPORT_GROUP}
45
 
46
  <b>Error:</b> <code>{ef}</code>"""
47
  )
@@ -88,7 +88,7 @@ async def spurge(c: Gojo, m: Message):
88
  return
89
  except RPCError as ef:
90
  await m.reply_text(
91
- text=f"""Some error occured, report to @{SUPPORT_GROUP}
92
 
93
  <b>Error:</b> <code>{ef}</code>"""
94
  )
 
41
  return
42
  except RPCError as ef:
43
  await m.reply_text(
44
+ text=f"""Some error occured, report it using `/bug`
45
 
46
  <b>Error:</b> <code>{ef}</code>"""
47
  )
 
88
  return
89
  except RPCError as ef:
90
  await m.reply_text(
91
+ text=f"""Some error occured, report it using `/bug`
92
 
93
  <b>Error:</b> <code>{ef}</code>"""
94
  )
Powers/utils/kbhelpers.py CHANGED
@@ -14,7 +14,7 @@ def ikb(rows=None, back=False, todo="start_back"):
14
  for row in rows:
15
  line = []
16
  for button in row:
17
- btn_text = button.split(".")[1].upper()
18
  button = btn(btn_text, button) # InlineKeyboardButton
19
  line.append(button)
20
  lines.append(line)
 
14
  for row in rows:
15
  line = []
16
  for button in row:
17
+ btn_text = button.split(".")[1].capitalize()
18
  button = btn(btn_text, button) # InlineKeyboardButton
19
  line.append(button)
20
  lines.append(line)