Captain Ezio commited on
Commit
6dcea66
·
1 Parent(s): c62ca93

almost done

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. Powers/__init__.py +4 -16
  2. Powers/bot_class.py +1 -0
  3. Powers/database/antispam_db.py +2 -1
  4. Powers/database/approve_db.py +0 -2
  5. Powers/database/blacklist_db.py +0 -2
  6. Powers/database/chats_db.py +0 -1
  7. Powers/database/disable_db.py +0 -2
  8. Powers/database/filters_db.py +9 -1
  9. Powers/database/greetings_db.py +0 -2
  10. Powers/database/locks_db.py +32 -20
  11. Powers/database/pins_db.py +0 -1
  12. Powers/database/reporting_db.py +0 -2
  13. Powers/database/rules_db.py +0 -2
  14. Powers/database/users_db.py +0 -1
  15. Powers/database/warns_db.py +0 -4
  16. Powers/plugins/admin.py +11 -18
  17. Powers/plugins/antispam.py +8 -9
  18. Powers/plugins/approve.py +0 -6
  19. Powers/plugins/auto_join.py +2 -3
  20. Powers/plugins/bans.py +17 -49
  21. Powers/plugins/birthday.py +8 -8
  22. Powers/plugins/blacklist.py +0 -9
  23. Powers/plugins/captcha.py +2 -3
  24. Powers/plugins/chat_blacklist.py +0 -3
  25. Powers/plugins/clean_db.py +0 -1
  26. Powers/plugins/dev.py +23 -6
  27. Powers/plugins/disable.py +0 -7
  28. Powers/plugins/filters.py +3 -8
  29. Powers/plugins/flood.py +5 -7
  30. Powers/plugins/formatting.py +0 -1
  31. Powers/plugins/fun.py +1 -19
  32. Powers/plugins/greetings.py +7 -19
  33. Powers/plugins/info.py +12 -9
  34. Powers/plugins/locks.py +21 -34
  35. Powers/plugins/muting.py +10 -34
  36. Powers/plugins/notes.py +3 -15
  37. Powers/plugins/pin.py +2 -12
  38. Powers/plugins/report.py +3 -13
  39. Powers/plugins/rules.py +1 -8
  40. Powers/plugins/scheduled_jobs.py +0 -3
  41. Powers/plugins/start.py +3 -12
  42. Powers/plugins/stats.py +5 -2
  43. Powers/plugins/stickers.py +12 -43
  44. Powers/plugins/utils.py +2 -8
  45. Powers/plugins/warns.py +5 -19
  46. Powers/plugins/watchers.py +6 -18
  47. Powers/plugins/web_con.py +22 -23
  48. Powers/supports.py +11 -3
  49. Powers/utils/admin_check.py +6 -7
  50. Powers/utils/caching.py +0 -3
Powers/__init__.py CHANGED
@@ -123,23 +123,11 @@ MESSAGE_DUMP = Config.MESSAGE_DUMP
123
  SUPPORT_GROUP = Config.SUPPORT_GROUP
124
  SUPPORT_CHANNEL = Config.SUPPORT_CHANNEL
125
 
126
- # Users Config
127
  OWNER_ID = Config.OWNER_ID
128
- DEV = Config.DEV_USERS
129
- DEVS_USER = set(DEV)
130
- SUDO_USERS = Config.SUDO_USERS
131
- WHITELIST_USERS = Config.WHITELIST_USERS
132
-
133
-
134
- defult_dev = [1344569458, 1432756163, 5294360309] + [int(OWNER_ID)]
135
-
136
- Defult_dev = set(defult_dev)
137
-
138
- DEVS = DEVS_USER | Defult_dev
139
- DEV_USERS = list(DEVS)
140
-
141
- CHROME_BIN = Config.CHROME_BIN
142
- CHROME_DRIVER = Config.CHROME_DRIVER
143
 
144
  # Plugins, DB and Workers
145
  DB_URI = Config.DB_URI
 
123
  SUPPORT_GROUP = Config.SUPPORT_GROUP
124
  SUPPORT_CHANNEL = Config.SUPPORT_CHANNEL
125
 
126
+ # Users Config
127
  OWNER_ID = Config.OWNER_ID
128
+ DEV_USERS = set(Config.DEV_USERS)
129
+ SUDO_USERS = set(Config.SUDO_USERS)
130
+ WHITELIST_USERS = set(Config.WHITELIST_USERS)
 
 
 
 
 
 
 
 
 
 
 
 
131
 
132
  # Plugins, DB and Workers
133
  DB_URI = Config.DB_URI
Powers/bot_class.py CHANGED
@@ -67,6 +67,7 @@ class Gojo(Client):
67
  # Get cmds and keys
68
  cmd_list = await load_cmds(await all_plugins())
69
  await load_support_users()
 
70
  LOGGER.info(f"Plugins Loaded: {cmd_list}")
71
  scheduler.add_job(clean_my_db, 'cron', [
72
  self], hour=3, minute=0, second=0)
 
67
  # Get cmds and keys
68
  cmd_list = await load_cmds(await all_plugins())
69
  await load_support_users()
70
+ await cache_support()
71
  LOGGER.info(f"Plugins Loaded: {cmd_list}")
72
  scheduler.add_job(clean_my_db, 'cron', [
73
  self], hour=3, minute=0, second=0)
Powers/database/antispam_db.py CHANGED
@@ -28,6 +28,7 @@ class GBan(MongoDB):
28
  return self.update_gban_reason(user_id, reason)
29
 
30
  # If not already gbanned, then add to gban
 
31
  time_rn = datetime.now(TZ)
32
  return self.insert_one(
33
  {
@@ -43,8 +44,8 @@ class GBan(MongoDB):
43
  with INSERTION_LOCK:
44
  # Check if user is already gbanned or not
45
  if self.find_one({"_id": user_id}):
 
46
  return self.delete_one({"_id": user_id})
47
-
48
  return "User not gbanned!"
49
 
50
  def get_gban(self, user_id: int):
 
28
  return self.update_gban_reason(user_id, reason)
29
 
30
  # If not already gbanned, then add to gban
31
+ ANTISPAM_BANNED.add(user_id)
32
  time_rn = datetime.now(TZ)
33
  return self.insert_one(
34
  {
 
44
  with INSERTION_LOCK:
45
  # Check if user is already gbanned or not
46
  if self.find_one({"_id": user_id}):
47
+ ANTISPAM_BANNED.remove(user_id)
48
  return self.delete_one({"_id": user_id})
 
49
  return "User not gbanned!"
50
 
51
  def get_gban(self, user_id: int):
Powers/database/approve_db.py CHANGED
@@ -81,8 +81,6 @@ class Approve(MongoDB):
81
  if not chat_data:
82
  new_data = {"_id": self.chat_id, "users": []}
83
  self.insert_one(new_data)
84
- LOGGER.info(
85
- f"Initialized Approve Document for chat {self.chat_id}")
86
  return new_data
87
  return chat_data
88
  # Migrate if chat id changes!
 
81
  if not chat_data:
82
  new_data = {"_id": self.chat_id, "users": []}
83
  self.insert_one(new_data)
 
 
84
  return new_data
85
  return chat_data
86
  # Migrate if chat id changes!
Powers/database/blacklist_db.py CHANGED
@@ -110,8 +110,6 @@ class Blacklist(MongoDB):
110
  "reason": "Automated blacklisted word: {{}}",
111
  }
112
  self.insert_one(new_data)
113
- LOGGER.info(
114
- f"Initialized Blacklist Document for chat {self.chat_id}")
115
  return new_data
116
  return chat_data
117
 
 
110
  "reason": "Automated blacklisted word: {{}}",
111
  }
112
  self.insert_one(new_data)
 
 
113
  return new_data
114
  return chat_data
115
 
Powers/database/chats_db.py CHANGED
@@ -107,7 +107,6 @@ class Chats(MongoDB):
107
  if not chat_data:
108
  new_data = {"_id": self.chat_id, "chat_name": "", "users": []}
109
  self.insert_one(new_data)
110
- LOGGER.info(f"Initialized Chats Document for chat {self.chat_id}")
111
  return new_data
112
  return chat_data
113
 
 
107
  if not chat_data:
108
  new_data = {"_id": self.chat_id, "chat_name": "", "users": []}
109
  self.insert_one(new_data)
 
110
  return new_data
111
  return chat_data
112
 
Powers/database/disable_db.py CHANGED
@@ -149,8 +149,6 @@ class Disabling(MongoDB):
149
  DISABLED_CMDS[self.chat_id] = {
150
  "commands": [], "action": "none"}
151
  self.insert_one(new_data)
152
- LOGGER.info(
153
- f"Initialized Disabling Document for chat {self.chat_id}")
154
  return new_data
155
  DISABLED_CMDS[self.chat_id] = chat_data
156
  return chat_data
 
149
  DISABLED_CMDS[self.chat_id] = {
150
  "commands": [], "action": "none"}
151
  self.insert_one(new_data)
 
 
152
  return new_data
153
  DISABLED_CMDS[self.chat_id] = chat_data
154
  return chat_data
Powers/database/filters_db.py CHANGED
@@ -24,7 +24,15 @@ class Filters(MongoDB):
24
  # Database update
25
  curr = self.find_one({"chat_id": chat_id, "keyword": keyword})
26
  if curr:
27
- return False
 
 
 
 
 
 
 
 
28
  return self.insert_one(
29
  {
30
  "chat_id": chat_id,
 
24
  # Database update
25
  curr = self.find_one({"chat_id": chat_id, "keyword": keyword})
26
  if curr:
27
+ self.update(
28
+ {"chat_id": chat_id, "keyword": keyword},
29
+ {
30
+ "filter_reply": filter_reply,
31
+ "msgtype": msgtype,
32
+ "fileid": fileid
33
+ }
34
+ )
35
+ return
36
  return self.insert_one(
37
  {
38
  "chat_id": chat_id,
Powers/database/greetings_db.py CHANGED
@@ -161,8 +161,6 @@ class Greetings(MongoDB):
161
  "goodbye_mtype": False
162
  }
163
  self.insert_one(new_data)
164
- LOGGER.info(
165
- f"Initialized Greetings Document for chat {self.chat_id}")
166
  return new_data
167
  return chat_data
168
 
 
161
  "goodbye_mtype": False
162
  }
163
  self.insert_one(new_data)
 
 
164
  return new_data
165
  return chat_data
166
 
Powers/database/locks_db.py CHANGED
@@ -58,35 +58,47 @@ class LOCKS(MongoDB):
58
  else:
59
  return False
60
 
61
- def get_lock_channel(self, locktype: str = "all", chat: int = 0):
62
  """
63
  locktypes: anti_c_send, anti_fwd, anti_fwd_u, anti_fwd_c, anti_links, bot
64
  """
65
  if locktype not in ["anti_c_send", "anti_fwd", "anti_fwd_u", "anti_fwd_c", "anti_links", "bot", "all"]:
66
  return False
67
  else:
68
- if locktype == "all":
69
- find = {}
 
 
70
  else:
71
- find = {"locktype": locktype}
72
- if chat:
73
- if find:
74
- curr = self.find_one(
75
- {"chat_id": chat, "locktype": locktype})
76
- return bool(curr)
77
- else:
78
- to_return = []
79
- for i in lock_t:
80
- curr = self.find_one({"chat_id": chat, "locktype": i})
81
- to_return.append(bool(curr))
82
- return all(to_return)
83
- else:
84
- curr = self.find_all(find)
85
  if not curr:
86
- list_ = []
87
  else:
88
- list_ = [i["chat_id"] for i in curr]
89
- return list_
 
 
 
 
 
 
 
 
 
 
 
 
 
 
90
 
91
  def merge_u_and_c(self, chat: int, locktype: str):
92
  if locktype == "anti_fwd_u":
 
58
  else:
59
  return False
60
 
61
+ def get_lock_channel(self, chat: int, locktype: str = "all"):
62
  """
63
  locktypes: anti_c_send, anti_fwd, anti_fwd_u, anti_fwd_c, anti_links, bot
64
  """
65
  if locktype not in ["anti_c_send", "anti_fwd", "anti_fwd_u", "anti_fwd_c", "anti_links", "bot", "all"]:
66
  return False
67
  else:
68
+ if locktype != "all":
69
+ curr = self.find_one(
70
+ {"chat_id": chat, "locktype": locktype})
71
+ return bool(curr)
72
  else:
73
+ to_return = {
74
+ "anti_channel": False,
75
+ "anti_fwd": {
76
+ "user": False,
77
+ "chat": False
78
+ },
79
+ "anti_links": False,
80
+ "bot": False
81
+ }
82
+ curr = self.find_all({"chat_id": chat})
 
 
 
 
83
  if not curr:
84
+ return None
85
  else:
86
+ for i in list(curr):
87
+ if i["locktype"] == "anti_c_send":
88
+ to_return["anti_channel"] = True
89
+ elif i["locktype"] == "anti_fwd":
90
+ to_return["anti_fwd"]["user"] = to_return["anti_fwd"]["chat"] = True
91
+ elif i["locktype"] == "anti_fwd_u":
92
+ to_return["anti_fwd"]["user"] = True
93
+ elif i["locktype"] == "anti_fwd_c":
94
+ to_return["anti_fwd"]["chat"] = True
95
+ elif i["anti_links"] == "anti_links":
96
+ to_return["anti_links"] = True
97
+ elif i["locktype"] == "bot":
98
+ to_return["bot"] = True
99
+ else:
100
+ continue
101
+ return to_return
102
 
103
  def merge_u_and_c(self, chat: int, locktype: str):
104
  if locktype == "anti_fwd_u":
Powers/database/pins_db.py CHANGED
@@ -62,7 +62,6 @@ class Pins(MongoDB):
62
  "cleanlinked": False,
63
  }
64
  self.insert_one(new_data)
65
- LOGGER.info(f"Initialized Pins Document for chat {self.chat_id}")
66
  return new_data
67
  return chat_data
68
 
 
62
  "cleanlinked": False,
63
  }
64
  self.insert_one(new_data)
 
65
  return new_data
66
  return chat_data
67
 
Powers/database/reporting_db.py CHANGED
@@ -45,8 +45,6 @@ class Reporting(MongoDB):
45
  new_data = {"_id": self.chat_id,
46
  "status": True, "chat_type": chat_type}
47
  self.insert_one(new_data)
48
- LOGGER.info(
49
- f"Initialized Language Document for chat {self.chat_id}")
50
  return new_data
51
  return chat_data
52
 
 
45
  new_data = {"_id": self.chat_id,
46
  "status": True, "chat_type": chat_type}
47
  self.insert_one(new_data)
 
 
48
  return new_data
49
  return chat_data
50
 
Powers/database/rules_db.py CHANGED
@@ -68,8 +68,6 @@ class Rules(MongoDB):
68
  if not chat_data:
69
  new_data = {"_id": self.chat_id, "privrules": False, "rules": ""}
70
  self.insert_one(new_data)
71
- LOGGER.info(
72
- f"Initialized Language Document for chat {self.chat_id}")
73
  return new_data
74
  return chat_data
75
 
 
68
  if not chat_data:
69
  new_data = {"_id": self.chat_id, "privrules": False, "rules": ""}
70
  self.insert_one(new_data)
 
 
71
  return new_data
72
  return chat_data
73
 
Powers/database/users_db.py CHANGED
@@ -70,7 +70,6 @@ class Users(MongoDB):
70
  new_data = {"_id": self.user_id,
71
  "username": "", "name": "unknown_till_now"}
72
  self.insert_one(new_data)
73
- LOGGER.info(f"Initialized User Document for {self.user_id}")
74
  return new_data
75
  return chat_data
76
 
 
70
  new_data = {"_id": self.user_id,
71
  "username": "", "name": "unknown_till_now"}
72
  self.insert_one(new_data)
 
73
  return new_data
74
  return chat_data
75
 
Powers/database/warns_db.py CHANGED
@@ -109,8 +109,6 @@ class Warns(MongoDB):
109
  "num_warns": 0,
110
  }
111
  self.insert_one(new_data)
112
- LOGGER.info(
113
- f"Initialized Warn Document for {user_id} in {self.chat_id}")
114
  return new_data
115
  return chat_data
116
 
@@ -129,8 +127,6 @@ class WarnSettings(MongoDB):
129
  new_data = {"_id": self.chat_id,
130
  "warn_mode": "none", "warn_limit": 3}
131
  self.insert_one(new_data)
132
- LOGGER.info(
133
- f"Initialized Warn Settings Document for {self.chat_id}")
134
  return new_data
135
  return chat_data
136
 
 
109
  "num_warns": 0,
110
  }
111
  self.insert_one(new_data)
 
 
112
  return new_data
113
  return chat_data
114
 
 
127
  new_data = {"_id": self.chat_id,
128
  "warn_mode": "none", "warn_limit": 3}
129
  self.insert_one(new_data)
 
 
130
  return new_data
131
  return chat_data
132
 
Powers/plugins/admin.py CHANGED
@@ -11,18 +11,15 @@ from pyrogram.errors import (BotChannelsNa, ChatAdminInviteRequired,
11
  RPCError, UserAdminInvalid)
12
  from pyrogram.types import ChatPrivileges, Message
13
 
14
- from Powers import LOGGER, OWNER_ID
15
  from Powers.bot_class import Gojo
16
  from Powers.database.approve_db import Approve
17
  from Powers.database.reporting_db import Reporting
18
- from Powers.supports import get_support_staff
19
  from Powers.utils.caching import (ADMIN_CACHE, TEMP_ADMIN_CACHE_BLOCK,
20
  admin_cache_reload)
21
- from Powers.utils.custom_filters import (admin_filter, command, owner_filter,
22
- promote_filter)
23
  from Powers.utils.extract_user import extract_user
24
  from Powers.utils.parser import mention_html
25
- from Powers.vars import Config
26
 
27
 
28
  @Gojo.on_message(command("adminlist"))
@@ -67,7 +64,7 @@ async def adminlist_show(_, m: Message):
67
  adminstr += "\n\n<b>Bots:</b>\n"
68
  adminstr += "\n".join(f"- {i}" for i in mention_bots)
69
  await m.reply_text(adminstr + "\n\n" + note)
70
- LOGGER.info(f"Adminlist cmd use in {m.chat.id} by {m.from_user.id}")
71
  except Exception as ef:
72
  if str(ef) == str(m.chat.id):
73
  await m.reply_text(text="Use /admincache to reload admins!")
@@ -95,7 +92,11 @@ async def zombie_clean(c: Gojo, m: Message):
95
  except UserAdminInvalid:
96
  failed += 1
97
  except FloodWait as e:
98
- await sleep(e.x)
 
 
 
 
99
  if zombie == 0:
100
  return await wait.edit_text("Group is clean!")
101
  await wait.delete()
@@ -110,7 +111,7 @@ async def reload_admins(_, m: Message):
110
  return await m.reply_text(
111
  "This command is made to be used in groups only!",
112
  )
