Captain Ezio commited on
Commit
6902782
·
1 Parent(s): c336809

Pre update bug fixes

Browse files
Powers/plugins/bans.py CHANGED
@@ -3,7 +3,7 @@ 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,
@@ -137,6 +137,8 @@ async def tban_usr(c: Gojo, m: Message):
137
  await m.reply_text(
138
  text="Cannot act on this user, maybe I wasn't the one who changed their permissions."
139
  )
 
 
140
  except RightForbidden:
141
  await m.reply_text(text="I don't have enough rights to ban this user.")
142
  except RPCError as ef:
@@ -227,6 +229,8 @@ async def stban_usr(c: Gojo, m: Message):
227
  await m.reply_text(
228
  text="Cannot act on this user, maybe I wasn't the one who changed their permissions."
229
  )
 
 
230
  except RightForbidden:
231
  await m.reply_text(text="I don't have enough rights to ban this user.")
232
  except RPCError as ef:
@@ -444,6 +448,8 @@ async def kick_usr(c: Gojo, m: Message):
444
  await m.reply_text(
445
  text="Cannot act on this user, maybe I wasn't the one who changed their permissions."
446
  )
 
 
447
  except RightForbidden:
448
  await m.reply_text(text="I don't have enough rights to ban this user.")
449
  except RPCError as ef:
@@ -512,6 +518,8 @@ async def skick_usr(c: Gojo, m: Message):
512
  await m.reply_text(
513
  text="Cannot act on this user, maybe I wasn't the one who changed their permissions."
514
  )
 
 
515
  except RightForbidden:
516
  await m.reply_text(text="I don't have enough rights to kick this user.")
517
  except RPCError as ef:
@@ -601,6 +609,8 @@ async def dkick_usr(c: Gojo, m: Message):
601
  )
602
  except RightForbidden:
603
  await m.reply_text(text="I don't have enough rights to kick this user.")
 
 
604
  except RPCError as ef:
605
  await m.reply_text(
606
  text=f"""Some error occured, report it using `/bug`
@@ -730,6 +740,8 @@ async def sban_usr(c: Gojo, m: Message):
730
  )
731
  except RightForbidden:
732
  await m.reply_text(text="I don't have enough rights to ban this user.")
 
 
733
  except RPCError as ef:
734
  await m.reply_text(
735
  text=f"""Some error occured, report it using `/bug`
@@ -830,6 +842,8 @@ async def dban_usr(c: Gojo, m: Message):
830
  )
831
  except RightForbidden:
832
  await m.reply_text(text="I don't have enough rights to ban this user.")
 
 
833
  except RPCError as ef:
834
  await m.reply_text(
835
  text=f"""Some error occured, report it using `/bug`
@@ -938,6 +952,8 @@ async def ban_usr(c: Gojo, m: Message):
938
  await m.reply_text(
939
  "I have not seen this user yet...!\nMind forwarding one of their message so I can recognize them?",
940
  )
 
 
941
  except UserAdminInvalid:
942
  await m.reply_text(
943
  text="Cannot act on this user, maybe I wasn't the one who changed their permissions."
@@ -968,7 +984,7 @@ async def unbanbutton(c: Gojo, q: CallbackQuery):
968
  )
969
  return
970
 
971
- if not user.privileges.can_restrict_members and q.from_user.id != OWNER_ID:
972
  await q.answer(
973
  "You don't have enough permission to do this!\nStay in your limits!",
974
  show_alert=True,
 
3
 
4
  from pyrogram import enums
5
  from pyrogram.errors import (ChatAdminRequired, PeerIdInvalid, RightForbidden,
6
+ RPCError, UserAdminInvalid, UserNotParticipant)
7
  from pyrogram.filters import regex
8
  from pyrogram.types import (CallbackQuery, ChatPrivileges,
9
  InlineKeyboardButton, InlineKeyboardMarkup,
 
137
  await m.reply_text(
138
  text="Cannot act on this user, maybe I wasn't the one who changed their permissions."
139
  )
140
+ except UserNotParticipant:
141
+ await m.reply_text("User is not part of the group")
142
  except RightForbidden:
143
  await m.reply_text(text="I don't have enough rights to ban this user.")
144
  except RPCError as ef:
 
229
  await m.reply_text(
230
  text="Cannot act on this user, maybe I wasn't the one who changed their permissions."
231
  )
232
+ except UserNotParticipant:
233
+ await m.reply_text("User is not part of the group")
234
  except RightForbidden:
235
  await m.reply_text(text="I don't have enough rights to ban this user.")
236
  except RPCError as ef:
 
448
  await m.reply_text(
449
  text="Cannot act on this user, maybe I wasn't the one who changed their permissions."
450
  )
451
+ except UserNotParticipant:
452
+ await m.reply_text("User is not part of the group")
453
  except RightForbidden:
454
  await m.reply_text(text="I don't have enough rights to ban this user.")
455
  except RPCError as ef:
 
518
  await m.reply_text(
519
  text="Cannot act on this user, maybe I wasn't the one who changed their permissions."
520
  )
521
+ except UserNotParticipant:
522
+ await m.reply_text("User is not part of the group")
523
  except RightForbidden:
524
  await m.reply_text(text="I don't have enough rights to kick this user.")
525
  except RPCError as ef:
 
609
  )
610
  except RightForbidden:
611
  await m.reply_text(text="I don't have enough rights to kick this user.")
612
+ except UserNotParticipant:
613
+ await m.reply_text("User is not part of the group")
614
  except RPCError as ef:
615
  await m.reply_text(
616
  text=f"""Some error occured, report it using `/bug`
 
740
  )
741
  except RightForbidden:
742
  await m.reply_text(text="I don't have enough rights to ban this user.")
743
+ except UserNotParticipant:
744
+ await m.reply_text("User is not part of the group")
745
  except RPCError as ef:
746
  await m.reply_text(
747
  text=f"""Some error occured, report it using `/bug`
 
842
  )
843
  except RightForbidden:
844
  await m.reply_text(text="I don't have enough rights to ban this user.")
845
+ except UserNotParticipant:
846
+ await m.reply_text("User is not part of the group")
847
  except RPCError as ef:
848
  await m.reply_text(
849
  text=f"""Some error occured, report it using `/bug`
 
952
  await m.reply_text(
953
  "I have not seen this user yet...!\nMind forwarding one of their message so I can recognize them?",
954
  )
955
+ except UserNotParticipant:
956
+ await m.reply_text("User is not part of the group")
957
  except UserAdminInvalid:
958
  await m.reply_text(
959
  text="Cannot act on this user, maybe I wasn't the one who changed their permissions."
 
984
  )
985
  return
986
 
987
+ elif user and not user.privileges.can_restrict_members and q.from_user.id != OWNER_ID:
988
  await q.answer(
989
  "You don't have enough permission to do this!\nStay in your limits!",
990
  show_alert=True,
Powers/plugins/greetings.py CHANGED
@@ -2,7 +2,7 @@ from html import escape
2
  from secrets import choice
3
  from traceback import format_exc
4
 
5
- from pyrogram import enums, filters
6
  from pyrogram.enums import ChatMemberStatus as CMS
7
  from pyrogram.errors import ChatAdminRequired, RPCError
8
  from pyrogram.types import ChatMemberUpdated, Message
@@ -301,6 +301,10 @@ async def member_has_joined(c: Gojo, member: ChatMemberUpdated):
301
  teks = choice(filter_reply)
302
  else:
303
  teks = tek
 
 
 
 
304
  ifff = db.get_current_cleanwelcome_id()
305
  gg = db.get_current_cleanwelcome_settings()
306
  if ifff and gg:
@@ -375,6 +379,10 @@ async def member_has_left(c: Gojo, member: ChatMemberUpdated):
375
  teks = choice(filter_reply)
376
  else:
377
  teks = tek
 
 
 
 
378
  ifff = db.get_current_cleangoodbye_id()
379
  iii = db.get_current_cleangoodbye_settings()
380
  if ifff and iii:
 
2
  from secrets import choice
3
  from traceback import format_exc
4
 
5
+ from pyrogram import emoji, enums, filters
6
  from pyrogram.enums import ChatMemberStatus as CMS
7
  from pyrogram.errors import ChatAdminRequired, RPCError
8
  from pyrogram.types import ChatMemberUpdated, Message
 
301
  teks = choice(filter_reply)
302
  else:
303
  teks = tek
304
+
305
+ if not teks:
306
+ teks = f"A wild {user.mention} appeared in {member.chat.title}! Everyone be aware."
307
+
308
  ifff = db.get_current_cleanwelcome_id()
309
  gg = db.get_current_cleanwelcome_settings()
310
  if ifff and gg:
 
379
  teks = choice(filter_reply)
380
  else:
381
  teks = tek
382
+
383
+ if not teks: #Just in case
384
+ teks = f"Thanks for being part of this group {user.mention}. But I don't like your arrogance and leaving the group {emoji.EYES}"
385
+
386
  ifff = db.get_current_cleangoodbye_id()
387
  iii = db.get_current_cleangoodbye_settings()
388
  if ifff and iii:
Powers/plugins/locks.py CHANGED
@@ -478,7 +478,7 @@ async def lock_del_mess(c:Gojo, m: Message):
478
  all_chats = lock.get_lock_channel()
479
  if not all_chats:
480
  return
481
- if m.chat.id not in all_chats:
482
  return
483
  if m.sender_chat and not (m.forward_from_chat or m.forward_from):
484
  if m.sender_chat.id == m.chat.id:
 
478
  all_chats = lock.get_lock_channel()
479
  if not all_chats:
480
  return
481
+ if m.chat and m.chat.id not in all_chats:
482
  return
483
  if m.sender_chat and not (m.forward_from_chat or m.forward_from):
484
  if m.sender_chat.id == m.chat.id:
Powers/plugins/scheduled_jobs.py CHANGED
@@ -1,4 +1,4 @@
1
- import time
2
  from asyncio import sleep
3
  from traceback import format_exc
4
 
@@ -28,7 +28,7 @@ async def clean_my_db(c:Client,is_cmd=False, id=None):
28
  to_clean = list()
29
  chats_list = Chats.list_chats_by_id()
30
  to_clean.clear()
31
- start = time.time()
32
  for chats in chats_list:
33
  try:
34
  stat = await c.get_chat_member(chat_id=chats,user_id=Config.BOT_ID)
@@ -60,7 +60,7 @@ async def clean_my_db(c:Client,is_cmd=False, id=None):
60
  x = len(to_clean)
61
  txt = f"#INFO\n\nCleaned db:\nTotal chats removed: {x}"
62
  to_clean.clear()
63
- nums = time.time()-start
64
  if is_cmd:
65
  txt += f"\nClean type: Forced\nInitiated by: {(await c.get_users(user_ids=id)).mention}"
66
  txt += f"\nClean type: Manual\n\tTook {round(nums,2)} seconds to complete the process"
 
1
+ import time as TIME
2
  from asyncio import sleep
3
  from traceback import format_exc
4
 
 
28
  to_clean = list()
29
  chats_list = Chats.list_chats_by_id()
30
  to_clean.clear()
31
+ start = TIME.time()
32
  for chats in chats_list:
33
  try:
34
  stat = await c.get_chat_member(chat_id=chats,user_id=Config.BOT_ID)
 
60
  x = len(to_clean)
61
  txt = f"#INFO\n\nCleaned db:\nTotal chats removed: {x}"
62
  to_clean.clear()
63
+ nums = TIME.time()-start
64
  if is_cmd:
65
  txt += f"\nClean type: Forced\nInitiated by: {(await c.get_users(user_ids=id)).mention}"
66
  txt += f"\nClean type: Manual\n\tTook {round(nums,2)} seconds to complete the process"