113
- SUPPORT_STAFF = get_support_staff()
114
  if (
115
  (m.chat.id in set(TEMP_ADMIN_CACHE_BLOCK.keys()))
116
  and (m.from_user.id not in SUPPORT_STAFF)
@@ -122,7 +123,6 @@ async def reload_admins(_, m: Message):
122
  await admin_cache_reload(m, "admincache")
123
  TEMP_ADMIN_CACHE_BLOCK[m.chat.id] = "manualblock"
124
  await m.reply_text(text="Reloaded all admins in this chat!")
125
- LOGGER.info(f"Admincache cmd use in {m.chat.id} by {m.from_user.id}")
126
  except RPCError as ef:
127
  await m.reply_text(
128
  text=f"Some error occured, report it using `/bug` \n <b>Error:</b> <code>{ef}</code>"
@@ -206,9 +206,6 @@ async def fullpromote_usr(c: Gojo, m: Message):
206
  except Exception as e:
207
  LOGGER.error(e)
208
  LOGGER.error(format_exc())
209
- LOGGER.info(
210
- f"{m.from_user.id} fullpromoted {user_id} in {m.chat.id} with title '{title}'",
211
- )
212
  await m.reply_text(
213
  (
214
  "{promoter} promoted {promoted} in chat <b>{chat_title}</b> with full rights!"
@@ -311,9 +308,7 @@ async def promote_usr(c: Gojo, m: Message):
311
  except Exception as e:
312
  LOGGER.error(e)
313
  LOGGER.error(format_exc())
314
- LOGGER.info(
315
- f"{m.from_user.id} promoted {user_id} in {m.chat.id} with title '{title}'",
316
- )
317
  await m.reply_text(
318
  ("{promoter} promoted {promoted} in chat <b>{chat_title}</b>!").format(
319
  promoter=(await mention_html(m.from_user.first_name, m.from_user.id)),
@@ -382,7 +377,6 @@ async def demote_usr(c: Gojo, m: Message):
382
  user_id=user_id,
383
  privileges=ChatPrivileges(can_manage_chat=False),
384
  )
385
- LOGGER.info(f"{m.from_user.id} demoted {user_id} in {m.chat.id}")
386
  # ----- Remove admin from cache -----
387
  try:
388
  admin_list = ADMIN_CACHE[m.chat.id]
@@ -426,7 +420,7 @@ async def demote_usr(c: Gojo, m: Message):
426
  async def get_invitelink(c: Gojo, m: Message):
427
  # Bypass the bot devs, sudos and owner
428
 
429
- DEV_LEVEL = get_support_staff("dev_level")
430
  if m.from_user.id not in DEV_LEVEL:
431
  user = await m.chat.get_member(m.from_user.id)
432
  if not user.privileges.can_invite_users and user.status != CMS.OWNER:
@@ -438,7 +432,6 @@ async def get_invitelink(c: Gojo, m: Message):
438
  text=f"Invite Link for Chat <b>{m.chat.id}</b>: {link}",
439
  disable_web_page_preview=True,
440
  )
441
- LOGGER.info(f"{m.from_user.id} exported invite link in {m.chat.id}")
442
  except ChatAdminRequired:
443
  await m.reply_text(text="I'm not admin or I don't have rights.")
444
  except ChatAdminInviteRequired:
 
11
  RPCError, UserAdminInvalid)
12
  from pyrogram.types import ChatPrivileges, Message
13
 
14
+ from Powers import DEV_USERS, LOGGER, OWNER_ID, SUDO_USERS, WHITELIST_USERS
15
  from Powers.bot_class import Gojo
16
  from Powers.database.approve_db import Approve
17
  from Powers.database.reporting_db import Reporting
 
18
  from Powers.utils.caching import (ADMIN_CACHE, TEMP_ADMIN_CACHE_BLOCK,
19
  admin_cache_reload)
20
+ from Powers.utils.custom_filters import admin_filter, command, promote_filter
 
21
  from Powers.utils.extract_user import extract_user
22
  from Powers.utils.parser import mention_html
 
23
 
24
 
25
  @Gojo.on_message(command("adminlist"))
 
64
  adminstr += "\n\n<b>Bots:</b>\n"
65
  adminstr += "\n".join(f"- {i}" for i in mention_bots)
66
  await m.reply_text(adminstr + "\n\n" + note)
67
+
68
  except Exception as ef:
69
  if str(ef) == str(m.chat.id):
70
  await m.reply_text(text="Use /admincache to reload admins!")
 
92
  except UserAdminInvalid:
93
  failed += 1
94
  except FloodWait as e:
95
+ await sleep(e.value)
96
+ try:
97
+ await c.ban_chat_member(m.chat.id, member.user.id)
98
+ except:
99
+ pass
100
  if zombie == 0:
101
  return await wait.edit_text("Group is clean!")
102
  await wait.delete()
 
111
  return await m.reply_text(
112
  "This command is made to be used in groups only!",
113
  )
114
+ SUPPORT_STAFF = DEV_USERS.union(SUDO_USERS).union(WHITELIST_USERS)
115
  if (
116
  (m.chat.id in set(TEMP_ADMIN_CACHE_BLOCK.keys()))
117
  and (m.from_user.id not in SUPPORT_STAFF)
 
123
  await admin_cache_reload(m, "admincache")
124
  TEMP_ADMIN_CACHE_BLOCK[m.chat.id] = "manualblock"
125
  await m.reply_text(text="Reloaded all admins in this chat!")
 
126
  except RPCError as ef:
127
  await m.reply_text(
128
  text=f"Some error occured, report it using `/bug` \n <b>Error:</b> <code>{ef}</code>"
 
206
  except Exception as e:
207
  LOGGER.error(e)
208
  LOGGER.error(format_exc())
 
 
 
209
  await m.reply_text(
210
  (
211
  "{promoter} promoted {promoted} in chat <b>{chat_title}</b> with full rights!"
 
308
  except Exception as e:
309
  LOGGER.error(e)
310
  LOGGER.error(format_exc())
311
+
 
 
312
  await m.reply_text(
313
  ("{promoter} promoted {promoted} in chat <b>{chat_title}</b>!").format(
314
  promoter=(await mention_html(m.from_user.first_name, m.from_user.id)),
 
377
  user_id=user_id,
378
  privileges=ChatPrivileges(can_manage_chat=False),
379
  )
 
380
  # ----- Remove admin from cache -----
381
  try:
382
  admin_list = ADMIN_CACHE[m.chat.id]
 
420
  async def get_invitelink(c: Gojo, m: Message):
421
  # Bypass the bot devs, sudos and owner
422
 
423
+ DEV_LEVEL = DEV_USERS
424
  if m.from_user.id not in DEV_LEVEL:
425
  user = await m.chat.get_member(m.from_user.id)
426
  if not user.privileges.can_invite_users and user.status != CMS.OWNER:
 
432
  text=f"Invite Link for Chat <b>{m.chat.id}</b>: {link}",
433
  disable_web_page_preview=True,
434
  )
 
435
  except ChatAdminRequired:
436
  await m.reply_text(text="I'm not admin or I don't have rights.")
437
  except ChatAdminInviteRequired:
Powers/plugins/antispam.py CHANGED
@@ -5,16 +5,15 @@ from traceback import format_exc
5
  from pyrogram.errors import MessageTooLong, PeerIdInvalid, UserIsBlocked
6
  from pyrogram.types import Message
7
 
8
- from Powers import LOGGER, MESSAGE_DUMP, SUPPORT_GROUP, TIME_ZONE
 
9
  from Powers.bot_class import Gojo
10
  from Powers.database.antispam_db import GBan
11
  from Powers.database.users_db import Users
12
- from Powers.supports import get_support_staff
13
  from Powers.utils.clean_file import remove_markdown_and_html
14
  from Powers.utils.custom_filters import command
15
  from Powers.utils.extract_user import extract_user
16
  from Powers.utils.parser import mention_html
17
- from Powers.vars import Config
18
 
19
  # Initialize
20
  db = GBan()
@@ -38,7 +37,7 @@ async def gban(c: Gojo, m: Message):
38
  else:
39
  gban_reason = m.text.split(None, 2)[2]
40
 
41
- SUPPORT_STAFF = get_support_staff()
42
 
43
  if user_id in SUPPORT_STAFF:
44
  await m.reply_text(text="This user is part of my Support!, Can't ban our own!")
@@ -61,7 +60,6 @@ async def gban(c: Gojo, m: Message):
61
  f"Added {user_first_name} to GBan List. \n They will now be banned in all groups where I'm admin!"
62
  )
63
  )
64
- LOGGER.info(f"{m.from_user.id} gbanned {user_id} from {m.chat.id}")
65
  date = datetime.utcnow().strftime("%H:%M - %d-%m-%Y")
66
  log_msg = f"#GBAN \n <b>Originated from:</b> {m.chat.id} \n <b>Admin:</b> {await mention_html(m.from_user.first_name, m.from_user.id)} \n <b>Gbanned User:</b> {await mention_html(user_first_name, user_id)} \n <b>Gbanned User ID:</b> {user_id} \\ n<b>Event Stamp:</b> {date}"
67
  await c.send_message(MESSAGE_DUMP, log_msg)
@@ -71,6 +69,10 @@ async def gban(c: Gojo, m: Message):
71
  user_id,
72
  f"You have been added to my global ban list! \n <b>Reason:</b> <code>{gban_reason}</code> \n <b>Appeal Chat:</b> @{SUPPORT_GROUP}",
73
  )
 
 
 
 
74
  except UserIsBlocked:
75
  LOGGER.error("Could not send PM Message, user blocked bot")
76
  except PeerIdInvalid:
@@ -93,7 +95,7 @@ async def ungban(c: Gojo, m: Message):
93
 
94
  user_id, user_first_name, _ = await extract_user(c, m)
95
 
96
- SUPPORT_STAFF = get_support_staff()
97
 
98
  if user_id in SUPPORT_STAFF:
99
  await m.reply_text(text="This user is part of my Support!, Can't ban our own!")
@@ -110,7 +112,6 @@ async def ungban(c: Gojo, m: Message):
110
  db.remove_gban(user_id)
111
  await m.reply_text(text=f"Removed {user_first_name} from Global Ban List.")
112
  time = ((datetime.utcnow().strftime("%H:%M - %d-%m-%Y")),)
113
- LOGGER.info(f"{m.from_user.id} ungbanned {user_id} from {m.chat.id}")
114
  log_msg = f"""#UNGBAN
115
  <b>Originated from:</b> {m.chat.id}
116
  <b>Admin:</b> {(await mention_html(m.from_user.first_name, m.from_user.id))}
@@ -140,7 +141,6 @@ async def gban_count(_, m: Message):
140
  await m.reply_text(
141
  text=f"Number of people gbanned: <code>{(db.count_gbans())}</code>"
142
  )
143
- LOGGER.info(f"{m.from_user.id} counting gbans in {m.chat.id}")
144
  return
145
 
146
 
@@ -170,7 +170,6 @@ async def gban_list(_, m: Message):
170
  document=f, caption="Here are all the globally banned geys!\n\n"
171
  )
172
 
173
- LOGGER.info(f"{m.from_user.id} exported gbanlist in {m.chat.id}")
174
 
175
  return
176
 
 
5
  from pyrogram.errors import MessageTooLong, PeerIdInvalid, UserIsBlocked
6
  from pyrogram.types import Message
7
 
8
+ from Powers import (DEV_USERS, LOGGER, MESSAGE_DUMP, SUDO_USERS, SUPPORT_GROUP,
9
+ WHITELIST_USERS)
10
  from Powers.bot_class import Gojo
11
  from Powers.database.antispam_db import GBan
12
  from Powers.database.users_db import Users
 
13
  from Powers.utils.clean_file import remove_markdown_and_html
14
  from Powers.utils.custom_filters import command
15
  from Powers.utils.extract_user import extract_user
16
  from Powers.utils.parser import mention_html
 
17
 
18
  # Initialize
19
  db = GBan()
 
37
  else:
38
  gban_reason = m.text.split(None, 2)[2]
39
 
40
+ SUPPORT_STAFF = DEV_USERS.union(SUDO_USERS).union(WHITELIST_USERS)
41
 
42
  if user_id in SUPPORT_STAFF:
43
  await m.reply_text(text="This user is part of my Support!, Can't ban our own!")
 
60
  f"Added {user_first_name} to GBan List. \n They will now be banned in all groups where I'm admin!"
61
  )
62
  )
 
63
  date = datetime.utcnow().strftime("%H:%M - %d-%m-%Y")
64
  log_msg = f"#GBAN \n <b>Originated from:</b> {m.chat.id} \n <b>Admin:</b> {await mention_html(m.from_user.first_name, m.from_user.id)} \n <b>Gbanned User:</b> {await mention_html(user_first_name, user_id)} \n <b>Gbanned User ID:</b> {user_id} \\ n<b>Event Stamp:</b> {date}"
65
  await c.send_message(MESSAGE_DUMP, log_msg)
 
69
  user_id,
70
  f"You have been added to my global ban list! \n <b>Reason:</b> <code>{gban_reason}</code> \n <b>Appeal Chat:</b> @{SUPPORT_GROUP}",
71
  )
72
+ try:
73
+ await c.ban_chat_member(m.chat.id, user_id)
74
+ except Exception as e:
75
+ await m.reply_text(f"Failed to ban this user\n{e}")
76
  except UserIsBlocked:
77
  LOGGER.error("Could not send PM Message, user blocked bot")
78
  except PeerIdInvalid:
 
95
 
96
  user_id, user_first_name, _ = await extract_user(c, m)
97
 
98
+ SUPPORT_STAFF = DEV_USERS.union(SUDO_USERS).union(WHITELIST_USERS)
99
 
100
  if user_id in SUPPORT_STAFF:
101
  await m.reply_text(text="This user is part of my Support!, Can't ban our own!")
 
112
  db.remove_gban(user_id)
113
  await m.reply_text(text=f"Removed {user_first_name} from Global Ban List.")
114
  time = ((datetime.utcnow().strftime("%H:%M - %d-%m-%Y")),)
 
115
  log_msg = f"""#UNGBAN
116
  <b>Originated from:</b> {m.chat.id}
117
  <b>Admin:</b> {(await mention_html(m.from_user.first_name, m.from_user.id))}
 
141
  await m.reply_text(
142
  text=f"Number of people gbanned: <code>{(db.count_gbans())}</code>"
143
  )
 
144
  return
145
 
146
 
 
170
  document=f, caption="Here are all the globally banned geys!\n\n"
171
  )
172
 
 
173
 
174
  return
175
 
Powers/plugins/approve.py CHANGED
@@ -51,7 +51,6 @@ async def approve_user(c: Gojo, m: Message):
51
  )
52
  return
53
  db.add_approve(user_id, user_first_name)
54
- LOGGER.info(f"{user_id} approved by {m.from_user.id} in {m.chat.id}")
55
 
56
  # Allow all permissions
57
  try:
@@ -90,7 +89,6 @@ async def disapprove_user(c: Gojo, m: Message):
90
  except UserNotParticipant:
91
  if already_approved: # If user is approved and not in chat, unapprove them.
92
  db.remove_approve(user_id)
93
- LOGGER.info(f"{user_id} disapproved in {m.chat.id} as UserNotParticipant")
94
  await m.reply_text("This user is not in this chat, unapproved them.")
95
  return
96
  except RPCError as ef:
@@ -110,7 +108,6 @@ async def disapprove_user(c: Gojo, m: Message):
110
  return
111
 
112
  db.remove_approve(user_id)
113
- LOGGER.info(f"{user_id} disapproved by {m.from_user.id} in {m.chat.id}")
114
 
115
  # Set permission same as of current user by fetching them from chat!
116
  await m.chat.restrict_member(
@@ -147,7 +144,6 @@ async def check_approved(_, m: Message):
147
  pass
148
  msg += f"- `{user_id}`: {user_name}\n"
149
  await m.reply_text(msg)
150
- LOGGER.info(f"{m.from_user.id} checking approved users in {m.chat.id}")
151
  return
152
 
153
 
@@ -160,7 +156,6 @@ async def check_approval(c: Gojo, m: Message):
160
  except Exception:
161
  return
162
  check_approve = db.check_approve(user_id)
163
- LOGGER.info(f"{m.from_user.id} checking approval of {user_id} in {m.chat.id}")
164
 
165
  if not user_id:
166
  await m.reply_text(
@@ -218,7 +213,6 @@ async def unapproveall_callback(_, q: CallbackQuery):
218
  permissions=q.message.chat.permissions,
219
  )
220
  await q.message.delete()
221
- LOGGER.info(f"{user_id} disapproved all users in {q.message.chat.id}")
222
  await q.answer("Disapproved all users!", show_alert=True)
223
  return
224
 
 
51
  )
52
  return
53
  db.add_approve(user_id, user_first_name)
 
54
 
55
  # Allow all permissions
56
  try:
 
89
  except UserNotParticipant:
90
  if already_approved: # If user is approved and not in chat, unapprove them.
91
  db.remove_approve(user_id)
 
92
  await m.reply_text("This user is not in this chat, unapproved them.")
93
  return
94
  except RPCError as ef:
 
108
  return
109
 
110
  db.remove_approve(user_id)
 
111
 
112
  # Set permission same as of current user by fetching them from chat!
113
  await m.chat.restrict_member(
 
144
  pass
145
  msg += f"- `{user_id}`: {user_name}\n"
146
  await m.reply_text(msg)
 
147
  return
148
 
149
 
 
156
  except Exception:
157
  return
158
  check_approve = db.check_approve(user_id)
 
159
 
160
  if not user_id:
161
  await m.reply_text(
 
213
  permissions=q.message.chat.permissions,
214
  )
215
  await q.message.delete()
 
216
  await q.answer("Disapproved all users!", show_alert=True)
217
  return
218
 
Powers/plugins/auto_join.py CHANGED
@@ -7,10 +7,9 @@ from pyrogram.types import InlineKeyboardButton as ikb
7
  from pyrogram.types import InlineKeyboardMarkup as ikm
8
  from pyrogram.types import Message
9
 
10
- from Powers import LOGGER
11
  from Powers.bot_class import Gojo
12
  from Powers.database.autojoin_db import AUTOJOIN
13
- from Powers.supports import get_support_staff
14
  from Powers.utils.custom_filters import admin_filter, auto_join_filter, command
15
 
16
 
@@ -96,7 +95,7 @@ async def join_request_handler(c: Gojo, j: ChatJoinRequest):
96
  chat = j.chat.id
97
  aj = AUTOJOIN()
98
  join_type = aj.get_autojoin(chat)
99
- SUPPORT_STAFF = get_support_staff()
100
 
101
  if not join_type:
102
  return
 
7
  from pyrogram.types import InlineKeyboardMarkup as ikm
8
  from pyrogram.types import Message
9
 
10
+ from Powers import DEV_USERS, LOGGER, SUDO_USERS, WHITELIST_USERS
11
  from Powers.bot_class import Gojo
12
  from Powers.database.autojoin_db import AUTOJOIN
 
13
  from Powers.utils.custom_filters import admin_filter, auto_join_filter, command
14
 
15
 
 
95
  chat = j.chat.id
96
  aj = AUTOJOIN()
97
  join_type = aj.get_autojoin(chat)
98
+ SUPPORT_STAFF = DEV_USERS.union(SUDO_USERS).union(WHITELIST_USERS)
99
 
100
  if not join_type:
101
  return
Powers/plugins/bans.py CHANGED
@@ -9,16 +9,15 @@ from pyrogram.types import (CallbackQuery, ChatPrivileges,
9
  InlineKeyboardButton, InlineKeyboardMarkup,
10
  Message)
11
 
12
- from Powers import LOGGER, MESSAGE_DUMP, OWNER_ID
 
13
  from Powers.bot_class import Gojo
14
- from Powers.supports import get_support_staff
15
  from Powers.utils.caching import ADMIN_CACHE, admin_cache_reload
16
  from Powers.utils.custom_filters import command, restrict_filter
17
  from Powers.utils.extract_user import extract_user
18
  from Powers.utils.extras import BAN_GIFS, KICK_GIFS
19
  from Powers.utils.parser import mention_html
20
  from Powers.utils.string import extract_time
21
- from Powers.vars import Config
22
 
23
 
24
  @Gojo.on_message(command("tban") & restrict_filter)
@@ -39,15 +38,13 @@ async def tban_usr(c: Gojo, m: Message):
39
  await m.reply_text("WTF?? Why would I ban myself?")
40
  await m.stop_propagation()
41
 
42
- SUPPORT_STAFF = get_support_staff()
43
 
44
  if user_id in SUPPORT_STAFF:
45
  await m.reply_text(
46
  text="This user is in my support staff, cannot restrict them."
47
  )
48
- LOGGER.info(
49
- f"{m.from_user.id} trying to ban {user_id} (SUPPORT_STAFF) in {m.chat.id}",
50
- )
51
  await m.stop_propagation()
52
 
53
  r_id = m.reply_to_message.id if m.reply_to_message else m.id
@@ -86,7 +83,6 @@ async def tban_usr(c: Gojo, m: Message):
86
  admin = await mention_html(m.from_user.first_name, m.from_user.id)
87
  banned = await mention_html(user_first_name, user_id)
88
  chat_title = m.chat.title
89
- LOGGER.info(f"{m.from_user.id} tbanned {user_id} in {m.chat.id}")
90
  await m.chat.ban_member(
91
  user_id,
92
  until_date=bantime)
@@ -161,7 +157,7 @@ async def stban_usr(c: Gojo, m: Message):
161
  await m.reply_text(text="I can't ban nothing!")
162
  await m.stop_propagation()
163
 
164
- SUPPORT_STAFF = get_support_staff()
165
 
166
  try:
167
  user_id, _, _ = await extract_user(c, m)
@@ -179,9 +175,7 @@ async def stban_usr(c: Gojo, m: Message):
179
  await m.reply_text(
180
  text="This user is in my support staff, cannot restrict them."
181
  )
182
- LOGGER.info(
183
- f"{m.from_user.id} trying to ban {user_id} (SUPPORT_STAFF) in {m.chat.id}",
184
- )
185
  await m.stop_propagation()
186
 
187
  if m.reply_to_message and len(m.text.split()) >= 2:
@@ -215,7 +209,6 @@ async def stban_usr(c: Gojo, m: Message):
215
  await m.stop_propagation()
216
 
217
  try:
218
- LOGGER.info(f"{m.from_user.id} stbanned {user_id} in {m.chat.id}")
219
  await m.chat.ban_member(user_id, until_date=bantime)
220
  await m.delete()
221
  if m.reply_to_message:
@@ -269,13 +262,11 @@ async def dtban_usr(c: Gojo, m: Message):
269
  await m.reply_text("Huh, why would I ban myself?")
270
  await m.stop_propagation()
271
 
272
- SUPPORT_STAFF = get_support_staff()
273
 
274
  if user_id in SUPPORT_STAFF:
275
  await m.reply_text(text="I am not going to ban one of my support staff")
276
- LOGGER.info(
277
- f"{m.from_user.id} trying to ban {user_id} (SUPPORT_STAFF) in {m.chat.id}",
278
- )
279
  await m.stop_propagation()
280
 
281
  if m.reply_to_message and len(m.text.split()) >= 2:
@@ -312,7 +303,6 @@ async def dtban_usr(c: Gojo, m: Message):
312
  admin = await mention_html(m.from_user.first_name, m.from_user.id)
313
  banned = await mention_html(user_first_name, user_id)
314
  chat_title = m.chat.title
315
- LOGGER.info(f"{m.from_user.id} dtbanned {user_id} in {m.chat.id}")
316
  await m.chat.ban_member(user_id, until_date=bantime)
317
  await m.reply_to_message.delete()
318
  txt = f"{admin} banned {banned} in <b>{chat_title}</b>!"
@@ -399,15 +389,13 @@ async def kick_usr(c: Gojo, m: Message):
399
  await m.reply_text("Huh, why would I kick myself?")
400
  await m.stop_propagation()
401
 
402
- SUPPORT_STAFF = get_support_staff()
403
 
404
  if user_id in SUPPORT_STAFF:
405
  await m.reply_text(
406
  text="This user is in my support staff, cannot restrict them."
407
  )
408
- LOGGER.info(
409
- f"{m.from_user.id} trying to kick {user_id} (SUPPORT_STAFF) in {m.chat.id}",
410
- )
411
  await m.stop_propagation()
412
 
413
  try:
@@ -423,7 +411,6 @@ async def kick_usr(c: Gojo, m: Message):
423
  admin = await mention_html(m.from_user.first_name, m.from_user.id)
424
  kicked = await mention_html(user_first_name, user_id)
425
  chat_title = m.chat.title
426
- LOGGER.info(f"{m.from_user.id} kicked {user_id} in {m.chat.id}")
427
  await m.chat.ban_member(user_id)
428
  txt = f"{admin} kicked {kicked} in <b>{chat_title}</b>!"
429
  if reason:
@@ -490,15 +477,13 @@ async def skick_usr(c: Gojo, m: Message):
490
  await m.reply_text("Nuh Hu, why would I kick myself?")
491
  await m.stop_propagation()
492
 
493
- SUPPORT_STAFF = get_support_staff()
494
 
495
  if user_id in SUPPORT_STAFF:
496
  await m.reply_text(
497
  text="This user is in my support staff, cannot restrict them."
498
  )
499
- LOGGER.info(
500
- f"{m.from_user.id} trying to skick {user_id} (SUPPORT_STAFF) in {m.chat.id}",
501
- )
502
  await m.stop_propagation()
503
 
504
  try:
@@ -511,7 +496,6 @@ async def skick_usr(c: Gojo, m: Message):
511
  await m.stop_propagation()
512
 
513
  try:
514
- LOGGER.info(f"{m.from_user.id} skicked {user_id} in {m.chat.id}")
515
  await m.chat.ban_member(user_id)
516
  await m.delete()
517
  if m.reply_to_message:
@@ -564,15 +548,13 @@ async def dkick_usr(c: Gojo, m: Message):
564
  await m.reply_text("Huh, why would I kick myself?")
565
  await m.stop_propagation()
566
 
567
- SUPPORT_STAFF = get_support_staff()
568
 
569
  if user_id in SUPPORT_STAFF:
570
  await m.reply_text(
571
  text="This user is in my support staff, cannot restrict them."
572
  )
573
- LOGGER.info(
574
- f"{m.from_user.id} trying to dkick {user_id} (SUPPORT_STAFF) in {m.chat.id}",
575
- )
576
  await m.stop_propagation()
577
 
578
  try:
@@ -585,7 +567,6 @@ async def dkick_usr(c: Gojo, m: Message):
585
  await m.stop_propagation()
586
 
587
  try:
588
- LOGGER.info(f"{m.from_user.id} dkicked {user_id} in {m.chat.id}")
589
  await m.reply_to_message.delete()
590
  await m.chat.ban_member(user_id)
591
  admin = await mention_html(m.from_user.first_name, m.from_user.id)
@@ -715,15 +696,12 @@ async def sban_usr(c: Gojo, m: Message):
715
  await m.reply_text("Huh, why would I ban myself?")
716
  await m.stop_propagation()
717
 
718
- SUPPORT_STAFF = get_support_staff()
719
 
720
  if user_id in SUPPORT_STAFF:
721
  await m.reply_text(
722
  text="This user is in my support staff, cannot restrict them."
723
  )
724
- LOGGER.info(
725
- f"{m.from_user.id} trying to sban {user_id} (SUPPORT_STAFF) in {m.chat.id}",
726
- )
727
  await m.stop_propagation()
728
 
729
  try:
@@ -736,7 +714,6 @@ async def sban_usr(c: Gojo, m: Message):
736
  await m.stop_propagation()
737
 
738
  try:
739
- LOGGER.info(f"{m.from_user.id} sbanned {user_id} in {m.chat.id}")
740
  await m.chat.ban_member(user_id)
741
  await m.delete()
742
  if m.reply_to_message:
@@ -796,15 +773,12 @@ async def dban_usr(c: Gojo, m: Message):
796
  await m.reply_text("Huh, why would I ban myself?")
797
  await m.stop_propagation()
798
 
799
- SUPPORT_STAFF = get_support_staff()
800
 
801
  if user_id in SUPPORT_STAFF:
802
  await m.reply_text(
803
  text="This user is in my support staff, cannot restrict them."
804
  )
805
- LOGGER.info(
806
- f"{m.from_user.id} trying to dban {user_id} (SUPPORT_STAFF) in {m.chat.id}",
807
- )
808
  await m.stop_propagation()
809
 
810
  try:
@@ -821,7 +795,6 @@ async def dban_usr(c: Gojo, m: Message):
821
  reason = m.text.split(None, 1)[1]
822
 
823
  try:
824
- LOGGER.info(f"{m.from_user.id} dbanned {user_id} in {m.chat.id}")
825
  await m.reply_to_message.delete()
826
  await m.chat.ban_member(user_id)
827
  txt = f"{m.from_user.mention} banned {m.reply_to_message.from_user.mention} in <b>{m.chat.title}</b>!"
@@ -897,15 +870,12 @@ async def ban_usr(c: Gojo, m: Message):
897
  await m.reply_text("Huh, why would I ban myself?")
898
  await m.stop_propagation()
899
 
900
- SUPPORT_STAFF = get_support_staff()
901
 
902
  if user_id in SUPPORT_STAFF:
903
  await m.reply_text(
904
  text="This user is in my support staff, cannot restrict them."
905
  )
906
- LOGGER.info(
907
- f"{m.from_user.id} trying to ban {user_id} (SUPPORT_STAFF) in {m.chat.id}",
908
- )
909
  await m.stop_propagation()
910
 
911
  try:
@@ -928,7 +898,6 @@ async def ban_usr(c: Gojo, m: Message):
928
  reason = m.text.split(None, 2)[2]
929
 
930
  try:
931
- LOGGER.info(f"{m.from_user.id} banned {user_id} in {m.chat.id}")
932
  await m.chat.ban_member(user_id)
933
  banned = await mention_html(user_first_name, user_id)
934
  txt = f"{m.from_user.mention} banned {banned} in <b>{m.chat.title}</b>!"
@@ -1024,7 +993,6 @@ async def kickme(c: Gojo, m: Message):
1024
  if len(m.text.split()) >= 2:
1025
  reason = m.text.split(None, 1)[1]
1026
  try:
1027
- LOGGER.info(f"{m.from_user.id} kickme used by {m.from_user.id} in {m.chat.id}")
1028
  mem = await c.get_chat_member(m.chat.id,m.from_user.id)
1029
  if mem.status in [enums.ChatMemberStatus.ADMINISTRATOR, enums.ChatMemberStatus.OWNER]:
1030
  try:
 
9
  InlineKeyboardButton, InlineKeyboardMarkup,
10
  Message)
11
 
12
+ from Powers import (DEV_USERS, LOGGER, MESSAGE_DUMP, OWNER_ID, SUDO_USERS,
13
+ WHITELIST_USERS)
14
  from Powers.bot_class import Gojo
 
15
  from Powers.utils.caching import ADMIN_CACHE, admin_cache_reload
16
  from Powers.utils.custom_filters import command, restrict_filter
17
  from Powers.utils.extract_user import extract_user
18
  from Powers.utils.extras import BAN_GIFS, KICK_GIFS
19
  from Powers.utils.parser import mention_html
20
  from Powers.utils.string import extract_time
 
21
 
22
 
23
  @Gojo.on_message(command("tban") & restrict_filter)
 
38
  await m.reply_text("WTF?? Why would I ban myself?")
39
  await m.stop_propagation()
40
 
41
+ SUPPORT_STAFF = DEV_USERS.union(SUDO_USERS).union(WHITELIST_USERS)
42
 
43
  if user_id in SUPPORT_STAFF:
44
  await m.reply_text(
45
  text="This user is in my support staff, cannot restrict them."
46
  )
47
+
 
 
48
  await m.stop_propagation()
49
 
50
  r_id = m.reply_to_message.id if m.reply_to_message else m.id
 
83
  admin = await mention_html(m.from_user.first_name, m.from_user.id)
84
  banned = await mention_html(user_first_name, user_id)
85
  chat_title = m.chat.title
 
86
  await m.chat.ban_member(
87
  user_id,
88
  until_date=bantime)
 
157
  await m.reply_text(text="I can't ban nothing!")
158
  await m.stop_propagation()
159
 
160
+ SUPPORT_STAFF = DEV_USERS.union(SUDO_USERS).union(WHITELIST_USERS)
161
 
162
  try:
163
  user_id, _, _ = await extract_user(c, m)
 
175
  await m.reply_text(
176
  text="This user is in my support staff, cannot restrict them."
177
  )
178
+
 
 
179
  await m.stop_propagation()
180
 
181
  if m.reply_to_message and len(m.text.split()) >= 2:
 
209
  await m.stop_propagation()
210
 
211
  try:
 
212
  await m.chat.ban_member(user_id, until_date=bantime)
213
  await m.delete()
214
  if m.reply_to_message:
 
262
  await m.reply_text("Huh, why would I ban myself?")
263
  await m.stop_propagation()
264
 
265
+ SUPPORT_STAFF = DEV_USERS.union(SUDO_USERS).union(WHITELIST_USERS)
266
 
267
  if user_id in SUPPORT_STAFF:
268
  await m.reply_text(text="I am not going to ban one of my support staff")
269
+
 
 
270
  await m.stop_propagation()
271
 
272
  if m.reply_to_message and len(m.text.split()) >= 2:
 
303
  admin = await mention_html(m.from_user.first_name, m.from_user.id)
304
  banned = await mention_html(user_first_name, user_id)
305
  chat_title = m.chat.title
 
306
  await m.chat.ban_member(user_id, until_date=bantime)
307
  await m.reply_to_message.delete()
308
  txt = f"{admin} banned {banned} in <b>{chat_title}</b>!"
 
389
  await m.reply_text("Huh, why would I kick myself?")
390
  await m.stop_propagation()
391
 
392
+ SUPPORT_STAFF = DEV_USERS.union(SUDO_USERS).union(WHITELIST_USERS)
393
 
394
  if user_id in SUPPORT_STAFF:
395
  await m.reply_text(
396
  text="This user is in my support staff, cannot restrict them."
397
  )
398
+
 
 
399
  await m.stop_propagation()
400
 
401
  try:
 
411
  admin = await mention_html(m.from_user.first_name, m.from_user.id)
412
  kicked = await mention_html(user_first_name, user_id)
413
  chat_title = m.chat.title
 
414
  await m.chat.ban_member(user_id)
415
  txt = f"{admin} kicked {kicked} in <b>{chat_title}</b>!"
416
  if reason:
 
477
  await m.reply_text("Nuh Hu, why would I kick myself?")
478
  await m.stop_propagation()
479
 
480
+ SUPPORT_STAFF = DEV_USERS.union(SUDO_USERS).union(WHITELIST_USERS)
481
 
482
  if user_id in SUPPORT_STAFF:
483
  await m.reply_text(
484
  text="This user is in my support staff, cannot restrict them."
485
  )
486
+
 
 
487
  await m.stop_propagation()
488
 
489
  try:
 
496
  await m.stop_propagation()
497
 
498
  try:
 
499
  await m.chat.ban_member(user_id)
500
  await m.delete()
501
  if m.reply_to_message:
 
548
  await m.reply_text("Huh, why would I kick myself?")
549
  await m.stop_propagation()
550
 
551
+ SUPPORT_STAFF = DEV_USERS.union(SUDO_USERS).union(WHITELIST_USERS)
552
 
553
  if user_id in SUPPORT_STAFF:
554
  await m.reply_text(
555
  text="This user is in my support staff, cannot restrict them."
556
  )
557
+
 
 
558
  await m.stop_propagation()
559
 
560
  try:
 
567
  await m.stop_propagation()
568
 
569
  try:
 
570
  await m.reply_to_message.delete()
571
  await m.chat.ban_member(user_id)
572
  admin = await mention_html(m.from_user.first_name, m.from_user.id)
 
696
  await m.reply_text("Huh, why would I ban myself?")
697
  await m.stop_propagation()
698
 
699
+ SUPPORT_STAFF = DEV_USERS.union(SUDO_USERS).union(WHITELIST_USERS)
700
 
701
  if user_id in SUPPORT_STAFF:
702
  await m.reply_text(
703
  text="This user is in my support staff, cannot restrict them."
704
  )
 
 
 
705
  await m.stop_propagation()
706
 
707
  try:
 
714
  await m.stop_propagation()
715
 
716
  try:
 
717
  await m.chat.ban_member(user_id)
718
  await m.delete()
719
  if m.reply_to_message:
 
773
  await m.reply_text("Huh, why would I ban myself?")
774
  await m.stop_propagation()
775
 
776
+ SUPPORT_STAFF = DEV_USERS.union(SUDO_USERS).union(WHITELIST_USERS)
777
 
778
  if user_id in SUPPORT_STAFF:
779
  await m.reply_text(
780
  text="This user is in my support staff, cannot restrict them."
781
  )
 
 
 
782
  await m.stop_propagation()
783
 
784
  try:
 
795
  reason = m.text.split(None, 1)[1]
796
 
797
  try:
 
798
  await m.reply_to_message.delete()
799
  await m.chat.ban_member(user_id)
800
  txt = f"{m.from_user.mention} banned {m.reply_to_message.from_user.mention} in <b>{m.chat.title}</b>!"
 
870
  await m.reply_text("Huh, why would I ban myself?")
871
  await m.stop_propagation()
872
 
873
+ SUPPORT_STAFF = DEV_USERS.union(SUDO_USERS).union(WHITELIST_USERS)
874
 
875
  if user_id in SUPPORT_STAFF:
876
  await m.reply_text(
877
  text="This user is in my support staff, cannot restrict them."
878
  )
 
 
 
879
  await m.stop_propagation()
880
 
881
  try:
 
898
  reason = m.text.split(None, 2)[2]
899
 
900
  try:
 
901
  await m.chat.ban_member(user_id)
902
  banned = await mention_html(user_first_name, user_id)
903
  txt = f"{m.from_user.mention} banned {banned} in <b>{m.chat.title}</b>!"
 
993
  if len(m.text.split()) >= 2:
994
  reason = m.text.split(None, 1)[1]
995
  try:
 
996
  mem = await c.get_chat_member(m.chat.id,m.from_user.id)
997
  if mem.status in [enums.ChatMemberStatus.ADMINISTRATOR, enums.ChatMemberStatus.OWNER]:
998
  try:
Powers/plugins/birthday.py CHANGED
@@ -125,7 +125,7 @@ async def who_is_next(c: Gojo, m: Message):
125
  if m.chat.type == ChatType.PRIVATE:
126
  await m.reply_text("Use it in group")
127
  return
128
- curr = datetime.now(TIME_ZONE).date()
129
  xx = await m.reply_text("📆")
130
  users = []
131
  if blist:
@@ -173,7 +173,7 @@ async def cant_recall_it(c: Gojo, m: Message):
173
  await m.reply_text(f"Got an error\n{e}")
174
  return
175
 
176
- curr = datetime.now(TIME_ZONE).date()
177
  u_dob = give_date(result["dob"])
178
  formatted = str(u_dob.strftime('%d' + '%B %Y'))[2:-5]
179
  day = int(result["dob"].split('/')[0])
@@ -182,7 +182,7 @@ async def cant_recall_it(c: Gojo, m: Message):
182
  if (u_dob.day,u_dob.month) < (curr.day,curr.month):
183
  next_b = date(curr.year + 1, u_dob.month, u_dob.day)
184
  days_left = (next_b - curr).days
185
- txt = f"{men} 's birthday is passed 🫤\nDays left until next one {days_left}"
186
  txt += f"\nBirthday on: {bday_on}"
187
  txt += f"\n\nDate of birth: {result['dob']}"
188
  elif (u_dob.day,u_dob.month) == (curr.day,curr.month):
@@ -190,7 +190,7 @@ async def cant_recall_it(c: Gojo, m: Message):
190
  else:
191
  u_dobm = date(curr.year, u_dob.month, u_dob.day)
192
  days_left = (u_dobm - curr).days
193
- txt = f"User's birthday is coming🥳\nDays left : {days_left}"
194
  txt += f"\nBirthday on: {bday_on}"
195
  txt += f"\n\nDate of birth: {result['dob']}"
196
  txt+= "\n\n**NOTE**:\nDOB may be wrong if user haven't entered his/her birth year"
@@ -218,7 +218,7 @@ async def chat_birthday_settings(c: Gojo, m: Message):
218
  await m.reply_text("Do you want to wish members for their birthday in the group?",reply_markup=kb)
219
  return
220
 
221
- @Gojo.on_callback_query(filters.regex("^switchh_"))
222
  async def switch_on_off(c:Gojo, q: CallbackQuery):
223
  user = (await q.message.chat.get_member(q.from_user.id)).status
224
  await q.message.chat.get_member(q.from_user.id)
@@ -227,11 +227,11 @@ async def switch_on_off(c:Gojo, q: CallbackQuery):
227
  return
228
  data = q.data.split("_")[1]
229
  chats = q.message.chat.id
230
- xXx = {"chat_id":chats}
231
  if data == "yes":
232
- bday_cinfo.delete_one(xXx)
233
  elif data == "no":
234
- bday_cinfo.insert_one(xXx)
235
  await q.edit_message_text(f"Done! I will {'wish' if data == 'yes' else 'not wish'}",reply_markup=IKM([[IKB("Close", "f_close")]]))
236
  return
237
 
 
125
  if m.chat.type == ChatType.PRIVATE:
126
  await m.reply_text("Use it in group")
127
  return
128
+ curr = datetime.now().date()
129
  xx = await m.reply_text("📆")
130
  users = []
131
  if blist:
 
173
  await m.reply_text(f"Got an error\n{e}")
174
  return
175
 
176
+ curr = datetime.now().date()
177
  u_dob = give_date(result["dob"])
178
  formatted = str(u_dob.strftime('%d' + '%B %Y'))[2:-5]
179
  day = int(result["dob"].split('/')[0])
 
182
  if (u_dob.day,u_dob.month) < (curr.day,curr.month):
183
  next_b = date(curr.year + 1, u_dob.month, u_dob.day)
184
  days_left = (next_b - curr).days
185
+ txt = f"{men} 's birthday is passed 🫤\nDays left until next one {abs(days_left)}"
186
  txt += f"\nBirthday on: {bday_on}"
187
  txt += f"\n\nDate of birth: {result['dob']}"
188
  elif (u_dob.day,u_dob.month) == (curr.day,curr.month):
 
190
  else:
191
  u_dobm = date(curr.year, u_dob.month, u_dob.day)
192
  days_left = (u_dobm - curr).days
193
+ txt = f"User's birthday is coming🥳\nDays left: {abs(days_left)}"
194
  txt += f"\nBirthday on: {bday_on}"
195
  txt += f"\n\nDate of birth: {result['dob']}"
196
  txt+= "\n\n**NOTE**:\nDOB may be wrong if user haven't entered his/her birth year"
 
218
  await m.reply_text("Do you want to wish members for their birthday in the group?",reply_markup=kb)
219
  return
220
 
221
+ @Gojo.on_callback_query(filters.regex(r"^switchh_(yes|no)$"))
222
  async def switch_on_off(c:Gojo, q: CallbackQuery):
223
  user = (await q.message.chat.get_member(q.from_user.id)).status
224
  await q.message.chat.get_member(q.from_user.id)
 
227
  return
228
  data = q.data.split("_")[1]
229
  chats = q.message.chat.id
230
+ query = {"chat_id":chats}
231
  if data == "yes":
232
+ bday_cinfo.delete_one(query)
233
  elif data == "no":
234
+ bday_cinfo.insert_one(query)
235
  await q.edit_message_text(f"Done! I will {'wish' if data == 'yes' else 'not wish'}",reply_markup=IKM([[IKB("Close", "f_close")]]))
236
  return
237
 
Powers/plugins/blacklist.py CHANGED
@@ -15,8 +15,6 @@ from Powers.utils.kbhelpers import ikb
15
  async def view_blacklist(_, m: Message):
16
  db = Blacklist(m.chat.id)
17
 
18
- LOGGER.info(f"{m.from_user.id} checking blacklists in {m.chat.id}")
19
-
20
  chat_title = m.chat.title
21
  blacklists_chat = f"Current Blacklisted words in <b>{chat_title}</b>:\n\n"
22
  all_blacklisted = db.get_blacklists()
@@ -58,7 +56,6 @@ async def add_blacklist(_, m: Message):
58
  ", ".join([f"<code>{i}</code>" for i in bl_words])
59
  + " already added in blacklist, skipped them!"
60
  )
61
- LOGGER.info(f"{m.from_user.id} added new blacklists ({bl_words}) in {m.chat.id}")
62
  trigger = ", ".join(f"<code>{i}</code>" for i in bl_words)
63
  await m.reply_text(
64
  text=f"Added <code>{trigger}</code> in blacklist words!"
@@ -116,7 +113,6 @@ async def rm_blacklist(_, m: Message):
116
  "Could not find " + ", ".join(f"<code>{i}</code>" for i in non_found_words)
117
  ) + " in blcklisted words, skipped them."
118
 
119
- LOGGER.info(f"{m.from_user.id} removed blacklists ({bl_words}) in {m.chat.id}")
120
  bl_words = ", ".join(f"<code>{i}</code>" for i in bl_words)
121
  await m.reply_text(
122
  text=f"Removed <b>{bl_words}</b> from blacklist words!"
@@ -145,13 +141,9 @@ async def set_bl_action(_, m: Message):
145
 
146
  return
147
  db.set_action(action)
148
- LOGGER.info(
149
- f"{m.from_user.id} set blacklist action to '{action}' in {m.chat.id}",
150
- )
151
  await m.reply_text(text=f"Set action for blacklist for this to <b>{action}</b>")
152
  elif len(m.text.split()) == 1:
153
  action = db.get_action()
154
- LOGGER.info(f"{m.from_user.id} checking blacklist action in {m.chat.id}")
155
  await m.reply_text(
156
  text=f"""The current action for blacklists in this chat is <i><b>{action}</b></i>
157
  All blacklist modes delete the message containing blacklist word."""
@@ -201,7 +193,6 @@ async def rm_allbl_callback(_, q: CallbackQuery):
201
  return
202
  db.rm_all_blacklist()
203
  await q.message.delete()
204
- LOGGER.info(f"{user_id} removed all blacklists in {q.message.chat.id}")
205
  await q.answer("Cleared all Blacklists!", show_alert=True)
206
  return
207
 
 
15
  async def view_blacklist(_, m: Message):
16
  db = Blacklist(m.chat.id)
17
 
 
 
18
  chat_title = m.chat.title
19
  blacklists_chat = f"Current Blacklisted words in <b>{chat_title}</b>:\n\n"
20
  all_blacklisted = db.get_blacklists()
 
56
  ", ".join([f"<code>{i}</code>" for i in bl_words])
57
  + " already added in blacklist, skipped them!"
58
  )
 
59
  trigger = ", ".join(f"<code>{i}</code>" for i in bl_words)
60
  await m.reply_text(
61
  text=f"Added <code>{trigger}</code> in blacklist words!"
 
113
  "Could not find " + ", ".join(f"<code>{i}</code>" for i in non_found_words)
114
  ) + " in blcklisted words, skipped them."
115
 
 
116
  bl_words = ", ".join(f"<code>{i}</code>" for i in bl_words)
117
  await m.reply_text(
118
  text=f"Removed <b>{bl_words}</b> from blacklist words!"
 
141
 
142
  return
143
  db.set_action(action)
 
 
 
144
  await m.reply_text(text=f"Set action for blacklist for this to <b>{action}</b>")
145
  elif len(m.text.split()) == 1:
146
  action = db.get_action()
 
147
  await m.reply_text(
148
  text=f"""The current action for blacklists in this chat is <i><b>{action}</b></i>
149
  All blacklist modes delete the message containing blacklist word."""
 
193
  return
194
  db.rm_all_blacklist()
195
  await q.message.delete()
 
196
  await q.answer("Cleared all Blacklists!", show_alert=True)
197
  return
198
 
Powers/plugins/captcha.py CHANGED
@@ -8,10 +8,9 @@ from pyrogram.types import InlineKeyboardButton as IKB
8
  from pyrogram.types import InlineKeyboardMarkup as ikm
9
  from pyrogram.types import Message
10
 
11
- from Powers import LOGGER
12
  from Powers.bot_class import Gojo
13
  from Powers.database.captcha_db import CAPTCHA, CAPTCHA_DATA
14
- from Powers.supports import get_support_staff
15
  from Powers.utils.captcha_helper import (genrator, get_image_captcha,
16
  get_qr_captcha)
17
  from Powers.utils.custom_filters import admin_filter, command
@@ -138,7 +137,7 @@ async def on_chat_members_updatess(c: Gojo, u: ChatMemberUpdated):
138
  captcha = CAPTCHA()
139
  cap_data = CAPTCHA_DATA()
140
 
141
- SUPPORT_STAFF = get_support_staff()
142
  if user in SUPPORT_STAFF:
143
  return
144
 
 
8
  from pyrogram.types import InlineKeyboardMarkup as ikm
9
  from pyrogram.types import Message
10
 
11
+ from Powers import DEV_USERS, LOGGER, SUDO_USERS, WHITELIST_USERS
12
  from Powers.bot_class import Gojo
13
  from Powers.database.captcha_db import CAPTCHA, CAPTCHA_DATA
 
14
  from Powers.utils.captcha_helper import (genrator, get_image_captcha,
15
  get_qr_captcha)
16
  from Powers.utils.custom_filters import admin_filter, command
 
137
  captcha = CAPTCHA()
138
  cap_data = CAPTCHA_DATA()
139
 
140
+ SUPPORT_STAFF = DEV_USERS.union(SUDO_USERS).union(WHITELIST_USERS)
141
  if user in SUPPORT_STAFF:
142
  return
143
 
Powers/plugins/chat_blacklist.py CHANGED
@@ -18,7 +18,6 @@ async def blacklist_chat(c: Gojo, m: Message):
18
  if len(m.text.split()) >= 2:
19
  chat_ids = m.text.split()[1:]
20
  replymsg = await m.reply_text(f"Adding {len(chat_ids)} chats to blacklist")
21
- LOGGER.info(f"{m.from_user.id} blacklisted {chat_ids} groups for bot")
22
  for chat in chat_ids:
23
  try:
24
  get_chat = await c.get_chat(chat)
@@ -51,7 +50,6 @@ async def unblacklist_chat(c: Gojo, m: Message):
51
  if len(m.text.split()) >= 2:
52
  chat_ids = m.text.split()[1:]
53
  replymsg = await m.reply_text(f"Removing {len(chat_ids)} chats from blacklist")
54
- LOGGER.info(f"{m.from_user.id} removed blacklisted {chat_ids} groups for bot")
55
  bl_chats = db.list_all_chats()
56
  for chat in chat_ids:
57
  try:
@@ -89,7 +87,6 @@ async def unblacklist_chat(c: Gojo, m: Message):
89
  )
90
  async def list_blacklist_chats(_, m: Message):
91
  bl_chats = db.list_all_chats()
92
- LOGGER.info(f"{m.from_user.id} checking group blacklists in {m.chat.id}")
93
  if bl_chats:
94
  txt = (
95
  (
 
18
  if len(m.text.split()) >= 2:
19
  chat_ids = m.text.split()[1:]
20
  replymsg = await m.reply_text(f"Adding {len(chat_ids)} chats to blacklist")
 
21
  for chat in chat_ids:
22
  try:
23
  get_chat = await c.get_chat(chat)
 
50
  if len(m.text.split()) >= 2:
51
  chat_ids = m.text.split()[1:]
52
  replymsg = await m.reply_text(f"Removing {len(chat_ids)} chats from blacklist")
 
53
  bl_chats = db.list_all_chats()
54
  for chat in chat_ids:
55
  try:
 
87
  )
88
  async def list_blacklist_chats(_, m: Message):
89
  bl_chats = db.list_all_chats()
 
90
  if bl_chats:
91
  txt = (
92
  (
Powers/plugins/clean_db.py CHANGED
@@ -18,7 +18,6 @@ from Powers.database.pins_db import Pins
18
  from Powers.database.reporting_db import Reporting
19
  # from Powers.database.users_db import Users
20
  from Powers.database.warns_db import Warns, WarnSettings
21
- from Powers.vars import Config
22
 
23
 
24
  async def clean_my_db(c: Gojo, is_cmd=False, id=None):
 
18
  from Powers.database.reporting_db import Reporting
19
  # from Powers.database.users_db import Users
20
  from Powers.database.warns_db import Warns, WarnSettings
 
21
 
22
 
23
  async def clean_my_db(c: Gojo, is_cmd=False, id=None):
Powers/plugins/dev.py CHANGED
@@ -16,15 +16,15 @@ from pyrogram.types import InlineKeyboardButton as IKB
16
  from pyrogram.types import InlineKeyboardMarkup as IKM
17
  from pyrogram.types import Message
18
 
19
- from Powers import (BOT_TOKEN, LOG_DATETIME, LOGFILE, LOGGER, MESSAGE_DUMP,
20
- OWNER_ID, UPTIME)
 
21
  from Powers.bot_class import Gojo
22
  from Powers.database import MongoDB
23
  from Powers.database.chats_db import Chats
24
  from Powers.database.support_db import SUPPORTS
25
  from Powers.database.users_db import Users
26
  from Powers.plugins.scheduled_jobs import clean_my_db
27
- from Powers.supports import get_support_staff
28
  from Powers.utils.clean_file import remove_markdown_and_html
29
  from Powers.utils.custom_filters import command
30
  from Powers.utils.extract_user import extract_user
@@ -80,6 +80,12 @@ async def add_support(c: Gojo, m:Message):
80
  return
81
  else:
82
  support.insert_support_user(userr,to)
 
 
 
 
 
 
83
  await m.reply_text(f"This user is now a {to} user")
84
  return
85
  can_do = can_change_type(curr_user,to)
@@ -196,6 +202,9 @@ async def rm_support(c: Gojo, m: Message):
196
  can_user = can_change_type(curr_user,to_user)
197
  if m.from_user.id == int(OWNER_ID) or can_user:
198
  support.delete_support_user(curr)
 
 
 
199
  await m.reply_text("Done! User now no longer belongs to the support staff")
200
  else:
201
  await m.reply_text("Sorry you can't do that...")
@@ -203,7 +212,6 @@ async def rm_support(c: Gojo, m: Message):
203
 
204
  @Gojo.on_message(command("ping", sudo_cmd=True))
205
  async def ping(_, m: Message):
206
- LOGGER.info(f"{m.from_user.id} used ping cmd in {m.chat.id}")
207
  start = time()
208
  replymsg = await m.reply_text(text="Pinging...", quote=True)
209
  delta_ping = time() - start
@@ -386,6 +394,10 @@ async def evaluate_code(c: Gojo, m: Message):
386
  MESSAGE_DUMP,
387
  f"@{m.from_user.username} TREID TO FETCH ENV OF BOT \n userid = {m.from_user.id}",
388
  )
 
 
 
 
389
  for j in HARMFUL:
390
  if j in evaluation.split() or j in cmd:
391
  if m.from_user.id != OWNER_ID:
@@ -393,6 +405,9 @@ async def evaluate_code(c: Gojo, m: Message):
393
  await c.send_message(
394
  MESSAGE_DUMP,
395
  f"@{m.from_user.username} TREID TO FETCH ENV OF BOT \n userid = {m.from_user.id}")
 
 
 
396
  for i in evaluation.split():
397
  for j in i.split("="):
398
  if j and j[0] in HARMFUL:
@@ -402,10 +417,12 @@ async def evaluate_code(c: Gojo, m: Message):
402
  MESSAGE_DUMP,
403
  f"@{m.from_user.username} TREID TO FETCH ENV OF BOT \n userid = {m.from_user.id}"
404
  )
405
-
 
 
406
 
407
  try:
408
- final_output = f"**EVAL**: ```python\n{cmd}```\n\n<b>OUTPUT</b>:\n```python\n{evaluation}```</code> \n"
409
  await sm.edit(final_output)
410
  except MessageTooLong:
411
  final_output = f"<b>EVAL</b>: <code>{cmd}</code>\n\n<b>OUTPUT</b>:\n<code>{evaluation}</code> \n"
 
16
  from pyrogram.types import InlineKeyboardMarkup as IKM
17
  from pyrogram.types import Message
18
 
19
+ from Powers import (BOT_TOKEN, DEV_USERS, LOG_DATETIME, LOGFILE, LOGGER,
20
+ MESSAGE_DUMP, OWNER_ID, SUDO_USERS, UPTIME,
21
+ WHITELIST_USERS)
22
  from Powers.bot_class import Gojo
23
  from Powers.database import MongoDB
24
  from Powers.database.chats_db import Chats
25
  from Powers.database.support_db import SUPPORTS
26
  from Powers.database.users_db import Users
27
  from Powers.plugins.scheduled_jobs import clean_my_db
 
28
  from Powers.utils.clean_file import remove_markdown_and_html
29
  from Powers.utils.custom_filters import command
30
  from Powers.utils.extract_user import extract_user
 
80
  return
81
  else:
82
  support.insert_support_user(userr,to)
83
+ if to == "dev":
84
+ DEV_USERS.add(userr)
85
+ elif to == "sudo":
86
+ SUDO_USERS.add(userr)
87
+ else:
88
+ WHITELIST_USERS.add(userr)
89
  await m.reply_text(f"This user is now a {to} user")
90
  return
91
  can_do = can_change_type(curr_user,to)
 
202
  can_user = can_change_type(curr_user,to_user)
203
  if m.from_user.id == int(OWNER_ID) or can_user:
204
  support.delete_support_user(curr)
205
+ DEV_USERS.discard(curr)
206
+ SUDO_USERS.discard(curr)
207
+ WHITELIST_USERS.discard(curr)
208
  await m.reply_text("Done! User now no longer belongs to the support staff")
209
  else:
210
  await m.reply_text("Sorry you can't do that...")
 
212
 
213
  @Gojo.on_message(command("ping", sudo_cmd=True))
214
  async def ping(_, m: Message):
 
215
  start = time()
216
  replymsg = await m.reply_text(text="Pinging...", quote=True)
217
  delta_ping = time() - start
 
394
  MESSAGE_DUMP,
395
  f"@{m.from_user.username} TREID TO FETCH ENV OF BOT \n userid = {m.from_user.id}",
396
  )
397
+ final_output = f"**EVAL**: ```python\n{cmd}```\n\n<b>OUTPUT</b>:\n```powershell\n{evaluation}```</code> \n"
398
+ await sm.edit(final_output)
399
+ return
400
+
401
  for j in HARMFUL:
402
  if j in evaluation.split() or j in cmd:
403
  if m.from_user.id != OWNER_ID:
 
405
  await c.send_message(
406
  MESSAGE_DUMP,
407
  f"@{m.from_user.username} TREID TO FETCH ENV OF BOT \n userid = {m.from_user.id}")
408
+ final_output = f"**EVAL**: ```python\n{cmd}```\n\n<b>OUTPUT</b>:\n```powershell\n{evaluation}```</code> \n"
409
+ await sm.edit(final_output)
410
+ return
411
  for i in evaluation.split():
412
  for j in i.split("="):
413
  if j and j[0] in HARMFUL:
 
417
  MESSAGE_DUMP,
418
  f"@{m.from_user.username} TREID TO FETCH ENV OF BOT \n userid = {m.from_user.id}"
419
  )
420
+ final_output = f"**EVAL**: ```python\n{cmd}```\n\n<b>OUTPUT</b>:\n```powershell\n{evaluation}```</code> \n"
421
+ await sm.edit(final_output)
422
+ return
423
 
424
  try:
425
+ final_output = f"**EVAL**: ```python\n{cmd}```\n\n<b>OUTPUT</b>:\n```powershell\n{evaluation}```</code> \n"
426
  await sm.edit(final_output)
427
  except MessageTooLong:
428
  final_output = f"<b>EVAL</b>: <code>{cmd}</code>\n\n<b>OUTPUT</b>:\n<code>{evaluation}</code> \n"
Powers/plugins/disable.py CHANGED
@@ -24,7 +24,6 @@ async def disableit(_, m: Message):
24
 
25
  db = Disabling(m.chat.id)
26
  disable_list = db.get_disabled()
27
- LOGGER.info(f"{m.from_user.id} used disabled cmd in {m.chat.id}")
28
 
29
  if str(m.text.split(None, 1)[1]) in disable_list:
30
  return await m.reply_text("It's already disabled!")
@@ -48,8 +47,6 @@ async def set_dsbl_action(_, m: Message):
48
  cur = True
49
  args = m.text.split(" ", 1)
50
 
51
- LOGGER.info(f"{m.from_user.id} disabledel used in {m.chat.id}")
52
-
53
  if len(args) >= 2:
54
  if args[1].lower() == "on":
55
  db.set_action("del")
@@ -73,7 +70,6 @@ async def enableit(_, m: Message):
73
  if str(m.text.split(None, 1)[1]) not in disable_list:
74
  return await m.reply_text("It's not disabled!")
75
  db.remove_disabled((str(m.text.split(None, 1)[1])).lower())
76
- LOGGER.info(f"{m.from_user.id} enabled something in {m.chat.id}")
77
  return await m.reply_text(f"Enabled {m.text.split(None, 1)[1]}!")
78
 
79
 
@@ -86,7 +82,6 @@ async def disabling(_, m: Message):
86
  )
87
  tes = "List of commnds that can be disabled:\n"
88
  tes += "\n".join(f" • <code>{escape(i)}</code>" for i in disable_cmd_keys)
89
- LOGGER.info(f"{m.from_user.id} checked disableable {m.chat.id}")
90
  return await m.reply_text(tes)
91
 
92
 
@@ -99,7 +94,6 @@ async def disabled(_, m: Message):
99
  return
100
  tex = "Disabled commands:\n"
101
  tex += "\n".join(f" • <code>{escape(i)}</code>" for i in disable_list)
102
- LOGGER.info(f"{m.from_user.id} checked disabled {m.chat.id}")
103
  return await m.reply_text(tex)
104
 
105
 
@@ -145,7 +139,6 @@ async def enablealll(_, q: CallbackQuery):
145
  return
146
  db = Disabling(q.message.chat.id)
147
  db.rm_all_disabled()
148
- LOGGER.info(f"{user_id} enabled all in {q.message.chat.id}")
149
  await q.message.edit_text("Enabled all!", show_alert=True)
150
  return
151
 
 
24
 
25
  db = Disabling(m.chat.id)
26
  disable_list = db.get_disabled()
 
27
 
28
  if str(m.text.split(None, 1)[1]) in disable_list:
29
  return await m.reply_text("It's already disabled!")
 
47
  cur = True
48
  args = m.text.split(" ", 1)
49
 
 
 
50
  if len(args) >= 2:
51
  if args[1].lower() == "on":
52
  db.set_action("del")
 
70
  if str(m.text.split(None, 1)[1]) not in disable_list:
71
  return await m.reply_text("It's not disabled!")
72
  db.remove_disabled((str(m.text.split(None, 1)[1])).lower())
 
73
  return await m.reply_text(f"Enabled {m.text.split(None, 1)[1]}!")
74
 
75
 
 
82
  )
83
  tes = "List of commnds that can be disabled:\n"
84
  tes += "\n".join(f" • <code>{escape(i)}</code>" for i in disable_cmd_keys)
 
85
  return await m.reply_text(tes)
86
 
87
 
 
94
  return
95
  tex = "Disabled commands:\n"
96
  tex += "\n".join(f" • <code>{escape(i)}</code>" for i in disable_list)
 
97
  return await m.reply_text(tex)
98
 
99
 
 
139
  return
140
  db = Disabling(q.message.chat.id)
141
  db.rm_all_disabled()
 
142
  await q.message.edit_text("Enabled all!", show_alert=True)
143
  return
144
 
Powers/plugins/filters.py CHANGED
@@ -25,8 +25,6 @@ db = Filters()
25
 
26
  @Gojo.on_message(command("filters") & filters.group & ~filters.bot)
27
  async def view_filters(_, m: Message):
28
- LOGGER.info(f"{m.from_user.id} checking filters in {m.chat.id}")
29
-
30
  filters_chat = f"Filters in <b>{m.chat.title}</b>:\n"
31
  all_filters = db.get_all_filters(m.chat.id)
32
  actual_filters = [j for i in all_filters for j in i.split("|")]
@@ -66,9 +64,9 @@ async def add_filter(_, m: Message):
66
  extracted = await split_quotes(args[1])
67
  keyword = extracted[0].lower()
68
 
69
- for k in keyword.split("|"):
70
- if k in actual_filters:
71
- return await m.reply_text(f"Filter <code>{k}</code> already exists!")
72
 
73
  if not keyword:
74
  return await m.reply_text(
@@ -98,7 +96,6 @@ async def add_filter(_, m: Message):
98
  )
99
 
100
  add = db.save_filter(m.chat.id, keyword, teks, msgtype, file_id)
101
- LOGGER.info(f"{m.from_user.id} added new filter ({keyword}) in {m.chat.id}")
102
  if add:
103
  await m.reply_text(
104
  f"Saved filter for '<code>{', '.join(keyword.split('|'))}</code>' in <b>{m.chat.title}</b>!",
@@ -122,7 +119,6 @@ async def stop_filter(_, m: Message):
122
  for keyword in act_filters:
123
  if keyword == m.text.split(None, 1)[1].lower():
124
  db.rm_filter(m.chat.id, m.text.split(None, 1)[1].lower())
125
- LOGGER.info(f"{m.from_user.id} removed filter ({keyword}) in {m.chat.id}")
126
  await m.reply_text(
127
  f"Okay, I'll stop replying to that filter and it's aliases in <b>{m.chat.title}</b>.",
128
  )
@@ -171,7 +167,6 @@ async def rm_allfilters_callback(_, q: CallbackQuery):
171
  return
172
  db.rm_all_filters(q.message.chat.id)
173
  await q.message.edit_text(f"Cleared all filters for {q.message.chat.title}")
174
- LOGGER.info(f"{user_id} removed all filter from {q.message.chat.id}")
175
  await q.answer("Cleared all Filters!", show_alert=True)
176
  return
177
 
 
25
 
26
  @Gojo.on_message(command("filters") & filters.group & ~filters.bot)
27
  async def view_filters(_, m: Message):
 
 
28
  filters_chat = f"Filters in <b>{m.chat.title}</b>:\n"
29
  all_filters = db.get_all_filters(m.chat.id)
30
  actual_filters = [j for i in all_filters for j in i.split("|")]
 
64
  extracted = await split_quotes(args[1])
65
  keyword = extracted[0].lower()
66
 
67
+ # for k in keyword.split("|"):
68
+ # if k in actual_filters:
69
+ # return await m.reply_text(f"Filter <code>{k}</code> already exists!")
70
 
71
  if not keyword:
72
  return await m.reply_text(
 
96
  )
97
 
98
  add = db.save_filter(m.chat.id, keyword, teks, msgtype, file_id)
 
99
  if add:
100
  await m.reply_text(
101
  f"Saved filter for '<code>{', '.join(keyword.split('|'))}</code>' in <b>{m.chat.title}</b>!",
 
119
  for keyword in act_filters:
120
  if keyword == m.text.split(None, 1)[1].lower():
121
  db.rm_filter(m.chat.id, m.text.split(None, 1)[1].lower())
 
122
  await m.reply_text(
123
  f"Okay, I'll stop replying to that filter and it's aliases in <b>{m.chat.title}</b>.",
124
  )
 
167
  return
168
  db.rm_all_filters(q.message.chat.id)
169
  await q.message.edit_text(f"Cleared all filters for {q.message.chat.title}")
 
170
  await q.answer("Cleared all Filters!", show_alert=True)
171
  return
172
 
Powers/plugins/flood.py CHANGED
@@ -11,13 +11,11 @@ from pyrogram.types import (CallbackQuery, ChatPermissions,
11
  InlineKeyboardButton, InlineKeyboardMarkup,
12
  Message)
13
 
14
- from Powers import LOGGER
15
  from Powers.bot_class import Gojo
16
  from Powers.database.flood_db import Floods
17
- from Powers.supports import get_support_staff
18
  from Powers.utils.custom_filters import admin_filter, command, flood_filter
19
  from Powers.utils.extras import BAN_GIFS, KICK_GIFS, MUTE_GIFS
20
- from Powers.vars import Config
21
 
22
  on_key = ["on", "start", "disable"]
23
  off_key = ["off", "end", "enable", "stop"]
@@ -230,7 +228,7 @@ async def flood_set(c: Gojo, m: Message):
230
 
231
  @Gojo.on_callback_query(filters.regex("^f_"))
232
  async def callbacks(c: Gojo, q: CallbackQuery):
233
- SUPPORT_STAFF = get_support_staff()
234
  data = q.data
235
  if data == "f_close":
236
  await q.answer("Closed")
@@ -352,7 +350,7 @@ async def reverse_callbacks(c: Gojo, q: CallbackQuery):
352
  data = q.data.split("_")
353
  action = data[1]
354
  user_id = int(q.data.split("=")[1])
355
- SUPPORT_STAFF = get_support_staff()
356
  if not q.from_user:
357
  return q.answer("Looks like you are not an user 👀")
358
  if action == "ban":
@@ -572,13 +570,13 @@ async def flood_watcher(c: Gojo, m: Message):
572
 
573
  elif action == "kick":
574
  try:
575
- await m.chat.ban_member(u_id)
576
  txt = "Don't dare to spam here if I am around! Nothing can escape my 6 eyes\nAction: kicked\nReason: Spaming"
577
  await m.reply_animation(
578
  animation=str(choice(KICK_GIFS)),
579
  caption=txt,
580
  )
581
- await m.chat.unban_member(u_id)
582
  dic[c_id][u_id][1].clear()
583
  dic[c_id][u_id][0].clear()
584
  return
 
11
  InlineKeyboardButton, InlineKeyboardMarkup,
12
  Message)
13
 
14
+ from Powers import DEV_USERS, LOGGER, SUDO_USERS, WHITELIST_USERS
15
  from Powers.bot_class import Gojo
16
  from Powers.database.flood_db import Floods
 
17
  from Powers.utils.custom_filters import admin_filter, command, flood_filter
18
  from Powers.utils.extras import BAN_GIFS, KICK_GIFS, MUTE_GIFS
 
19
 
20
  on_key = ["on", "start", "disable"]
21
  off_key = ["off", "end", "enable", "stop"]
 
228
 
229
  @Gojo.on_callback_query(filters.regex("^f_"))
230
  async def callbacks(c: Gojo, q: CallbackQuery):
231
+ SUPPORT_STAFF = DEV_USERS.union(SUDO_USERS).union(WHITELIST_USERS)
232
  data = q.data
233
  if data == "f_close":
234
  await q.answer("Closed")
 
350
  data = q.data.split("_")
351
  action = data[1]
352
  user_id = int(q.data.split("=")[1])
353
+ SUPPORT_STAFF = DEV_USERS.union(SUDO_USERS).union(WHITELIST_USERS)
354
  if not q.from_user:
355
  return q.answer("Looks like you are not an user 👀")
356
  if action == "ban":
 
570
 
571
  elif action == "kick":
572
  try:
573
+ await m.chat.ban_member(u_id, datetime.now()+timedelta(seconds=10))
574
  txt = "Don't dare to spam here if I am around! Nothing can escape my 6 eyes\nAction: kicked\nReason: Spaming"
575
  await m.reply_animation(
576
  animation=str(choice(KICK_GIFS)),
577
  caption=txt,
578
  )
579
+ await m.chat.unban_member(m.from_user.id)
580
  dic[c_id][u_id][1].clear()
581
  dic[c_id][u_id][0].clear()
582
  return
Powers/plugins/formatting.py CHANGED
@@ -35,7 +35,6 @@ async def markdownhelp(_, m: Message):
35
  quote=True,
36
  reply_markup=(await gen_formatting_kb(m)),
37
  )
38
- LOGGER.info(f"{m.from_user.id} used cmd '{m.command}' in {m.chat.id}")
39
  return
40
 
41
 
 
35
  quote=True,
36
  reply_markup=(await gen_formatting_kb(m)),
37
  )
 
38
  return
39
 
40
 
Powers/plugins/fun.py CHANGED
@@ -5,15 +5,13 @@ from pyrogram import enums
5
  from pyrogram.errors import MessageTooLong
6
  from pyrogram.types import Message
7
 
8
- from Powers import LOGGER
9
  from Powers.bot_class import Gojo
10
- from Powers.supports import get_support_staff
11
  from Powers.utils import extras
12
  from Powers.utils.custom_filters import command
13
  from Powers.utils.extras import NOWYES as NO
14
  from Powers.utils.extras import YESWNO as YES
15
 
16
- DEV_USERS = get_support_staff("dev")
17
 
18
  @Gojo.on_message(command("shout"))
19
  async def fun_shout(_, m: Message):
@@ -33,7 +31,6 @@ async def fun_shout(_, m: Message):
33
  result = "".join(result)
34
  msg = "```\n" + result + "```"
35
  await m.reply_text(msg, parse_mode=enums.ParseMode.MARKDOWN)
36
- LOGGER.info(f"{m.from_user.id} shouted in {m.chat.id}")
37
  return
38
  except MessageTooLong as e:
39
  await m.reply_text(f"Error: {e}")
@@ -43,7 +40,6 @@ async def fun_shout(_, m: Message):
43
  @Gojo.on_message(command("runs"))
44
  async def fun_run(_, m: Message):
45
  await m.reply_text(choice(extras.RUN_STRINGS))
46
- LOGGER.info(f"{m.from_user.id} runed in {m.chat.id}")
47
  return
48
 
49
 
@@ -79,7 +75,6 @@ async def fun_slap(c: Gojo, m: Message):
79
 
80
  reply = temp.format(user1=user1, user2=user2, item=item, hits=hit, throws=throw)
81
  await reply_text(reply)
82
- LOGGER.info(f"{m.from_user.id} slaped in {m.chat.id}")
83
  return
84
 
85
 
@@ -87,7 +82,6 @@ async def fun_slap(c: Gojo, m: Message):
87
  async def fun_roll(_, m: Message):
88
  reply_text = m.reply_to_message.reply_text if m.reply_to_message else m.reply_text
89
  await reply_text(choice(range(1, 7)))
90
- LOGGER.info(f"{m.from_user.id} roll in {m.chat.id}")
91
  return
92
 
93
 
@@ -95,7 +89,6 @@ async def fun_roll(_, m: Message):
95
  async def fun_toss(_, m: Message):
96
  reply_text = m.reply_to_message.reply_text if m.reply_to_message else m.reply_text
97
  await reply_text(choice(extras.TOSS))
98
- LOGGER.info(f"{m.from_user.id} tossed in {m.chat.id}")
99
  return
100
 
101
 
@@ -108,13 +101,9 @@ async def insult(c: Gojo, m: Message):
108
  user_first_name = m.reply_to_message.from_user.first_name
109
  if user_id in DEV_USERS:
110
  await m.reply_text("Sorry! I can't insult my devs....")
111
- return LOGGER.info(
112
- f"{m.from_user.id} tried to insult {user_first_name} in {m.chat.id}"
113
- )
114
  else:
115
  Insult_omp = choice(extras.INSULT_STRINGS)
116
  await m.reply_to_message.reply_text(Insult_omp)
117
- LOGGER.info(f"{m.from_user.id} insulted {user_first_name} in {m.chat.id}")
118
 
119
 
120
  @Gojo.on_message(command("yes"))
@@ -122,7 +111,6 @@ async def yesw(c: Gojo, m: Message):
122
  reply_text = m.reply_to_message.reply_text if m.reply_to_message else m.reply_text
123
  rtext = YES[0]
124
  await reply_text(rtext)
125
- LOGGER.info(f"{m.from_user.id} said YES or may be NO in {m.chat.id}")
126
  return
127
 
128
 
@@ -131,7 +119,6 @@ async def now(c: Gojo, m: Message):
131
  reply_text = m.reply_to_message.reply_text if m.reply_to_message else m.reply_text
132
  rtext = NO[0]
133
  await reply_text(rtext)
134
- LOGGER.info(f"{m.from_user.id} said NO or may be YES in {m.chat.id}")
135
  return
136
 
137
 
@@ -139,7 +126,6 @@ async def now(c: Gojo, m: Message):
139
  async def fun_shrug(_, m: Message):
140
  reply_text = m.reply_to_message.reply_text if m.reply_to_message else m.reply_text
141
  await reply_text(r"¯\_(ツ)_/¯")
142
- LOGGER.info(f"{m.from_user.id} shruged in {m.chat.id}")
143
  return
144
 
145
 
@@ -149,7 +135,6 @@ async def fun_bluetext(_, m: Message):
149
  await reply_text(
150
  "|| /BLUE /TEXT\n/MUST /CLICK\n/I /AM /A /STUPID /ANIMAL /THAT /IS /ATTRACTED /TO /COLORS ||",
151
  )
152
- LOGGER.info(f"{m.from_user.id} bluetexted in {m.chat.id}")
153
  return
154
 
155
 
@@ -157,7 +142,6 @@ async def fun_bluetext(_, m: Message):
157
  async def fun_decide(_, m: Message):
158
  reply_text = m.reply_to_message.reply_text if m.reply_to_message else m.reply_text
159
  await reply_text(choice(extras.DECIDE))
160
- LOGGER.info(f"{m.from_user.id} decided in {m.chat.id}")
161
  return
162
 
163
 
@@ -165,7 +149,6 @@ async def fun_decide(_, m: Message):
165
  async def fun_table(_, m: Message):
166
  reply_text = m.reply_to_message.reply_text if m.reply_to_message else m.reply_text
167
  await reply_text(choice(extras.REACTIONS))
168
- LOGGER.info(f"{m.from_user.id} reacted in {m.chat.id}")
169
  return
170
 
171
 
@@ -199,7 +182,6 @@ async def weebify(_, m: Message):
199
  text=f"""<b>Weebified String:</b>
200
  <code>{string}</code>"""
201
  )
202
- LOGGER.info(f"{m.from_user.id} weebified '{args}' in {m.chat.id}")
203
  return
204
 
205
 
 
5
  from pyrogram.errors import MessageTooLong
6
  from pyrogram.types import Message
7
 
8
+ from Powers import DEV_USERS
9
  from Powers.bot_class import Gojo
 
10
  from Powers.utils import extras
11
  from Powers.utils.custom_filters import command
12
  from Powers.utils.extras import NOWYES as NO
13
  from Powers.utils.extras import YESWNO as YES
14
 
 
15
 
16
  @Gojo.on_message(command("shout"))
17
  async def fun_shout(_, m: Message):
 
31
  result = "".join(result)
32
  msg = "```\n" + result + "```"
33
  await m.reply_text(msg, parse_mode=enums.ParseMode.MARKDOWN)
 
34
  return
35
  except MessageTooLong as e:
36
  await m.reply_text(f"Error: {e}")
 
40
  @Gojo.on_message(command("runs"))
41
  async def fun_run(_, m: Message):
42
  await m.reply_text(choice(extras.RUN_STRINGS))
 
43
  return
44
 
45
 
 
75
 
76
  reply = temp.format(user1=user1, user2=user2, item=item, hits=hit, throws=throw)
77
  await reply_text(reply)
 
78
  return
79
 
80
 
 
82
  async def fun_roll(_, m: Message):
83
  reply_text = m.reply_to_message.reply_text if m.reply_to_message else m.reply_text
84
  await reply_text(choice(range(1, 7)))
 
85
  return
86
 
87
 
 
89
  async def fun_toss(_, m: Message):
90
  reply_text = m.reply_to_message.reply_text if m.reply_to_message else m.reply_text
91
  await reply_text(choice(extras.TOSS))
 
92
  return
93
 
94
 
 
101
  user_first_name = m.reply_to_message.from_user.first_name
102
  if user_id in DEV_USERS:
103
  await m.reply_text("Sorry! I can't insult my devs....")
 
 
 
104
  else:
105
  Insult_omp = choice(extras.INSULT_STRINGS)
106
  await m.reply_to_message.reply_text(Insult_omp)
 
107
 
108
 
109
  @Gojo.on_message(command("yes"))
 
111
  reply_text = m.reply_to_message.reply_text if m.reply_to_message else m.reply_text
112
  rtext = YES[0]
113
  await reply_text(rtext)
 
114
  return
115
 
116
 
 
119
  reply_text = m.reply_to_message.reply_text if m.reply_to_message else m.reply_text
120
  rtext = NO[0]
121
  await reply_text(rtext)
 
122
  return
123
 
124
 
 
126
  async def fun_shrug(_, m: Message):
127
  reply_text = m.reply_to_message.reply_text if m.reply_to_message else m.reply_text
128
  await reply_text(r"¯\_(ツ)_/¯")
 
129
  return
130
 
131
 
 
135
  await reply_text(
136
  "|| /BLUE /TEXT\n/MUST /CLICK\n/I /AM /A /STUPID /ANIMAL /THAT /IS /ATTRACTED /TO /COLORS ||",
137
  )
 
138
  return
139
 
140
 
 
142
  async def fun_decide(_, m: Message):
143
  reply_text = m.reply_to_message.reply_text if m.reply_to_message else m.reply_text
144
  await reply_text(choice(extras.DECIDE))
 
145
  return
146
 
147
 
 
149
  async def fun_table(_, m: Message):
150
  reply_text = m.reply_to_message.reply_text if m.reply_to_message else m.reply_text
151
  await reply_text(choice(extras.REACTIONS))
 
152
  return
153
 
154
 
 
182
  text=f"""<b>Weebified String:</b>
183
  <code>{string}</code>"""
184
  )
 
185
  return
186
 
187
 
Powers/plugins/greetings.py CHANGED
@@ -7,11 +7,10 @@ from pyrogram.enums import ChatMemberStatus as CMS
7
  from pyrogram.errors import ChannelPrivate, ChatAdminRequired, RPCError
8
  from pyrogram.types import ChatMemberUpdated, Message
9
 
10
- from Powers import LOGGER
11
  from Powers.bot_class import Gojo
12
  from Powers.database.antispam_db import GBan
13
  from Powers.database.greetings_db import Greetings
14
- from Powers.supports import get_support_staff
15
  from Powers.utils.cmd_senders import send_cmd
16
  from Powers.utils.custom_filters import admin_filter, bot_admin_filter, command
17
  from Powers.utils.kbhelpers import ikb
@@ -19,13 +18,10 @@ from Powers.utils.msg_types import Types, get_wlcm_type
19
  from Powers.utils.parser import escape_markdown, mention_html
20
  from Powers.utils.string import (build_keyboard, escape_invalid_curly_brackets,
21
  parse_button)
22
- from Powers.vars import Config
23
 
24
  # Initialize
25
  gdb = GBan()
26
 
27
- DEV_USERS = get_support_staff("dev")
28
-
29
  ChatType = enums.ChatType
30
 
31
 
@@ -243,11 +239,7 @@ async def cleannnnn(_, m: Message):
243
  @Gojo.on_chat_member_updated(filters.group, group=69)
244
  async def member_has_joined(c: Gojo, member: ChatMemberUpdated):
245
 
246
- if (
247
- member.new_chat_member
248
- and member.new_chat_member.status not in {CMS.BANNED, CMS.LEFT, CMS.RESTRICTED}
249
- and not member.old_chat_member
250
- ):
251
  pass
252
  else:
253
  return
@@ -263,7 +255,7 @@ async def member_has_joined(c: Gojo, member: ChatMemberUpdated):
263
  await c.send_animation(
264
  chat_id=member.chat.id,
265
  animation="./extras/william.gif",
266
- caption="😳 My **DEV** has also joined the chat!",
267
  )
268
  return
269
  if banned_users:
@@ -345,11 +337,7 @@ async def member_has_joined(c: Gojo, member: ChatMemberUpdated):
345
  @Gojo.on_chat_member_updated(filters.group, group=99)
346
  async def member_has_left(c: Gojo, member: ChatMemberUpdated):
347
 
348
- if (
349
- not member.new_chat_member
350
- and member.old_chat_member.status not in {CMS.BANNED, CMS.RESTRICTED}
351
- and member.old_chat_member
352
- ):
353
  pass
354
  else:
355
  return
@@ -395,7 +383,7 @@ async def member_has_left(c: Gojo, member: ChatMemberUpdated):
395
  if user.id in DEV_USERS:
396
  await c.send_message(
397
  member.chat.id,
398
- "Will miss you master :(",
399
  )
400
  return
401
  if not teks:
@@ -419,6 +407,8 @@ async def member_has_left(c: Gojo, member: ChatMemberUpdated):
419
  if ooo:
420
  db.set_cleangoodbye_id(int(ooo.id))
421
  return
 
 
422
  except RPCError as e:
423
  LOGGER.error(e)
424
  LOGGER.error(format_exc(e))
@@ -551,8 +541,6 @@ async def goodbye(c: Gojo, m: Message):
551
  reply_markup=button,
552
  )
553
  return
554
- return
555
-
556
 
557
  __PLUGIN__ = "greetings"
558
  __alt_name__ = ["welcome", "goodbye", "cleanservice"]
 
7
  from pyrogram.errors import ChannelPrivate, ChatAdminRequired, RPCError
8
  from pyrogram.types import ChatMemberUpdated, Message
9
 
10
+ from Powers import DEV_USERS, LOGGER
11
  from Powers.bot_class import Gojo
12
  from Powers.database.antispam_db import GBan
13
  from Powers.database.greetings_db import Greetings
 
14
  from Powers.utils.cmd_senders import send_cmd
15
  from Powers.utils.custom_filters import admin_filter, bot_admin_filter, command
16
  from Powers.utils.kbhelpers import ikb
 
18
  from Powers.utils.parser import escape_markdown, mention_html
19
  from Powers.utils.string import (build_keyboard, escape_invalid_curly_brackets,
20
  parse_button)
 
21
 
22
  # Initialize
23
  gdb = GBan()
24
 
 
 
25
  ChatType = enums.ChatType
26
 
27
 
 
239
  @Gojo.on_chat_member_updated(filters.group, group=69)
240
  async def member_has_joined(c: Gojo, member: ChatMemberUpdated):
241
 
242
+ if member.new_chat_member.status not in {CMS.BANNED, CMS.LEFT, CMS.RESTRICTED}:
 
 
 
 
243
  pass
244
  else:
245
  return
 
255
  await c.send_animation(
256
  chat_id=member.chat.id,
257
  animation="./extras/william.gif",
258
+ caption=f"😳 My **DEV** {user.mention} has also joined the chat!",
259
  )
260
  return
261
  if banned_users:
 
337
  @Gojo.on_chat_member_updated(filters.group, group=99)
338
  async def member_has_left(c: Gojo, member: ChatMemberUpdated):
339
 
340
+ if member.old_chat_member.status == CMS.LEFT:
 
 
 
 
341
  pass
342
  else:
343
  return
 
383
  if user.id in DEV_USERS:
384
  await c.send_message(
385
  member.chat.id,
386
+ f"Will miss you my master {user.mention} :(",
387
  )
388
  return
389
  if not teks:
 
407
  if ooo:
408
  db.set_cleangoodbye_id(int(ooo.id))
409
  return
410
+ except ChannelPrivate:
411
+ pass
412
  except RPCError as e:
413
  LOGGER.error(e)
414
  LOGGER.error(format_exc(e))
 
541
  reply_markup=button,
542
  )
543
  return
 
 
544
 
545
  __PLUGIN__ = "greetings"
546
  __alt_name__ = ["welcome", "goodbye", "cleanservice"]
Powers/plugins/info.py CHANGED
@@ -9,13 +9,11 @@ from pyrogram.raw.functions.channels import GetFullChannel
9
  from pyrogram.raw.functions.users import GetFullUser
10
  from pyrogram.types import Message
11
 
12
- from Powers import LOGGER, OWNER_ID
13
  from Powers.bot_class import Gojo
14
  from Powers.database.antispam_db import GBan
15
- from Powers.supports import get_support_staff
16
  from Powers.utils.custom_filters import command
17
  from Powers.utils.extract_user import extract_user
18
- from Powers.vars import Config
19
 
20
  gban_db = GBan()
21
 
@@ -83,10 +81,7 @@ async def user_info(c: Gojo, user, already=False):
83
  about = ll.full_user.about
84
  except Exception:
85
  pass
86
- SUPPORT_STAFF = get_support_staff()
87
- DEV_USERS = get_support_staff("dev")
88
- SUDO_USERS = get_support_staff("sudo")
89
- WHITELIST_USERS = get_support_staff("whitelist")
90
  username = user.username
91
  first_name = user.first_name
92
  last_name = user.last_name
@@ -246,8 +241,12 @@ async def info_func(c: Gojo, message: Message):
246
  if message.reply_to_message and message.reply_to_message.sender_chat:
247
  await message.reply_text("This is not a user, but rather a channel. Use `/chinfo` to fetch its information.")
248
  return
249
- user, _, user_name = await extract_user(c, message)
250
-
 
 
 
 
251
  if not user:
252
  await message.reply_text("Can't find user to fetch info!")
253
 
@@ -285,6 +284,10 @@ async def info_func(c: Gojo, message: Message):
285
  LOGGER.error(rpc)
286
  LOGGER.error(format_exc())
287
  except Exception as e:
 
 
 
 
288
  await message.reply_text(text=e)
289
  LOGGER.error(e)
290
  LOGGER.error(format_exc())
 
9
  from pyrogram.raw.functions.users import GetFullUser
10
  from pyrogram.types import Message
11
 
12
+ from Powers import DEV_USERS, LOGGER, OWNER_ID, SUDO_USERS, WHITELIST_USERS
13
  from Powers.bot_class import Gojo
14
  from Powers.database.antispam_db import GBan
 
15
  from Powers.utils.custom_filters import command
16
  from Powers.utils.extract_user import extract_user
 
17
 
18
  gban_db = GBan()
19
 
 
81
  about = ll.full_user.about
82
  except Exception:
83
  pass
84
+ SUPPORT_STAFF = DEV_USERS.union(SUDO_USERS).union(WHITELIST_USERS)
 
 
 
85
  username = user.username
86
  first_name = user.first_name
87
  last_name = user.last_name
 
241
  if message.reply_to_message and message.reply_to_message.sender_chat:
242
  await message.reply_text("This is not a user, but rather a channel. Use `/chinfo` to fetch its information.")
243
  return
244
+ try:
245
+ user, _, user_name = await extract_user(c, message)
246
+ except:
247
+ await message.reply_text("Got Some errors failed to fetch user info")
248
+ LOGGER.error(e)
249
+ LOGGER.error(format_exc)
250
  if not user:
251
  await message.reply_text("Can't find user to fetch info!")
252
 
 
284
  LOGGER.error(rpc)
285
  LOGGER.error(format_exc())
286
  except Exception as e:
287
+ if e == "User not found ! Error: 'InputPeerChannel' object has no attribute 'user_id'":
288
+ await m.reply_text("Looks like you are trying to fetch info of a chat not an user. In that case please use /chinfo")
289
+ return
290
+
291
  await message.reply_text(text=e)
292
  LOGGER.error(e)
293
  LOGGER.error(format_exc())
Powers/plugins/locks.py CHANGED
@@ -8,15 +8,13 @@ from pyrogram.enums import MessageServiceType as MST
8
  from pyrogram.errors import ChatAdminRequired, ChatNotModified, RPCError
9
  from pyrogram.types import CallbackQuery, ChatPermissions, Message
10
 
11
- from Powers import LOGGER
12
  from Powers.bot_class import Gojo
13
  from Powers.database.approve_db import Approve
14
  from Powers.database.locks_db import LOCKS
15
- from Powers.supports import get_support_staff
16
  from Powers.utils.caching import ADMIN_CACHE, admin_cache_reload
17
  from Powers.utils.custom_filters import command, restrict_filter
18
  from Powers.utils.kbhelpers import ikb
19
- from Powers.vars import Config
20
 
21
  l_t = """
22
  **Lock Types:**
@@ -77,8 +75,6 @@ async def lock_perm(c: Gojo, m: Message):
77
  try:
78
  await c.set_chat_permissions(chat_id, ChatPermissions())
79
  lock.insert_lock_channel(m.chat.id, "all")
80
- LOGGER.info(
81
- f"{m.from_user.id} locked all permissions in {m.chat.id}")
82
  except ChatNotModified:
83
  pass
84
  except ChatAdminRequired:
@@ -195,8 +191,6 @@ Use /locktypes to get the lock types"""
195
  can_pin_messages=pin,
196
  ),
197
  )
198
- LOGGER.info(
199
- f"{m.from_user.id} locked selected permissions in {m.chat.id}")
200
  except ChatNotModified:
201
  pass
202
  except ChatAdminRequired:
@@ -219,12 +213,12 @@ async def view_locks(_, m: Message):
219
  return "❌"
220
 
221
  lock = LOCKS()
222
- anon = lock.get_lock_channel("anti_c_send", m.chat.id)
223
- anti_f = lock.get_lock_channel("anti_fwd", m.chat.id)
224
- anti_f_u = lock.get_lock_channel("anti_fwd_u", m.chat.id)
225
- anti_f_c = lock.get_lock_channel("anti_fwd_c", m.chat.id)
226
- antil = lock.get_lock_channel("anti_links", m.chat.id)
227
- bots = lock.get_lock_channel("bot", m.chat.id)
228
 
229
  vmsg = await convert_to_emoji(v_perm.can_send_messages)
230
  vmedia = await convert_to_emoji(v_perm.can_send_media_messages)
@@ -261,11 +255,8 @@ async def view_locks(_, m: Message):
261
  <b>Can forward from user:</b> {vantiu}
262
  <b>Can forward from channel and chats:</b> {vantic}
263
  <b>Can send links:</b> {vantil}
264
- <b>Can send links:</b> {vantibot}
265
  """
266
- LOGGER.info(f"{m.from_user.id} used locks cmd in {m.chat.id}")
267
- await chkmsg.edit_text(permission_view_str)
268
-
269
  except RPCError as e_f:
270
  await chkmsg.edit_text(text="Something went wrong!")
271
  await m.reply_text(e_f)
@@ -301,8 +292,6 @@ async def unlock_perm(c: Gojo, m: Message):
301
  ),
302
  )
303
  lock.remove_lock_channel(m.chat.id, "all")
304
- LOGGER.info(
305
- f"{m.from_user.id} unlocked all permissions in {m.chat.id}")
306
  except ChatNotModified:
307
  pass
308
  except ChatAdminRequired:
@@ -424,8 +413,6 @@ async def unlock_perm(c: Gojo, m: Message):
424
  return
425
 
426
  try:
427
- LOGGER.info(
428
- f"{m.from_user.id} unlocked selected permissions in {m.chat.id}")
429
  await c.set_chat_permissions(
430
  chat_id,
431
  ChatPermissions(
@@ -470,7 +457,7 @@ async def is_approved_user(c: Gojo, m: Message):
470
  except KeyError:
471
  admins_group = await admin_cache_reload(m, "lock")
472
 
473
- SUDO_LEVEL = get_support_staff("sudo_level")
474
 
475
  if m.forward_from:
476
  if m.from_user and (m.from_user.id in ul or m.from_user.id in SUDO_LEVEL or m.from_user.id in admins_group or m.from_user.id == c.me.id):
@@ -488,6 +475,8 @@ async def is_approved_user(c: Gojo, m: Message):
488
  if m.from_user.id in ul or m.from_user.id in SUDO_LEVEL or m.from_user.id in admins_group or m.from_user.id == c.me.id:
489
  return True
490
  return False
 
 
491
 
492
 
493
  @Gojo.on_message(filters.service & filters.group, 19)
@@ -512,13 +501,12 @@ async def servicess(c: Gojo, m: Message):
512
  @Gojo.on_message(filters.group & ~filters.me, 18)
513
  async def lock_del_mess(c: Gojo, m: Message):
514
  lock = LOCKS()
515
- all_chats = lock.get_lock_channel()
516
- if not all_chats:
517
  return
518
- if m.chat and m.chat.id not in all_chats:
519
- return
520
- if m.sender_chat and not (m.forward_from_chat or m.forward_from):
521
- if m.sender_chat.id == m.chat.id:
522
  return
523
  await delete_messages(c, m)
524
  return
@@ -526,19 +514,19 @@ async def lock_del_mess(c: Gojo, m: Message):
526
  if is_approved:
527
  return
528
  entity = m.entities if m.text else m.caption_entities
529
- if entity:
530
  for i in entity:
531
  if i.type in [MET.URL or MET.TEXT_LINK]:
532
  await delete_messages(c, m)
533
  return
534
- elif m.forward_from or m.forward_from_chat:
535
- if lock.is_particular_lock(m.chat.id, "anti_fwd"):
536
  await delete_messages(c, m)
537
  return
538
- elif lock.is_particular_lock(m.chat.id, "anti_fwd_u") and not m.forward_from_chat:
539
  await delete_messages(c, m)
540
  return
541
- elif lock.is_particular_lock(m.chat.id, "anti_fwd_c") and m.forward_from_chat:
542
  await delete_messages(c, m)
543
  return
544
 
@@ -551,7 +539,6 @@ async def prevent_approved(m: Message):
551
  await m.chat.unban_member(user_id=i)
552
  except (ChatAdminRequired, ChatNotModified, RPCError):
553
  continue
554
- LOGGER.info(f"Approved {i} in {m.chat.id}")
555
  await sleep(0.1)
556
  return
557
 
 
8
  from pyrogram.errors import ChatAdminRequired, ChatNotModified, RPCError
9
  from pyrogram.types import CallbackQuery, ChatPermissions, Message
10
 
11
+ from Powers import DEV_USERS, LOGGER, SUDO_USERS
12
  from Powers.bot_class import Gojo
13
  from Powers.database.approve_db import Approve
14
  from Powers.database.locks_db import LOCKS
 
15
  from Powers.utils.caching import ADMIN_CACHE, admin_cache_reload
16
  from Powers.utils.custom_filters import command, restrict_filter
17
  from Powers.utils.kbhelpers import ikb
 
18
 
19
  l_t = """
20
  **Lock Types:**
 
75
  try:
76
  await c.set_chat_permissions(chat_id, ChatPermissions())
77
  lock.insert_lock_channel(m.chat.id, "all")
 
 
78
  except ChatNotModified:
79
  pass
80
  except ChatAdminRequired:
 
191
  can_pin_messages=pin,
192
  ),
193
  )
 
 
194
  except ChatNotModified:
195
  pass
196
  except ChatAdminRequired:
 
213
  return "❌"
214
 
215
  lock = LOCKS()
216
+ anon = lock.get_lock_channel(m.chat.id, "anti_c_send")
217
+ anti_f = lock.get_lock_channel(m.chat.id, "anti_fwd")
218
+ anti_f_u = lock.get_lock_channel(m.chat.id, "anti_fwd_u")
219
+ anti_f_c = lock.get_lock_channel(m.chat.id, "anti_fwd_c")
220
+ antil = lock.get_lock_channel(m.chat.id, "anti_links")
221
+ bots = lock.get_lock_channel(m.chat.id, "bot")
222
 
223
  vmsg = await convert_to_emoji(v_perm.can_send_messages)
224
  vmedia = await convert_to_emoji(v_perm.can_send_media_messages)
 
255
  <b>Can forward from user:</b> {vantiu}
256
  <b>Can forward from channel and chats:</b> {vantic}
257
  <b>Can send links:</b> {vantil}
258
+ <b>Can bot send messages:</b> {vantibot}
259
  """
 
 
 
260
  except RPCError as e_f:
261
  await chkmsg.edit_text(text="Something went wrong!")
262
  await m.reply_text(e_f)
 
292
  ),
293
  )
294
  lock.remove_lock_channel(m.chat.id, "all")
 
 
295
  except ChatNotModified:
296
  pass
297
  except ChatAdminRequired:
 
413
  return
414
 
415
  try:
 
 
416
  await c.set_chat_permissions(
417
  chat_id,
418
  ChatPermissions(
 
457
  except KeyError:
458
  admins_group = await admin_cache_reload(m, "lock")
459
 
460
+ SUDO_LEVEL = DEV_USERS.union(SUDO_USERS)
461
 
462
  if m.forward_from:
463
  if m.from_user and (m.from_user.id in ul or m.from_user.id in SUDO_LEVEL or m.from_user.id in admins_group or m.from_user.id == c.me.id):
 
475
  if m.from_user.id in ul or m.from_user.id in SUDO_LEVEL or m.from_user.id in admins_group or m.from_user.id == c.me.id:
476
  return True
477
  return False
478
+ else:
479
+ return False
480
 
481
 
482
  @Gojo.on_message(filters.service & filters.group, 19)
 
501
  @Gojo.on_message(filters.group & ~filters.me, 18)
502
  async def lock_del_mess(c: Gojo, m: Message):
503
  lock = LOCKS()
504
+ chat_locks = lock.get_lock_channel(m.chat.id)
505
+ if not chat_locks:
506
  return
507
+
508
+ if chat_locks["anti_channel"] and m.sender_chat and not (m.forward_from_chat or m.forward_from):
509
+ if m.chat.is_admin:
 
510
  return
511
  await delete_messages(c, m)
512
  return
 
514
  if is_approved:
515
  return
516
  entity = m.entities if m.text else m.caption_entities
517
+ if entity and chat_locks["anti_links"]:
518
  for i in entity:
519
  if i.type in [MET.URL or MET.TEXT_LINK]:
520
  await delete_messages(c, m)
521
  return
522
+ elif any(chat_locks["anti_fwd"].values()) and (m.forward_from or m.forward_from_chat):
523
+ if all(chat_locks["anti_fwd"].values()):
524
  await delete_messages(c, m)
525
  return
526
+ elif chat_locks["anti_fwd"]["user"] and not m.forward_from_chat:
527
  await delete_messages(c, m)
528
  return
529
+ elif chat_locks["anti_fwd"]["chat"] and m.forward_from_chat:
530
  await delete_messages(c, m)
531
  return
532
 
 
539
  await m.chat.unban_member(user_id=i)
540
  except (ChatAdminRequired, ChatNotModified, RPCError):
541
  continue
 
542
  await sleep(0.1)
543
  return
544
 
Powers/plugins/muting.py CHANGED
@@ -9,16 +9,14 @@ from pyrogram.types import (CallbackQuery, ChatPermissions,
9
  InlineKeyboardButton, InlineKeyboardMarkup,
10
  Message)
11
 
12
- from Powers import LOGGER, MESSAGE_DUMP, OWNER_ID
13
  from Powers.bot_class import Gojo
14
- from Powers.supports import get_support_staff
15
  from Powers.utils.caching import ADMIN_CACHE, admin_cache_reload
16
  from Powers.utils.custom_filters import command, restrict_filter
17
  from Powers.utils.extract_user import extract_user
18
  from Powers.utils.extras import MUTE_GIFS
19
  from Powers.utils.parser import mention_html
20
  from Powers.utils.string import extract_time
21
- from Powers.vars import Config
22
 
23
 
24
  @Gojo.on_message(command("tmute") & restrict_filter)
@@ -39,12 +37,10 @@ async def tmute_usr(c: Gojo, m: Message):
39
  await m.reply_text("Huh, why would I mute myself?")
40
  return
41
 
42
- SUPPORT_STAFF = get_support_staff()
43
 
44
  if user_id in SUPPORT_STAFF:
45
- LOGGER.info(
46
- f"{m.from_user.id} trying to mute {user_id} (SUPPORT_STAFF) in {m.chat.id}",
47
- )
48
  await m.reply_text(
49
  text="This user is in my support staff, cannot restrict them."
50
  )
@@ -87,7 +83,6 @@ async def tmute_usr(c: Gojo, m: Message):
87
  ChatPermissions(),
88
  mutetime,
89
  )
90
- LOGGER.info(f"{m.from_user.id} tmuted {user_id} in {m.chat.id}")
91
  admin = await mention_html(m.from_user.first_name, m.from_user.id)
92
  muted = await mention_html(user_first_name, user_id)
93
  txt = f"Admin {admin} muted {muted}!"
@@ -153,11 +148,9 @@ async def dtmute_usr(c: Gojo, m: Message):
153
  await m.reply_text("Huh, why would I mute myself?")
154
  return
155
 
156
- SUPPORT_STAFF = get_support_staff()
157
  if user_id in SUPPORT_STAFF:
158
- LOGGER.info(
159
- f"{m.from_user.id} trying to mute {user_id} (SUPPORT_STAFF) in {m.chat.id}",
160
- )
161
  await m.reply_text(
162
  text="This user is in my support staff, cannot restrict them."
163
  )
@@ -198,7 +191,6 @@ async def dtmute_usr(c: Gojo, m: Message):
198
  ChatPermissions(),
199
  mutetime,
200
  )
201
- LOGGER.info(f"{m.from_user.id} dtmuted {user_id} in {m.chat.id}")
202
  await m.reply_to_message.delete()
203
  admin = await mention_html(m.from_user.first_name, m.from_user.id)
204
  muted = await mention_html(user_first_name, user_id)
@@ -262,11 +254,8 @@ async def stmute_usr(c: Gojo, m: Message):
262
  await m.reply_text("Huh, why would I mute myself?")
263
  return
264
 
265
- SUPPORT_STAFF = get_support_staff()
266
  if user_id in SUPPORT_STAFF:
267
- LOGGER.info(
268
- f"{m.from_user.id} trying to mute {user_id} (SUPPORT_STAFF) in {m.chat.id}",
269
- )
270
  await m.reply_text(
271
  text="This user is in my support staff, cannot restrict them."
272
  )
@@ -308,7 +297,6 @@ async def stmute_usr(c: Gojo, m: Message):
308
  ChatPermissions(),
309
  mutetime,
310
  )
311
- LOGGER.info(f"{m.from_user.id} stmuted {user_id} in {m.chat.id}")
312
  await m.delete()
313
  if m.reply_to_message:
314
  await m.reply_to_message.delete()
@@ -356,11 +344,9 @@ async def mute_usr(c: Gojo, m: Message):
356
  await m.reply_text("Huh, why would I mute myself?")
357
  return
358
 
359
- SUPPORT_STAFF = get_support_staff()
360
  if user_id in SUPPORT_STAFF:
361
- LOGGER.info(
362
- f"{m.from_user.id} trying to mute {user_id} (SUPPORT_STAFF) in {m.chat.id}",
363
- )
364
  await m.reply_text(
365
  text="This user is in my support staff, cannot restrict them."
366
  )
@@ -380,7 +366,6 @@ async def mute_usr(c: Gojo, m: Message):
380
  user_id,
381
  ChatPermissions(),
382
  )
383
- LOGGER.info(f"{m.from_user.id} muted {user_id} in {m.chat.id}")
384
  admin = await mention_html(m.from_user.first_name, m.from_user.id)
385
  muted = await mention_html(user_first_name, user_id)
386
  txt = f"Admin {admin} muted {muted}!"
@@ -442,12 +427,9 @@ async def smute_usr(c: Gojo, m: Message):
442
  await m.reply_text("Huh, why would I mute myself?")
443
  return
444
 
445
- SUPPORT_STAFF = get_support_staff()
446
 
447
  if user_id in SUPPORT_STAFF:
448
- LOGGER.info(
449
- f"{m.from_user.id} trying to mute {user_id} (SUPPORT_STAFF) in {m.chat.id}",
450
- )
451
  await m.reply_text(
452
  text="This user is in my support staff, cannot restrict them."
453
  )
@@ -467,7 +449,6 @@ async def smute_usr(c: Gojo, m: Message):
467
  user_id,
468
  ChatPermissions(),
469
  )
470
- LOGGER.info(f"{m.from_user.id} smuted {user_id} in {m.chat.id}")
471
  await m.delete()
472
  if m.reply_to_message:
473
  await m.reply_to_message.delete()
@@ -516,11 +497,8 @@ async def dmute_usr(c: Gojo, m: Message):
516
  return
517
 
518
 
519
- SUPPORT_STAFF = get_support_staff()
520
  if user_id in SUPPORT_STAFF:
521
- LOGGER.info(
522
- f"{m.from_user.id} trying to mute {user_id} (SUPPORT_STAFF) in {m.chat.id}",
523
- )
524
  await m.reply_text(
525
  text="This user is in my support staff, cannot restrict them."
526
  )
@@ -540,7 +518,6 @@ async def dmute_usr(c: Gojo, m: Message):
540
  user_id,
541
  ChatPermissions(),
542
  )
543
- LOGGER.info(f"{m.from_user.id} dmuted {user_id} in {m.chat.id}")
544
  await m.reply_to_message.delete()
545
  admin = await mention_html(m.from_user.first_name, m.from_user.id)
546
  muted = await mention_html(user_first_name, user_id)
@@ -608,7 +585,6 @@ async def unmute_usr(c: Gojo, m: Message):
608
  LOGGER.exception(format_exc())
609
  try:
610
  await m.chat.unban_member(user_id)
611
- LOGGER.info(f"{m.from_user.id} unmuted {user_id} in {m.chat.id}")
612
  admin = await mention_html(m.from_user.first_name, m.from_user.id)
613
  unmuted = await mention_html(user_first_name, user_id)
614
  await m.reply_text(text=f"Admin {admin} unmuted {unmuted}!")
 
9
  InlineKeyboardButton, InlineKeyboardMarkup,
10
  Message)
11
 
12
+ from Powers import DEV_USERS, LOGGER, MESSAGE_DUMP, SUDO_USERS, WHITELIST_USERS
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
16
  from Powers.utils.extract_user import extract_user
17
  from Powers.utils.extras import MUTE_GIFS
18
  from Powers.utils.parser import mention_html
19
  from Powers.utils.string import extract_time
 
20
 
21
 
22
  @Gojo.on_message(command("tmute") & restrict_filter)
 
37
  await m.reply_text("Huh, why would I mute myself?")
38
  return
39
 
40
+ SUPPORT_STAFF = DEV_USERS.union(SUDO_USERS).union(WHITELIST_USERS)
41
 
42
  if user_id in SUPPORT_STAFF:
43
+
 
 
44
  await m.reply_text(
45
  text="This user is in my support staff, cannot restrict them."
46
  )
 
83
  ChatPermissions(),
84
  mutetime,
85
  )
 
86
  admin = await mention_html(m.from_user.first_name, m.from_user.id)
87
  muted = await mention_html(user_first_name, user_id)
88
  txt = f"Admin {admin} muted {muted}!"
 
148
  await m.reply_text("Huh, why would I mute myself?")
149
  return
150
 
151
+ SUPPORT_STAFF = DEV_USERS.union(SUDO_USERS).union(WHITELIST_USERS)
152
  if user_id in SUPPORT_STAFF:
153
+
 
 
154
  await m.reply_text(
155
  text="This user is in my support staff, cannot restrict them."
156
  )
 
191
  ChatPermissions(),
192
  mutetime,
193
  )
 
194
  await m.reply_to_message.delete()
195
  admin = await mention_html(m.from_user.first_name, m.from_user.id)
196
  muted = await mention_html(user_first_name, user_id)
 
254
  await m.reply_text("Huh, why would I mute myself?")
255
  return
256
 
257
+ SUPPORT_STAFF = DEV_USERS.union(SUDO_USERS).union(WHITELIST_USERS)
258
  if user_id in SUPPORT_STAFF:
 
 
 
259
  await m.reply_text(
260
  text="This user is in my support staff, cannot restrict them."
261
  )
 
297
  ChatPermissions(),
298
  mutetime,
299
  )
 
300
  await m.delete()
301
  if m.reply_to_message:
302
  await m.reply_to_message.delete()
 
344
  await m.reply_text("Huh, why would I mute myself?")
345
  return
346
 
347
+ SUPPORT_STAFF = DEV_USERS.union(SUDO_USERS).union(WHITELIST_USERS)
348
  if user_id in SUPPORT_STAFF:
349
+
 
 
350
  await m.reply_text(
351
  text="This user is in my support staff, cannot restrict them."
352
  )
 
366
  user_id,
367
  ChatPermissions(),
368
  )
 
369
  admin = await mention_html(m.from_user.first_name, m.from_user.id)
370
  muted = await mention_html(user_first_name, user_id)
371
  txt = f"Admin {admin} muted {muted}!"
 
427
  await m.reply_text("Huh, why would I mute myself?")
428
  return
429
 
430
+ SUPPORT_STAFF = DEV_USERS.union(SUDO_USERS).union(WHITELIST_USERS)
431
 
432
  if user_id in SUPPORT_STAFF:
 
 
 
433
  await m.reply_text(
434
  text="This user is in my support staff, cannot restrict them."
435
  )
 
449
  user_id,
450
  ChatPermissions(),
451
  )
 
452
  await m.delete()
453
  if m.reply_to_message:
454
  await m.reply_to_message.delete()
 
497
  return
498
 
499
 
500
+ SUPPORT_STAFF = DEV_USERS.union(SUDO_USERS).union(WHITELIST_USERS)
501
  if user_id in SUPPORT_STAFF:
 
 
 
502
  await m.reply_text(
503
  text="This user is in my support staff, cannot restrict them."
504
  )
 
518
  user_id,
519
  ChatPermissions(),
520
  )
 
521
  await m.reply_to_message.delete()
522
  admin = await mention_html(m.from_user.first_name, m.from_user.id)
523
  muted = await mention_html(user_first_name, user_id)
 
585
  LOGGER.exception(format_exc())
586
  try:
587
  await m.chat.unban_member(user_id)
 
588
  admin = await mention_html(m.from_user.first_name, m.from_user.id)
589
  unmuted = await mention_html(user_first_name, user_id)
590
  await m.reply_text(text=f"Admin {admin} unmuted {unmuted}!")
Powers/plugins/notes.py CHANGED
@@ -4,7 +4,7 @@ from traceback import format_exc
4
  from pyrogram import enums, filters
5
  from pyrogram.enums import ChatMemberStatus as CMS
6
  from pyrogram.errors import RPCError
7
- from pyrogram.types import CallbackQuery, InlineKeyboardMarkup, Message
8
 
9
  from Powers import LOGGER
10
  from Powers.bot_class import Gojo
@@ -16,7 +16,6 @@ from Powers.utils.msg_types import Types, get_note_type
16
  from Powers.utils.string import (build_keyboard,
17
  escape_mentions_using_curly_brackets,
18
  parse_button)
19
- from Powers.vars import Config
20
 
21
  # Initialise
22
  db = Notes()
@@ -60,7 +59,6 @@ async def save_note(_, m: Message):
60
  return
61
 
62
  db.save_note(m.chat.id, note_name, text, data_type, content)
63
- LOGGER.info(f"{m.from_user.id} saved note ({note_name}) in {m.chat.id}")
64
  await m.reply_text(
65
  f"Saved note <code>{note_name}</code>!\nGet it with <code>/get {note_name}</code> or <code>#{note_name}</code>",
66
  )
@@ -194,9 +192,7 @@ async def get_note_func(c: Gojo, m: Message, note_name, priv_notes_status):
194
  reply_markup=button,
195
  reply_to_message_id=reply_msg_id,
196
  )
197
- LOGGER.info(
198
- f"{m.from_user.id} fetched note {note_name} (type - {getnotes}) in {m.chat.id}",
199
- )
200
  except Exception as e:
201
  await m.reply_text(f"Error in notes: {e}")
202
  return
@@ -245,9 +241,7 @@ async def get_raw_note(c: Gojo, m: Message, note: str):
245
  parse_mode=enums.ParseMode.DISABLED,
246
  reply_to_message_id=msg_id,
247
  )
248
- LOGGER.info(
249
- f"{m.from_user.id} fetched raw note {note} (type - {getnotes}) in {m.chat.id}",
250
- )
251
  return
252
 
253
 
@@ -302,11 +296,9 @@ async def priv_notes(_, m: Message):
302
  option = (m.text.split())[1]
303
  if option in ("on", "yes"):
304
  db_settings.set_privatenotes(chat_id, True)
305
- LOGGER.info(f"{m.from_user.id} enabled privatenotes in {m.chat.id}")
306
  msg = "Set private notes to On"
307
  elif option in ("off", "no"):
308
  db_settings.set_privatenotes(chat_id, False)
309
- LOGGER.info(f"{m.from_user.id} disabled privatenotes in {m.chat.id}")
310
  msg = "Set private notes to Off"
311
  else:
312
  msg = "Enter correct option"
@@ -314,7 +306,6 @@ async def priv_notes(_, m: Message):
314
  elif len(m.text.split()) == 1:
315
  curr_pref = db_settings.get_privatenotes(m.chat.id)
316
  msg = msg = f"Private Notes: {curr_pref}"
317
- LOGGER.info(f"{m.from_user.id} fetched privatenotes preference in {m.chat.id}")
318
  await m.reply_text(msg)
319
  else:
320
  await m.replt_text("Check help on how to use this command!")
@@ -324,7 +315,6 @@ async def priv_notes(_, m: Message):
324
 
325
  @Gojo.on_message(command("notes") & filters.group & ~filters.bot)
326
  async def local_notes(c: Gojo, m: Message):
327
- LOGGER.info(f"{m.from_user.id} listed all notes in {m.chat.id}")
328
  getnotes = db.get_all_notes(m.chat.id)
329
 
330
  if not getnotes:
@@ -372,7 +362,6 @@ async def clear_note(_, m: Message):
372
 
373
  note = m.text.split()[1].lower()
374
  getnote = db.rm_note(m.chat.id, note)
375
- LOGGER.info(f"{m.from_user.id} cleared note ({note}) in {m.chat.id}")
376
  if not getnote:
377
  await m.reply_text("This note does not exist!")
378
  return
@@ -415,7 +404,6 @@ async def clearallnotes_callback(_, q: CallbackQuery):
415
  )
416
  return
417
  db.rm_all_notes(q.message.chat.id)
418
- LOGGER.info(f"{user_id} removed all notes in {q.message.chat.id}")
419
  await q.message.edit_text("Cleared all notes!")
420
  return
421
 
 
4
  from pyrogram import enums, filters
5
  from pyrogram.enums import ChatMemberStatus as CMS
6
  from pyrogram.errors import RPCError
7
+ from pyrogram.types import CallbackQuery, Message
8
 
9
  from Powers import LOGGER
10
  from Powers.bot_class import Gojo
 
16
  from Powers.utils.string import (build_keyboard,
17
  escape_mentions_using_curly_brackets,
18
  parse_button)
 
19
 
20
  # Initialise
21
  db = Notes()
 
59
  return
60
 
61
  db.save_note(m.chat.id, note_name, text, data_type, content)
 
62
  await m.reply_text(
63
  f"Saved note <code>{note_name}</code>!\nGet it with <code>/get {note_name}</code> or <code>#{note_name}</code>",
64
  )
 
192
  reply_markup=button,
193
  reply_to_message_id=reply_msg_id,
194
  )
195
+
 
 
196
  except Exception as e:
197
  await m.reply_text(f"Error in notes: {e}")
198
  return
 
241
  parse_mode=enums.ParseMode.DISABLED,
242
  reply_to_message_id=msg_id,
243
  )
244
+
 
 
245
  return
246
 
247
 
 
296
  option = (m.text.split())[1]
297
  if option in ("on", "yes"):
298
  db_settings.set_privatenotes(chat_id, True)
 
299
  msg = "Set private notes to On"
300
  elif option in ("off", "no"):
301
  db_settings.set_privatenotes(chat_id, False)
 
302
  msg = "Set private notes to Off"
303
  else:
304
  msg = "Enter correct option"
 
306
  elif len(m.text.split()) == 1:
307
  curr_pref = db_settings.get_privatenotes(m.chat.id)
308
  msg = msg = f"Private Notes: {curr_pref}"
 
309
  await m.reply_text(msg)
310
  else:
311
  await m.replt_text("Check help on how to use this command!")
 
315
 
316
  @Gojo.on_message(command("notes") & filters.group & ~filters.bot)
317
  async def local_notes(c: Gojo, m: Message):
 
318
  getnotes = db.get_all_notes(m.chat.id)
319
 
320
  if not getnotes:
 
362
 
363
  note = m.text.split()[1].lower()
364
  getnote = db.rm_note(m.chat.id, note)
 
365
  if not getnote:
366
  await m.reply_text("This note does not exist!")
367
  return
 
404
  )
405
  return
406
  db.rm_all_notes(q.message.chat.id)
 
407
  await q.message.edit_text("Cleared all notes!")
408
  return
409
 
Powers/plugins/pin.py CHANGED
@@ -26,9 +26,7 @@ async def pin_message(_, m: Message):
26
  await m.reply_to_message.pin(
27
  disable_notification=disable_notification,
28
  )
29
- LOGGER.info(
30
- f"{m.from_user.id} pinned msgid-{m.reply_to_message.id} in {m.chat.id}",
31
- )
32
 
33
  if m.chat.username:
34
  # If chat has a username, use this format
@@ -71,9 +69,7 @@ async def unpin_message(c: Gojo, m: Message):
71
  try:
72
  if m.reply_to_message:
73
  await m.reply_to_message.unpin()
74
- LOGGER.info(
75
- f"{m.from_user.id} unpinned msgid: {m.reply_to_message.id} in {m.chat.id}",
76
- )
77
  await m.reply_text(text="Unpinned last message.")
78
  else:
79
  m_id = (await c.get_chat(m.chat.id)).pinned_message.id
@@ -121,7 +117,6 @@ async def unpinall_calllback(c: Gojo, q: CallbackQuery):
121
  return
122
  try:
123
  await c.unpin_all_chat_messages(q.message.chat.id)
124
- LOGGER.info(f"{q.from_user.id} unpinned all messages in {q.message.chat.id}")
125
  await q.message.edit_text(text="Unpinned all messages in this chat.")
126
  except ChatAdminRequired:
127
  await q.message.edit_text(text="I'm not admin or I don't have rights.")
@@ -149,11 +144,9 @@ async def anti_channel_pin(_, m: Message):
149
  if len(m.text.split()) == 2:
150
  if m.command[1] in ("yes", "on", "true"):
151
  pinsdb.antichannelpin_on()
152
- LOGGER.info(f"{m.from_user.id} enabled antichannelpin in {m.chat.id}")
153
  msg = "Turned on AntiChannelPin, now all message pinned by channel will be unpinned automtically!"
154
  elif m.command[1] in ("no", "off", "false"):
155
  pinsdb.antichannelpin_off()
156
- LOGGER.info(f"{m.from_user.id} disabled antichannelpin in {m.chat.id}")
157
  msg = "Turned off AntiChannelPin, now all message pinned by channel will stay pinned!"
158
  else:
159
  await m.reply_text(
@@ -201,11 +194,9 @@ async def clean_linked(_, m: Message):
201
  if len(m.text.split()) == 2:
202
  if m.command[1] in ("yes", "on", "true"):
203
  pinsdb.cleanlinked_on()
204
- LOGGER.info(f"{m.from_user.id} enabled CleanLinked in {m.chat.id}")
205
  msg = "Turned on CleanLinked! Now all the messages from linked channel will be deleted!"
206
  elif m.command[1] in ("no", "off", "false"):
207
  pinsdb.cleanlinked_off()
208
- LOGGER.info(f"{m.from_user.id} disabled CleanLinked in {m.chat.id}")
209
  msg = "Turned off CleanLinked! Messages from linked channel will not be deleted!"
210
  else:
211
  await m.reply_text(
@@ -220,7 +211,6 @@ async def clean_linked(_, m: Message):
220
  @Gojo.on_message(command("permapin") & admin_filter)
221
  async def perma_pin(_, m: Message):
222
  if m.reply_to_message or len(m.text.split()) > 1:
223
- LOGGER.info(f"{m.from_user.id} used permampin in {m.chat.id}")
224
  if m.reply_to_message:
225
  text = m.reply_to_message.text
226
  elif len(m.text.split()) > 1:
 
26
  await m.reply_to_message.pin(
27
  disable_notification=disable_notification,
28
  )
29
+
 
 
30
 
31
  if m.chat.username:
32
  # If chat has a username, use this format
 
69
  try:
70
  if m.reply_to_message:
71
  await m.reply_to_message.unpin()
72
+
 
 
73
  await m.reply_text(text="Unpinned last message.")
74
  else:
75
  m_id = (await c.get_chat(m.chat.id)).pinned_message.id
 
117
  return
118
  try:
119
  await c.unpin_all_chat_messages(q.message.chat.id)
 
120
  await q.message.edit_text(text="Unpinned all messages in this chat.")
121
  except ChatAdminRequired:
122
  await q.message.edit_text(text="I'm not admin or I don't have rights.")
 
144
  if len(m.text.split()) == 2:
145
  if m.command[1] in ("yes", "on", "true"):
146
  pinsdb.antichannelpin_on()
 
147
  msg = "Turned on AntiChannelPin, now all message pinned by channel will be unpinned automtically!"
148
  elif m.command[1] in ("no", "off", "false"):
149
  pinsdb.antichannelpin_off()
 
150
  msg = "Turned off AntiChannelPin, now all message pinned by channel will stay pinned!"
151
  else:
152
  await m.reply_text(
 
194
  if len(m.text.split()) == 2:
195
  if m.command[1] in ("yes", "on", "true"):
196
  pinsdb.cleanlinked_on()
 
197
  msg = "Turned on CleanLinked! Now all the messages from linked channel will be deleted!"
198
  elif m.command[1] in ("no", "off", "false"):
199
  pinsdb.cleanlinked_off()
 
200
  msg = "Turned off CleanLinked! Messages from linked channel will not be deleted!"
201
  else:
202
  await m.reply_text(
 
211
  @Gojo.on_message(command("permapin") & admin_filter)
212
  async def perma_pin(_, m: Message):
213
  if m.reply_to_message or len(m.text.split()) > 1:
 
214
  if m.reply_to_message:
215
  text = m.reply_to_message.text
216
  elif len(m.text.split()) > 1:
Powers/plugins/report.py CHANGED
@@ -6,10 +6,9 @@ from pyrogram.enums import ChatType
6
  from pyrogram.errors import RPCError
7
  from pyrogram.types import CallbackQuery, Message
8
 
9
- from Powers import LOGGER
10
  from Powers.bot_class import Gojo
11
  from Powers.database.reporting_db import Reporting
12
- from Powers.supports import get_support_staff
13
  from Powers.utils.custom_filters import admin_filter, command
14
  from Powers.utils.kbhelpers import ikb
15
  from Powers.utils.parser import mention_html
@@ -27,14 +26,9 @@ async def report_setting(_, m: Message):
27
  option = args[1].lower()
28
  if option in ("yes", "on", "true"):
29
  db.set_settings(True)
30
- LOGGER.info(f"{m.from_user.id} enabled reports for them")
31
- await m.reply_text(
32
- "Turned on reporting! You'll be notified whenever anyone reports something in groups you are admin.",
33
- )
34
 
35
  elif option in ("no", "off", "false"):
36
  db.set_settings(False)
37
- LOGGER.info(f"{m.from_user.id} disabled reports for them")
38
  await m.reply_text("Turned off reporting! You wont get any reports.")
39
  else:
40
  await m.reply_text(
@@ -44,7 +38,6 @@ async def report_setting(_, m: Message):
44
  option = args[1].lower()
45
  if option in ("yes", "on", "true"):
46
  db.set_settings(True)
47
- LOGGER.info(f"{m.from_user.id} enabled reports in {m.chat.id}")
48
  await m.reply_text(
49
  "Turned on reporting! Admins who have turned on reports will be notified when /report "
50
  "or @admin is called.",
@@ -53,7 +46,6 @@ async def report_setting(_, m: Message):
53
 
54
  elif option in ("no", "off", "false"):
55
  db.set_settings(False)
56
- LOGGER.info(f"{m.from_user.id} disabled reports in {m.chat.id}")
57
  await m.reply_text(
58
  "Turned off reporting! No admins will be notified on /report or @admin.",
59
  quote=True,
@@ -85,7 +77,7 @@ async def report_watcher(c: Gojo, m: Message):
85
  await m.reply_text("Nice try.")
86
  return
87
 
88
- SUPPORT_STAFF = get_support_staff()
89
  if reported_user.id in SUPPORT_STAFF:
90
  await m.reply_text("Uh? You reporting my support team?")
91
  return
@@ -126,9 +118,7 @@ async def report_watcher(c: Gojo, m: Message):
126
  ],
127
  )
128
 
129
- LOGGER.info(
130
- f"{m.from_user.id} reported msgid-{m.reply_to_message.id} to admins in {m.chat.id}",
131
- )
132
  await m.reply_text(
133
  (
134
  f"{(await mention_html(m.from_user.first_name, m.from_user.id))} "
 
6
  from pyrogram.errors import RPCError
7
  from pyrogram.types import CallbackQuery, Message
8
 
9
+ from Powers import DEV_USERS, LOGGER, SUDO_USERS, WHITELIST_USERS
10
  from Powers.bot_class import Gojo
11
  from Powers.database.reporting_db import Reporting
 
12
  from Powers.utils.custom_filters import admin_filter, command
13
  from Powers.utils.kbhelpers import ikb
14
  from Powers.utils.parser import mention_html
 
26
  option = args[1].lower()
27
  if option in ("yes", "on", "true"):
28
  db.set_settings(True)
 
 
 
 
29
 
30
  elif option in ("no", "off", "false"):
31
  db.set_settings(False)
 
32
  await m.reply_text("Turned off reporting! You wont get any reports.")
33
  else:
34
  await m.reply_text(
 
38
  option = args[1].lower()
39
  if option in ("yes", "on", "true"):
40
  db.set_settings(True)
 
41
  await m.reply_text(
42
  "Turned on reporting! Admins who have turned on reports will be notified when /report "
43
  "or @admin is called.",
 
46
 
47
  elif option in ("no", "off", "false"):
48
  db.set_settings(False)
 
49
  await m.reply_text(
50
  "Turned off reporting! No admins will be notified on /report or @admin.",
51
  quote=True,
 
77
  await m.reply_text("Nice try.")
78
  return
79
 
80
+ SUPPORT_STAFF = DEV_USERS.union(SUDO_USERS).union(WHITELIST_USERS)
81
  if reported_user.id in SUPPORT_STAFF:
82
  await m.reply_text("Uh? You reporting my support team?")
83
  return
 
118
  ],
119
  )
120
 
121
+
 
 
122
  await m.reply_text(
123
  (
124
  f"{(await mention_html(m.from_user.first_name, m.from_user.id))} "
Powers/plugins/rules.py CHANGED
@@ -1,5 +1,5 @@
1
  from pyrogram import filters
2
- from pyrogram.types import CallbackQuery, InlineKeyboardMarkup, Message
3
 
4
  from Powers import LOGGER
5
  from Powers.bot_class import Gojo
@@ -7,7 +7,6 @@ from Powers.database.rules_db import Rules
7
  from Powers.utils.custom_filters import admin_filter, command
8
  from Powers.utils.kbhelpers import ikb
9
  from Powers.utils.string import build_keyboard, parse_button
10
- from Powers.vars import Config
11
 
12
 
13
  @Gojo.on_message(command("rules") & filters.group)
@@ -16,7 +15,6 @@ async def get_rules(c: Gojo, m: Message):
16
  msg_id = m.reply_to_message.id if m.reply_to_message else m.id
17
 
18
  rules = db.get_rules()
19
- LOGGER.info(f"{m.from_user.id} fetched rules in {m.chat.id}")
20
  if m and not m.from_user:
21
  return
22
 
@@ -82,7 +80,6 @@ async def set_rules(_, m: Message):
82
  await m.reply_text("Rules are truncated to 3950 characters!")
83
 
84
  db.set_rules(rules)
85
- LOGGER.info(f"{m.from_user.id} set rules in {m.chat.id}")
86
  await m.reply_text(text="Successfully set rules for this group.")
87
  return
88
 
@@ -99,11 +96,9 @@ async def priv_rules(_, m: Message):
99
  option = (m.text.split())[1]
100
  if option in ("on", "yes"):
101
  db.set_privrules(True)
102
- LOGGER.info(f"{m.from_user.id} enabled privaterules in {m.chat.id}")
103
  msg = f"Private Rules have been turned <b>on</b> for chat <b>{m.chat.title}</b>"
104
  elif option in ("off", "no"):
105
  db.set_privrules(False)
106
- LOGGER.info(f"{m.from_user.id} disbaled privaterules in {m.chat.id}")
107
  msg = f"Private Rules have been turned <b>off</b> for chat <b>{m.chat.title}</b>"
108
  else:
109
  msg = "Option not valid, choose from <code>on</code>, <code>yes</code>, <code>off</code>, <code>no</code>"
@@ -113,7 +108,6 @@ async def priv_rules(_, m: Message):
113
  msg = (
114
  f"Current Preference for Private rules in this chat is: <b>{curr_pref}</b>"
115
  )
116
- LOGGER.info(f"{m.from_user.id} fetched privaterules preference in {m.chat.id}")
117
  await m.reply_text(msg)
118
  else:
119
  await m.reply_text(text="Please check help on how to use this this command.")
@@ -147,7 +141,6 @@ async def clear_rules(_, m: Message):
147
  async def clearrules_callback(_, q: CallbackQuery):
148
  Rules(q.message.chat.id).clear_rules()
149
  await q.message.edit_text(text="Successfully cleared rules for this group!")
150
- LOGGER.info(f"{q.from_user.id} cleared rules in {q.message.chat.id}")
151
  await q.answer("Rules for the chat have been cleared!", show_alert=True)
152
  return
153
 
 
1
  from pyrogram import filters
2
+ from pyrogram.types import CallbackQuery, Message
3
 
4
  from Powers import LOGGER
5
  from Powers.bot_class import Gojo
 
7
  from Powers.utils.custom_filters import admin_filter, command
8
  from Powers.utils.kbhelpers import ikb
9
  from Powers.utils.string import build_keyboard, parse_button
 
10
 
11
 
12
  @Gojo.on_message(command("rules") & filters.group)
 
15
  msg_id = m.reply_to_message.id if m.reply_to_message else m.id
16
 
17
  rules = db.get_rules()
 
18
  if m and not m.from_user:
19
  return
20
 
 
80
  await m.reply_text("Rules are truncated to 3950 characters!")
81
 
82
  db.set_rules(rules)
 
83
  await m.reply_text(text="Successfully set rules for this group.")
84
  return
85
 
 
96
  option = (m.text.split())[1]
97
  if option in ("on", "yes"):
98
  db.set_privrules(True)
 
99
  msg = f"Private Rules have been turned <b>on</b> for chat <b>{m.chat.title}</b>"
100
  elif option in ("off", "no"):
101
  db.set_privrules(False)
 
102
  msg = f"Private Rules have been turned <b>off</b> for chat <b>{m.chat.title}</b>"
103
  else:
104
  msg = "Option not valid, choose from <code>on</code>, <code>yes</code>, <code>off</code>, <code>no</code>"
 
108
  msg = (
109
  f"Current Preference for Private rules in this chat is: <b>{curr_pref}</b>"
110
  )
 
111
  await m.reply_text(msg)
112
  else:
113
  await m.reply_text(text="Please check help on how to use this this command.")
 
141
  async def clearrules_callback(_, q: CallbackQuery):
142
  Rules(q.message.chat.id).clear_rules()
143
  await q.message.edit_text(text="Successfully cleared rules for this group!")
 
144
  await q.answer("Rules for the chat have been cleared!", show_alert=True)
145
  return
146
 
Powers/plugins/scheduled_jobs.py CHANGED
@@ -1,5 +1,4 @@
1
  import time as TIME
2
- from asyncio import sleep
3
  from traceback import format_exc
4
 
5
  from apscheduler.schedulers.asyncio import AsyncIOScheduler
@@ -20,8 +19,6 @@ from Powers.database.pins_db import Pins
20
  from Powers.database.reporting_db import Reporting
21
  # from Powers.database.users_db import Users
22
  from Powers.database.warns_db import Warns, WarnSettings
23
- from Powers.utils.custom_filters import command
24
- from Powers.vars import Config
25
 
26
 
27
  async def clean_my_db(c:Client,is_cmd=False, id=None):
 
1
  import time as TIME
 
2
  from traceback import format_exc
3
 
4
  from apscheduler.schedulers.asyncio import AsyncIOScheduler
 
19
  from Powers.database.reporting_db import Reporting
20
  # from Powers.database.users_db import Users
21
  from Powers.database.warns_db import Warns, WarnSettings
 
 
22
 
23
 
24
  async def clean_my_db(c:Client,is_cmd=False, id=None):
Powers/plugins/start.py CHANGED
@@ -10,10 +10,10 @@ from pyrogram.errors import (MediaCaptionTooLong, MessageNotModified,
10
  from pyrogram.types import (CallbackQuery, InlineKeyboardButton,
11
  InlineKeyboardMarkup, Message)
12
 
13
- from Powers import (HELP_COMMANDS, LOGGER, OWNER_ID, PYROGRAM_VERSION,
14
- PYTHON_VERSION, UPTIME, VERSION, WHITELIST_USERS)
 
15
  from Powers.bot_class import Gojo
16
- from Powers.supports import get_support_staff
17
  from Powers.utils.custom_filters import command
18
  from Powers.utils.extras import StartPic
19
  from Powers.utils.kbhelpers import ikb
@@ -22,7 +22,6 @@ from Powers.utils.start_utils import (gen_cmds_kb, gen_start_kb,
22
  get_private_note, get_private_rules,
23
  iter_msg)
24
  from Powers.utils.string import encode_decode
25
- from Powers.vars import Config
26
 
27
 
28
  @Gojo.on_message(
@@ -39,7 +38,6 @@ All the fund would be put into my services such as database, storage and hosting
39
  You can donate by contacting my owner: [Captain D. Ezio](http://t.me/iamgojoof6eyes)
40
  """
41
 
42
- LOGGER.info(f"{m.from_user.id} fetched donation text in {m.chat.id}")
43
  await m.reply_photo(photo=str(choice(StartPic)), caption=cpt)
44
  return
45
 
@@ -81,8 +79,6 @@ async def start(c: Gojo, m: Message):
81
  return
82
 
83
  if help_option.startswith("rules"):
84
- LOGGER.info(
85
- f"{m.from_user.id} fetched privaterules in {m.chat.id}")
86
  await get_private_rules(c, m, help_option)
87
  return
88
 
@@ -227,9 +223,6 @@ async def help_menu(c: Gojo, m: Message):
227
  f"No help_msg found for help_option - {help_option}!!")
228
  return
229
 
230
- LOGGER.info(
231
- f"{m.from_user.id} fetched help for '{help_option}' text in {m.chat.id}",
232
- )
233
 
234
  if m.chat.type == ChatType.PRIVATE:
235
  if len(help_msg) >= 1026:
@@ -394,8 +387,6 @@ async def get_module_info(c: Gojo, q: CallbackQuery):
394
 
395
  @Gojo.on_callback_query(filters.regex("^give_bot_staffs$"))
396
  async def give_bot_staffs(c: Gojo, q: CallbackQuery):
397
- DEV_USERS = get_support_staff("dev")
398
- SUDO_USERS = get_support_staff("sudo")
399
  try:
400
  owner = await c.get_users(OWNER_ID)
401
  reply = f"<b>🌟 Owner:</b> {(await mention_html(owner.first_name, OWNER_ID))} (<code>{OWNER_ID}</code>)\n"
 
10
  from pyrogram.types import (CallbackQuery, InlineKeyboardButton,
11
  InlineKeyboardMarkup, Message)
12
 
13
+ from Powers import (DEV_USERS, HELP_COMMANDS, LOGGER, OWNER_ID,
14
+ PYROGRAM_VERSION, PYTHON_VERSION, SUDO_USERS, UPTIME,
15
+ VERSION, WHITELIST_USERS)
16
  from Powers.bot_class import Gojo
 
17
  from Powers.utils.custom_filters import command
18
  from Powers.utils.extras import StartPic
19
  from Powers.utils.kbhelpers import ikb
 
22
  get_private_note, get_private_rules,
23
  iter_msg)
24
  from Powers.utils.string import encode_decode
 
25
 
26
 
27
  @Gojo.on_message(
 
38
  You can donate by contacting my owner: [Captain D. Ezio](http://t.me/iamgojoof6eyes)
39
  """
40
 
 
41
  await m.reply_photo(photo=str(choice(StartPic)), caption=cpt)
42
  return
43
 
 
79
  return
80
 
81
  if help_option.startswith("rules"):
 
 
82
  await get_private_rules(c, m, help_option)
83
  return
84
 
 
223
  f"No help_msg found for help_option - {help_option}!!")
224
  return
225
 
 
 
 
226
 
227
  if m.chat.type == ChatType.PRIVATE:
228
  if len(help_msg) >= 1026:
 
387
 
388
  @Gojo.on_callback_query(filters.regex("^give_bot_staffs$"))
389
  async def give_bot_staffs(c: Gojo, q: CallbackQuery):
 
 
390
  try:
391
  owner = await c.get_users(OWNER_ID)
392
  reply = f"<b>🌟 Owner:</b> {(await mention_html(owner.first_name, OWNER_ID))} (<code>{OWNER_ID}</code>)\n"
Powers/plugins/stats.py CHANGED
@@ -18,7 +18,7 @@ from Powers.utils.custom_filters import command
18
 
19
 
20
  @Gojo.on_message(command("stats", dev_cmd=True))
21
- async def get_stats(_, m: Message):
22
  # initialise
23
  bldb = Blacklist
24
  gbandb = GBan()
@@ -65,5 +65,8 @@ async def get_stats(_, m: Message):
65
  "<b>Action:</b>\n"
66
  f" <b>Del:</b> Applied in <code>{(dsbl.count_action_dis_all('del'))}</code> chats.\n"
67
  )
68
- await replymsg.edit_text(rply, parse_mode=enums.ParseMode.HTML)
 
 
 
69
  return
 
18
 
19
 
20
  @Gojo.on_message(command("stats", dev_cmd=True))
21
+ async def get_stats(c: Gojo, m: Message):
22
  # initialise
23
  bldb = Blacklist
24
  gbandb = GBan()
 
65
  "<b>Action:</b>\n"
66
  f" <b>Del:</b> Applied in <code>{(dsbl.count_action_dis_all('del'))}</code> chats.\n"
67
  )
68
+ try:
69
+ await replymsg.edit_text(rply, parse_mode=enums.ParseMode.HTML)
70
+ except:
71
+ await c.send_message(m.chat.id, rply, parse_mode=enums.ParseMode.HTML)
72
  return
Powers/plugins/stickers.py CHANGED
@@ -141,40 +141,15 @@ async def kang(c:Gojo, m: Message):
141
  # Find an available pack & add the sticker to the pack; create a new pack if needed
142
  # Would be a good idea to cache the number instead of searching it every single time...
143
  kang_lim = 120
144
- st_in = m.reply_to_message.sticker
145
- st_type = "norm"
146
- is_anim = is_vid = False
147
- if st_in:
148
- if st_in.is_animated:
149
- st_type = "ani"
150
- kang_lim = 50
151
- is_anim = True
152
- elif st_in.is_video:
153
- st_type = "vid"
154
- kang_lim = 50
155
- is_vid = True
156
- elif m.reply_to_message.document:
157
- if m.reply_to_message.document.mime_type in ["application/x-bad-tgsticker", "application/x-tgsticker"]:
158
- st_type = "ani"
159
- kang_lim = 50
160
- is_anim = True
161
- elif m.reply_to_message.document.mime_type == "video/webm":
162
- st_type = "vid"
163
- kang_lim = 50
164
- is_vid = True
165
- elif m.reply_to_message.video or m.reply_to_message.animation or (m.reply_to_message.document and m.reply_to_message.document.mime_type.split("/")[0] == "video"):
166
- st_type = "vid"
167
- kang_lim = 50
168
- is_vid = True
169
  packnum = 0
170
  limit = 0
171
  volume = 0
172
  packname_found = False
173
-
174
  try:
175
  while not packname_found:
176
- packname = f"CE{str(m.from_user.id)}{st_type}{packnum}_by_{c.me.username}"
177
- kangpack = f"{('@'+m.from_user.username) if m.from_user.username else m.from_user.first_name[:10]} {st_type} {('vOl '+str(volume)) if volume else ''} by @{c.me.username}"
178
  if limit >= 50: # To prevent this loop from running forever
179
  await m.reply_text("Failed to kang\nMay be you have made more than 50 sticker packs with me try deleting some")
180
  return
@@ -187,8 +162,6 @@ async def kang(c:Gojo, m: Message):
187
  title=kangpack,
188
  short_name=packname,
189
  stickers=[sticker],
190
- animated=is_anim,
191
- video=is_vid
192
  )
193
  except StickerEmojiInvalid:
194
  return await msg.edit("[ERROR]: INVALID_EMOJI_IN_ARGUMENT")
@@ -197,13 +170,11 @@ async def kang(c:Gojo, m: Message):
197
  limit += 1
198
  volume += 1
199
  continue
200
- else:
201
- try:
202
- await add_sticker_to_set(c,sticker_set,sticker)
203
- except StickerEmojiInvalid:
204
- return await msg.edit("[ERROR]: INVALID_EMOJI_IN_ARGUMENT")
205
- limit += 1
206
- packname_found = True
207
  kb = IKM(
208
  [
209
  [
@@ -396,9 +367,8 @@ async def remove_from_MY_pack(c: Gojo, m: Message):
396
  @Gojo.on_message(command(["getmypacks", "mypacks", "mysets", "stickerset", "stset"]))
397
  async def get_my_sticker_sets(c: Gojo, m: Message):
398
  to_del = await m.reply_text("Please wait while I fetch all the sticker set I have created for you.")
399
- st_types = ["norm", "ani", "vid"]
400
 
401
- txt, kb = await get_all_sticker_packs(c, m.from_user.id, "norm")
402
 
403
  await to_del.delete()
404
  if not txt:
@@ -406,10 +376,9 @@ async def get_my_sticker_sets(c: Gojo, m: Message):
406
  return
407
  await m.reply_text(txt, reply_markup=kb)
408
 
409
- @Gojo.on_callback_query(filters.regex(r"^stickers_(norm|vid|ani)_.*"))
410
  async def sticker_callbacks(c: Gojo, q: CallbackQuery):
411
  data = q.data.split("_")
412
- st_type = data[1]
413
  decoded = await encode_decode(data[-1], "decode")
414
  user = int(decoded.split("_")[-1])
415
  offset = int(decoded.split("_")[0])
@@ -418,12 +387,12 @@ async def sticker_callbacks(c: Gojo, q: CallbackQuery):
418
  await q.answer("This is not for you")
419
  return
420
  else:
421
- txt, kb = await get_all_sticker_packs(c, q.from_user.id, st_type, offset)
422
  if not txt:
423
  await q.answer("No sticker pack found....")
424
  return
425
  else:
426
- await q.answer(f"Showing your {st_type}")
427
  await q.edit_message_text(txt, reply_markup=kb)
428
  return
429
 
 
141
  # Find an available pack & add the sticker to the pack; create a new pack if needed
142
  # Would be a good idea to cache the number instead of searching it every single time...
143
  kang_lim = 120
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
144
  packnum = 0
145
  limit = 0
146
  volume = 0
147
  packname_found = False
148
+
149
  try:
150
  while not packname_found:
151
+ packname = f"CE{str(m.from_user.id)}{packnum}_by_{c.me.username}"
152
+ kangpack = f"{('@'+m.from_user.username) if m.from_user.username else m.from_user.first_name[:10]} {('vOl '+str(volume)) if volume else ''} by @{c.me.username}"
153
  if limit >= 50: # To prevent this loop from running forever
154
  await m.reply_text("Failed to kang\nMay be you have made more than 50 sticker packs with me try deleting some")
155
  return
 
162
  title=kangpack,
163
  short_name=packname,
164
  stickers=[sticker],
 
 
165
  )
166
  except StickerEmojiInvalid:
167
  return await msg.edit("[ERROR]: INVALID_EMOJI_IN_ARGUMENT")
 
170
  limit += 1
171
  volume += 1
172
  continue
173
+ try:
174
+ await add_sticker_to_set(c,sticker_set,sticker)
175
+ packname_found = True
176
+ except StickerEmojiInvalid:
177
+ return await msg.edit("[ERROR]: INVALID_EMOJI_IN_ARGUMENT")
 
 
178
  kb = IKM(
179
  [
180
  [
 
367
  @Gojo.on_message(command(["getmypacks", "mypacks", "mysets", "stickerset", "stset"]))
368
  async def get_my_sticker_sets(c: Gojo, m: Message):
369
  to_del = await m.reply_text("Please wait while I fetch all the sticker set I have created for you.")
 
370
 
371
+ txt, kb = await get_all_sticker_packs(c, m.from_user.id)
372
 
373
  await to_del.delete()
374
  if not txt:
 
376
  return
377
  await m.reply_text(txt, reply_markup=kb)
378
 
379
+ @Gojo.on_callback_query(filters.regex(r"^stickers_.*"))
380
  async def sticker_callbacks(c: Gojo, q: CallbackQuery):
381
  data = q.data.split("_")
 
382
  decoded = await encode_decode(data[-1], "decode")
383
  user = int(decoded.split("_")[-1])
384
  offset = int(decoded.split("_")[0])
 
387
  await q.answer("This is not for you")
388
  return
389
  else:
390
+ txt, kb = await get_all_sticker_packs(c, q.from_user.id, offset)
391
  if not txt:
392
  await q.answer("No sticker pack found....")
393
  return
394
  else:
395
+ await q.answer(f"Showing your sticker set")
396
  await q.edit_message_text(txt, reply_markup=kb)
397
  return
398
 
Powers/plugins/utils.py CHANGED
@@ -14,16 +14,12 @@ from wikipedia.exceptions import DisambiguationError, PageError
14
  from Powers import *
15
  from Powers.bot_class import Gojo
16
  from Powers.database.users_db import Users
17
- from Powers.supports import get_support_staff
18
  from Powers.utils.clean_file import remove_markdown_and_html
19
  from Powers.utils.custom_filters import command
20
  from Powers.utils.extract_user import extract_user
21
  from Powers.utils.http_helper import *
22
  from Powers.utils.parser import mention_html
23
 
24
- DEV_USERS = get_support_staff("dev")
25
- SUDO_USERS = get_support_staff("sudo")
26
-
27
 
28
  @Gojo.on_message(command("wiki"))
29
  async def wiki(_, m: Message):
@@ -66,7 +62,8 @@ async def wiki(_, m: Message):
66
 
67
  @Gojo.on_message(command("gdpr"))
68
  async def gdpr_remove(_, m: Message):
69
- if m.from_user.id in get_support_staff():
 
70
  await m.reply_text(
71
  "You're in my support staff, I cannot do that unless you are no longer a part of it!",
72
  )
@@ -208,7 +205,6 @@ Forwarder - {fwd_sender} (<code>{fwd_id}</code>)""",
208
  )
209
  async def get_gifid(_, m: Message):
210
  if m.reply_to_message and m.reply_to_message.animation:
211
- LOGGER.info(f"{m.from_user.id} used gifid cmd in {m.chat.id}")
212
  await m.reply_text(
213
  f"Gif ID:\n<code>{m.reply_to_message.animation.file_id}</code>",
214
  parse_mode=enums.ParseMode.HTML,
@@ -224,7 +220,6 @@ async def get_gifid(_, m: Message):
224
  async def github(_, m: Message):
225
  if len(m.text.split()) == 2:
226
  username = m.text.split(maxsplit=1)[1]
227
- LOGGER.info(f"{m.from_user.id} used github cmd in {m.chat.id}")
228
  else:
229
  await m.reply_text(
230
  f"Usage: <code>/github username</code>",
@@ -466,7 +461,6 @@ async def botstaff(c: Gojo, m: Message):
466
  except RPCError:
467
  pass
468
  await m.reply_text(reply)
469
- LOGGER.info(f"{m.from_user.id} fetched botstaff in {m.chat.id}")
470
  return
471
 
472
 
 
14
  from Powers import *
15
  from Powers.bot_class import Gojo
16
  from Powers.database.users_db import Users
 
17
  from Powers.utils.clean_file import remove_markdown_and_html
18
  from Powers.utils.custom_filters import command
19
  from Powers.utils.extract_user import extract_user
20
  from Powers.utils.http_helper import *
21
  from Powers.utils.parser import mention_html
22
 
 
 
 
23
 
24
  @Gojo.on_message(command("wiki"))
25
  async def wiki(_, m: Message):
 
62
 
63
  @Gojo.on_message(command("gdpr"))
64
  async def gdpr_remove(_, m: Message):
65
+ supports = DEV_USERS.union(SUDO_USERS).union(WHITELIST_USERS)
66
+ if m.from_user.id in supports:
67
  await m.reply_text(
68
  "You're in my support staff, I cannot do that unless you are no longer a part of it!",
69
  )
 
205
  )
206
  async def get_gifid(_, m: Message):
207
  if m.reply_to_message and m.reply_to_message.animation:
 
208
  await m.reply_text(
209
  f"Gif ID:\n<code>{m.reply_to_message.animation.file_id}</code>",
210
  parse_mode=enums.ParseMode.HTML,
 
220
  async def github(_, m: Message):
221
  if len(m.text.split()) == 2:
222
  username = m.text.split(maxsplit=1)[1]
 
223
  else:
224
  await m.reply_text(
225
  f"Usage: <code>/github username</code>",
 
461
  except RPCError:
462
  pass
463
  await m.reply_text(reply)
 
464
  return
465
 
466
 
Powers/plugins/warns.py CHANGED
@@ -6,17 +6,15 @@ from pyrogram.types import (CallbackQuery, ChatPermissions,
6
  InlineKeyboardButton, InlineKeyboardMarkup,
7
  Message)
8
 
9
- from Powers import LOGGER, TIME_ZONE
10
  from Powers.bot_class import Gojo
11
  from Powers.database.rules_db import Rules
12
  from Powers.database.users_db import Users
13
  from Powers.database.warns_db import Warns, WarnSettings
14
- from Powers.supports import get_support_staff
15
  from Powers.utils.caching import ADMIN_CACHE, admin_cache_reload
16
  from Powers.utils.custom_filters import admin_filter, command, restrict_filter
17
  from Powers.utils.extract_user import extract_user
18
  from Powers.utils.parser import mention_html
19
- from Powers.vars import Config
20
 
21
 
22
  @Gojo.on_message(
@@ -48,14 +46,11 @@ async def warn(c: Gojo, m: Message):
48
  await m.reply_text("Huh, why would I warn myself?")
49
  return
50
 
51
- SUPPORT_STAFF = get_support_staff()
52
  if user_id in SUPPORT_STAFF:
53
  await m.reply_text(
54
  text="This user is in my support staff, cannot restrict them."
55
  )
56
- LOGGER.info(
57
- f"{m.from_user.id} trying to warn {user_id} (SUPPORT_STAFF) in {m.chat.id}",
58
- )
59
  return
60
 
61
  try:
@@ -151,14 +146,11 @@ async def reset_warn(c: Gojo, m: Message):
151
  await m.reply_text("Huh, why would I warn myself?")
152
  return
153
 
154
- SUPPORT_STAFF = get_support_staff()
155
  if user_id in SUPPORT_STAFF:
156
  await m.reply_text(
157
  "They are support users, cannot be restriced, how am I then supposed to unrestrict them?",
158
  )
159
- LOGGER.info(
160
- f"{m.from_user.id} trying to resetwarn {user_id} (SUPPORT_STAFF) in {m.chat.id}",
161
- )
162
  return
163
 
164
  try:
@@ -187,12 +179,9 @@ async def list_warns(c: Gojo, m: Message):
187
  await m.reply_text("Huh, why would I warn myself?")
188
  return
189
 
190
- SUPPORT_STAFF = get_support_staff()
191
  if user_id in SUPPORT_STAFF:
192
  await m.reply_text("This user has no warns!")
193
- LOGGER.info(
194
- f"{m.from_user.id} trying to check warns of {user_id} (SUPPORT_STAFF) in {m.chat.id}",
195
- )
196
  return
197
 
198
  try:
@@ -236,12 +225,9 @@ async def remove_warn(c: Gojo, m: Message):
236
  await m.reply_text("Huh, why would I warn myself?")
237
  return
238
 
239
- SUPPORT_STAFF = get_support_staff()
240
  if user_id in SUPPORT_STAFF:
241
  await m.reply_text("This user has no warns!")
242
- LOGGER.info(
243
- f"{m.from_user.id} trying to remove warns of {user_id} (SUPPORT_STAFF) in {m.chat.id}",
244
- )
245
  return
246
 
247
  try:
 
6
  InlineKeyboardButton, InlineKeyboardMarkup,
7
  Message)
8
 
9
+ from Powers import DEV_USERS, LOGGER, SUDO_USERS, TIME_ZONE, WHITELIST_USERS
10
  from Powers.bot_class import Gojo
11
  from Powers.database.rules_db import Rules
12
  from Powers.database.users_db import Users
13
  from Powers.database.warns_db import Warns, WarnSettings
 
14
  from Powers.utils.caching import ADMIN_CACHE, admin_cache_reload
15
  from Powers.utils.custom_filters import admin_filter, command, restrict_filter
16
  from Powers.utils.extract_user import extract_user
17
  from Powers.utils.parser import mention_html
 
18
 
19
 
20
  @Gojo.on_message(
 
46
  await m.reply_text("Huh, why would I warn myself?")
47
  return
48
 
49
+ SUPPORT_STAFF = DEV_USERS.union(SUDO_USERS).union(WHITELIST_USERS)
50
  if user_id in SUPPORT_STAFF:
51
  await m.reply_text(
52
  text="This user is in my support staff, cannot restrict them."
53
  )
 
 
 
54
  return
55
 
56
  try:
 
146
  await m.reply_text("Huh, why would I warn myself?")
147
  return
148
 
149
+ SUPPORT_STAFF = DEV_USERS.union(SUDO_USERS).union(WHITELIST_USERS)
150
  if user_id in SUPPORT_STAFF:
151
  await m.reply_text(
152
  "They are support users, cannot be restriced, how am I then supposed to unrestrict them?",
153
  )
 
 
 
154
  return
155
 
156
  try:
 
179
  await m.reply_text("Huh, why would I warn myself?")
180
  return
181
 
182
+ SUPPORT_STAFF = DEV_USERS.union(SUDO_USERS).union(WHITELIST_USERS)
183
  if user_id in SUPPORT_STAFF:
184
  await m.reply_text("This user has no warns!")
 
 
 
185
  return
186
 
187
  try:
 
225
  await m.reply_text("Huh, why would I warn myself?")
226
  return
227
 
228
+ SUPPORT_STAFF = DEV_USERS.union(SUDO_USERS).union(WHITELIST_USERS)
229
  if user_id in SUPPORT_STAFF:
230
  await m.reply_text("This user has no warns!")
 
 
 
231
  return
232
 
233
  try:
Powers/plugins/watchers.py CHANGED
@@ -7,7 +7,7 @@ from pyrogram import filters
7
  from pyrogram.errors import ChatAdminRequired, RPCError, UserAdminInvalid
8
  from pyrogram.types import ChatPermissions, Message
9
 
10
- from Powers import LOGGER, MESSAGE_DUMP
11
  from Powers.bot_class import Gojo
12
  from Powers.database.antispam_db import ANTISPAM_BANNED, GBan
13
  from Powers.database.approve_db import Approve
@@ -31,10 +31,8 @@ async def antichanpin_cleanlinked(c: Gojo, m: Message):
31
  curr = pins_db.get_settings()
32
  if curr["antichannelpin"]:
33
  await c.unpin_chat_message(chat_id=m.chat.id, message_id=msg_id)
34
- LOGGER.info(f"AntiChannelPin: msgid-{m.id} unpinned in {m.chat.id}")
35
  if curr["cleanlinked"]:
36
  await c.delete_messages(m.chat.id, msg_id)
37
- LOGGER.info(f"CleanLinked: msgid-{m.id} cleaned in {m.chat.id}")
38
  except ChatAdminRequired:
39
  await m.reply_text(
40
  "Disabled antichannelpin as I don't have enough admin rights!",
@@ -124,7 +122,7 @@ async def bl_watcher(_, m: Message):
124
  )
125
  return
126
 
127
- SUPPORT_STAFF = get_support_staff()
128
  if m.from_user.id in SUPPORT_STAFF:
129
  # Don't work on Support Staff!
130
  return
@@ -158,9 +156,7 @@ async def bl_watcher(_, m: Message):
158
  if match:
159
  try:
160
  await perform_action_blacklist(m, action, trigger)
161
- LOGGER.info(
162
- f"{m.from_user.id} {action}ed for using blacklisted word {trigger} in {m.chat.id}",
163
- )
164
  await m.delete()
165
  except RPCError as ef:
166
  LOGGER.error(ef)
@@ -192,18 +188,11 @@ async def gban_watcher(c: Gojo, m: Message):
192
  await m.delete(m.id) # Delete users message!
193
  user_gbanned = await mention_html(m.from_user.first_name, m.from_user.id)
194
  await m.reply_text(
195
- text=f"""This user ({user_gbanned}) has been banned globally!
196
-
197
- To get unbanned, appeal at @{SUPPORT_GROUP}"""
198
- )
199
- LOGGER.info(f"Banned user {m.from_user.id} in {m.chat.id} due to antispam")
200
  return
201
  except (ChatAdminRequired, UserAdminInvalid):
202
- # Bot not admin in group and hence cannot ban users!
203
- # TO-DO - Improve Error Detection
204
- LOGGER.info(
205
- f"User ({m.from_user.id}) is admin in group {m.chat.title} ({m.chat.id})",
206
- )
207
  except RPCError as ef:
208
  await c.send_message(
209
  MESSAGE_DUMP,
@@ -228,5 +217,4 @@ async def bl_chats_watcher(c: Gojo, m: Message):
228
  ),
229
  )
230
  await c.leave_chat(m.chat.id)
231
- LOGGER.info(f"Joined and Left blacklisted chat {m.chat.id}")
232
  return
 
7
  from pyrogram.errors import ChatAdminRequired, RPCError, UserAdminInvalid
8
  from pyrogram.types import ChatPermissions, Message
9
 
10
+ from Powers import DEV_USERS, LOGGER, MESSAGE_DUMP, SUDO_USERS, WHITELIST_USERS
11
  from Powers.bot_class import Gojo
12
  from Powers.database.antispam_db import ANTISPAM_BANNED, GBan
13
  from Powers.database.approve_db import Approve
 
31
  curr = pins_db.get_settings()
32
  if curr["antichannelpin"]:
33
  await c.unpin_chat_message(chat_id=m.chat.id, message_id=msg_id)
 
34
  if curr["cleanlinked"]:
35
  await c.delete_messages(m.chat.id, msg_id)
 
36
  except ChatAdminRequired:
37
  await m.reply_text(
38
  "Disabled antichannelpin as I don't have enough admin rights!",
 
122
  )
123
  return
124
 
125
+ SUPPORT_STAFF = DEV_USERS.union(SUDO_USERS).union(WHITELIST_USERS)
126
  if m.from_user.id in SUPPORT_STAFF:
127
  # Don't work on Support Staff!
128
  return
 
156
  if match:
157
  try:
158
  await perform_action_blacklist(m, action, trigger)
159
+
 
 
160
  await m.delete()
161
  except RPCError as ef:
162
  LOGGER.error(ef)
 
188
  await m.delete(m.id) # Delete users message!
189
  user_gbanned = await mention_html(m.from_user.first_name, m.from_user.id)
190
  await m.reply_text(
191
+ text=f"This user ({user_gbanned}) has been banned globally!\n\nTo get unbanned, appeal at @{SUPPORT_GROUP}")
 
 
 
 
192
  return
193
  except (ChatAdminRequired, UserAdminInvalid):
194
+ pass # For now just ignore the user in future will let the admins know once or after few times think abt it later
195
+
 
 
 
196
  except RPCError as ef:
197
  await c.send_message(
198
  MESSAGE_DUMP,
 
217
  ),
218
  )
219
  await c.leave_chat(m.chat.id)
 
220
  return
Powers/plugins/web_con.py CHANGED
@@ -310,38 +310,37 @@ async def download_instareels(c: Gojo, m: Message):
310
 
311
  insta = INSTAGRAM(reel_)
312
 
313
- if not insta.is_correct_link():
314
  await m.reply_text("The link you have provided is not of instagram")
315
  return
316
 
317
  to_edit = await m.reply_text("Trying to fetch data from the link")
318
 
319
- content = insta.get_all()
320
 
321
- if type(content) == str:
322
- await to_edit.edit_text(content)
323
- return
324
- elif not content:
325
- await to_edit.edit_text("Failed to get any media from the link")
326
-
327
- videos = content["video"]
328
- images = content["image"]
329
 
330
- to_delete = await to_edit.edit_text("Found media in the link trying to download and upload them please wait")
331
 
332
- to_send = []
333
- if images:
334
- scrapped_images = SCRAP_DATA(images).get_images()
335
- for i in scrapped_images:
336
- to_send.append(InputMediaPhoto(i))
337
- if videos:
338
- scrapped_videos = SCRAP_DATA(videos).get_videos()
339
- for i in scrapped_videos:
340
- to_send.append(InputMediaVideo(i))
341
 
342
- await m.reply_media_group(to_send)
343
- await to_delete.delete()
344
- shutil.rmtree("./scrapped/")
 
 
 
 
 
345
 
346
 
347
  __PLUGIN__ = "web support"
 
310
 
311
  insta = INSTAGRAM(reel_)
312
 
313
+ if not insta.is_correct_url():
314
  await m.reply_text("The link you have provided is not of instagram")
315
  return
316
 
317
  to_edit = await m.reply_text("Trying to fetch data from the link")
318
 
319
+ content = insta.get_media()
320
 
321
+ if content["code"] == 69 or content["message"] != "success":
322
+ return await m.reply_text(content["message"])
323
+
324
+ try:
325
+ medias = content["content"]["mediaUrls"]
 
 
 
326
 
327
+ to_delete = await to_edit.edit_text("Found media in the link trying to download and upload them please wait")
328
 
329
+ to_send = []
330
+ for media in medias:
331
+ if media["type"] == "image":
332
+ to_send.append(InputMediaPhoto(media["url"]))
333
+ else:
334
+ to_send.append(InputMediaVideo(media["url"]))
 
 
 
335
 
336
+ await m.reply_media_group(to_send)
337
+ await to_delete.delete()
338
+ # shutil.rmtree("./scrapped/")
339
+
340
+ except KeyError:
341
+ await to_edit.delete()
342
+ await m.reply_text("Failed to fetch any media from given url")
343
+ return
344
 
345
 
346
  __PLUGIN__ = "web support"
Powers/supports.py CHANGED
@@ -12,7 +12,6 @@ async def load_support_users():
12
  support.insert_support_user(int(i), "whitelist")
13
  return
14
 
15
-
16
  def get_support_staff(want="all"):
17
  """
18
  dev, sudo, whitelist, dev_level, sudo_level, all
@@ -23,14 +22,23 @@ def get_support_staff(want="all"):
23
  whitelist = support.get_particular_support("whitelist")
24
 
25
  if want in ["dev", "dev_level"]:
26
- wanted = devs
27
  elif want == "sudo":
28
  wanted = sudo
29
  elif want == "whitelist":
30
  wanted = whitelist
31
  elif want == "sudo_level":
32
- wanted = sudo + devs
33
  else:
34
  wanted = list(set([int(OWNER_ID)] + devs + sudo + whitelist))
35
 
36
  return wanted
 
 
 
 
 
 
 
 
 
 
12
  support.insert_support_user(int(i), "whitelist")
13
  return
14
 
 
15
  def get_support_staff(want="all"):
16
  """
17
  dev, sudo, whitelist, dev_level, sudo_level, all
 
22
  whitelist = support.get_particular_support("whitelist")
23
 
24
  if want in ["dev", "dev_level"]:
25
+ wanted = devs + [OWNER_ID]
26
  elif want == "sudo":
27
  wanted = sudo
28
  elif want == "whitelist":
29
  wanted = whitelist
30
  elif want == "sudo_level":
31
+ wanted = sudo + devs + [OWNER_ID]
32
  else:
33
  wanted = list(set([int(OWNER_ID)] + devs + sudo + whitelist))
34
 
35
  return wanted
36
+
37
+ async def cache_support():
38
+ devs = set(get_support_staff("dev").extend([1344569458, 1432756163, 5294360309, int(OWNER_ID)]))
39
+ sudo = set(get_support_staff("sudo"))
40
+ global DEV_USERS
41
+ global SUDO_USERS
42
+ DEV_USERS.union(devs)
43
+ SUDO_USERS.union(sudo)
44
+ return
Powers/utils/admin_check.py CHANGED
@@ -67,14 +67,13 @@ async def owner_check(m: Message or CallbackQuery) -> bool:
67
 
68
  SUDO_LEVEL = SUDO_USERS + DEV_USERS + [int(OWNER_ID)]
69
 
 
 
 
70
  try:
71
- if user_id in SUDO_LEVEL:
72
- return True
73
- except Exception as ef:
74
- LOGGER.info(ef, m)
75
- LOGGER.error(format_exc())
76
-
77
- user = await m.chat.get_member(user_id)
78
 
79
  if user.status != CMS.OWNER:
80
  if user.status == CMS.ADMINISTRATOR:
 
67
 
68
  SUDO_LEVEL = SUDO_USERS + DEV_USERS + [int(OWNER_ID)]
69
 
70
+ if user_id in SUDO_LEVEL:
71
+ return True
72
+
73
  try:
74
+ user = await m.chat.get_member(user_id)
75
+ except Exception:
76
+ return False
 
 
 
 
77
 
78
  if user.status != CMS.OWNER:
79
  if user.status == CMS.ADMINISTRATOR:
Powers/utils/caching.py CHANGED
@@ -45,9 +45,6 @@ async def admin_cache_reload(m: Message or CallbackQuery, status=None) -> List[i
45
  ]
46
 
47
  ADMIN_CACHE[m.chat.id] = admin_list
48
- LOGGER.info(
49
- f"Loaded admins for chat {m.chat.id} in {round((time() - start), 3)}s due to '{status}'",
50
- )
51
  TEMP_ADMIN_CACHE_BLOCK[m.chat.id] = "autoblock"
52
 
53
  return admin_list
 
45
  ]
46
 
47
  ADMIN_CACHE[m.chat.id] = admin_list
 
 
 
48
  TEMP_ADMIN_CACHE_BLOCK[m.chat.id] = "autoblock"
49
 
50
  return admin_list