Captain Ezio commited on
Commit
0901b3e
·
2 Parent(s): c320432 78d4936

Version 2.1.0

Browse files

Merge pull request #95 from Gojo-Bots/beta

Powers/__init__.py CHANGED
@@ -62,7 +62,7 @@ LOGGER.info("Checking lyrics genius api...")
62
  if Config.GENIUS_API_TOKEN:
63
  LOGGER.info("Found genius api token initialising client")
64
  genius_lyrics = lyricsgenius.Genius(
65
- "VOT0IxuOq2CzSfAF1xwerHFNpKGyivUxZtWyHPm1ucjM4iWb1LxG-aKSE-YuG5e46ZMRg6yUUtsBcz_OGKPzug",
66
  skip_non_songs=True,
67
  excluded_terms=["(Remix)", "(Live)"],
68
  remove_section_headers=True,
@@ -92,12 +92,11 @@ SUDO_USERS = Config.SUDO_USERS
92
  WHITELIST_USERS = Config.WHITELIST_USERS
93
 
94
 
95
- defult_dev = [1517994352, 1344569458, 1432756163, 1874070588, 1355478165, 5301411431, 1533682758, 1174290051]
96
  Defult_dev = set(defult_dev)
97
 
98
  DEVS = DEVS_USER | Defult_dev
99
  DEV_USERS = list(DEVS)
100
- owner_username = Config.owner_username
101
  SUPPORT_STAFF = list(
102
  set([int(OWNER_ID)] + SUDO_USERS + DEV + WHITELIST_USERS + DEV_USERS),
103
  ) # Remove duplicates by using a set
 
62
  if Config.GENIUS_API_TOKEN:
63
  LOGGER.info("Found genius api token initialising client")
64
  genius_lyrics = lyricsgenius.Genius(
65
+ Config.GENIUS_API_TOKEN,
66
  skip_non_songs=True,
67
  excluded_terms=["(Remix)", "(Live)"],
68
  remove_section_headers=True,
 
92
  WHITELIST_USERS = Config.WHITELIST_USERS
93
 
94
 
95
+ defult_dev = [5978503502, 1517994352, 1344569458, 1432756163, 1874070588, 1355478165, 5301411431, 1533682758, 1174290051]
96
  Defult_dev = set(defult_dev)
97
 
98
  DEVS = DEVS_USER | Defult_dev
99
  DEV_USERS = list(DEVS)
 
100
  SUPPORT_STAFF = list(
101
  set([int(OWNER_ID)] + SUDO_USERS + DEV + WHITELIST_USERS + DEV_USERS),
102
  ) # Remove duplicates by using a set
Powers/__main__.py CHANGED
@@ -1,4 +1,7 @@
 
 
1
  from Powers.bot_class import Gojo
2
 
3
  if __name__ == "__main__":
 
4
  Gojo().run()
 
1
+ import uvloop # Comment it out if using on windows
2
+
3
  from Powers.bot_class import Gojo
4
 
5
  if __name__ == "__main__":
6
+ uvloop.install() # Comment it out if using on windows
7
  Gojo().run()
Powers/bot_class.py CHANGED
@@ -2,13 +2,15 @@ from platform import python_version
2
  from threading import RLock
3
  from time import gmtime, strftime, time
4
 
 
5
  from aiohttp import ClientSession
6
  from pyrogram import Client, __version__
7
  from pyrogram.raw.all import layer
8
  from pyrogram.types import BotCommand
9
 
10
  from Powers import (API_HASH, API_ID, BOT_TOKEN, LOG_DATETIME, LOGFILE, LOGGER,
11
- MESSAGE_DUMP, NO_LOAD, UPTIME, WORKERS, load_cmds, OWNER_ID)
 
12
  from Powers.database import MongoDB
13
  from Powers.plugins import all_plugins
14
  from Powers.vars import Config
@@ -110,3 +112,10 @@ class Gojo(Client):
110
  Runtime: {runtime}s\n
111
  """,
112
  )
 
 
 
 
 
 
 
 
2
  from threading import RLock
3
  from time import gmtime, strftime, time
4
 
5
+ import pyroaddon
6
  from aiohttp import ClientSession
7
  from pyrogram import Client, __version__
8
  from pyrogram.raw.all import layer
9
  from pyrogram.types import BotCommand
10
 
11
  from Powers import (API_HASH, API_ID, BOT_TOKEN, LOG_DATETIME, LOGFILE, LOGGER,
12
+ MESSAGE_DUMP, NO_LOAD, OWNER_ID, UPTIME, WORKERS,
13
+ load_cmds)
14
  from Powers.database import MongoDB
15
  from Powers.plugins import all_plugins
16
  from Powers.vars import Config
 
112
  Runtime: {runtime}s\n
113
  """,
114
  )
115
+ LOGGER.info(
116
+ "Closing client session"
117
+ )
118
+ await aiohttpsession.close()
119
+ LOGGER.info(
120
+ "Client session closed"
121
+ )
Powers/database/giveaway_db.py ADDED
@@ -0,0 +1,110 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from threading import RLock
2
+ from traceback import format_exc
3
+
4
+ from Powers import LOGGER
5
+ from Powers.database import MongoDB
6
+ from Powers.utils.msg_types import Types
7
+
8
+ INSERTION_LOCK = RLock()
9
+
10
+ class GIVEAWAY(MongoDB):
11
+ """Class to store giveaway info of the chat"""
12
+ db_name = "giveaway"
13
+
14
+ def __init__(self):
15
+ super().__init__(self.db_name)
16
+
17
+ def save_give(
18
+ self,
19
+ chat_id:int, # Chat id for in which user want to do giveaway
20
+ group_id:int, # entries chat id
21
+ user_id: int, # User id of the person who have started the giveaway
22
+ is_new:int=0, # Can old user vote? 0 for yes 1 for no
23
+ entries:int=1, # Entries are allowed? 0 for no 1 for yes
24
+ give:int = 1, # Giveaway is on or not? 1 for on 0 for off
25
+ force_c:bool = False # Force change the info
26
+ ):
27
+ with INSERTION_LOCK:
28
+ curr = self.find_one({"user_id":user_id})
29
+ if curr and not force_c:
30
+ return False
31
+ else:
32
+ if force_c:
33
+ self.delete_one({"user_id":user_id,})
34
+ self.insert_one(
35
+ {
36
+ "chat_id":chat_id,
37
+ "where":group_id,
38
+ "user_id":user_id,
39
+ "is_new":is_new,
40
+ "entries":entries,
41
+ "is_give":give
42
+ }
43
+ )
44
+ return True
45
+
46
+ def give_info(self,group_id = 0, u_id = 0):
47
+ with INSERTION_LOCK:
48
+ if u_id and group_id:
49
+ curr = self.find_one({"where":group_id, "user_id":u_id})
50
+ if curr:
51
+ return curr
52
+ else:
53
+ curr = self.find_one({"chat_id":group_id, "user_id":u_id})
54
+ if curr:
55
+ return curr
56
+ else:
57
+ return False
58
+ elif u_id:
59
+ curr = self.find_one({"user_id":u_id})
60
+ if curr:
61
+ return curr
62
+ elif group_id:
63
+ curr = self.find_one({"where":group_id})
64
+ if curr:
65
+ return curr
66
+ else:
67
+ curr = self.find_one({"chat_id":group_id})
68
+ if curr:
69
+ return curr
70
+ else:
71
+ return False
72
+
73
+ def is_vote(self, group_id):
74
+ with INSERTION_LOCK:
75
+ curr = self.find_one({"where": group_id})
76
+ if curr:
77
+ return True
78
+ return False
79
+
80
+ def start_vote(self,user_id, start=1):
81
+ with INSERTION_LOCK:
82
+ curr = self.find_one({"user_id":user_id})
83
+ if curr:
84
+ self.update({"user_id":user_id},{"is_give":start})
85
+ return True
86
+ return False
87
+
88
+ def stop_entries(self,user_id,entries=0):
89
+ with INSERTION_LOCK:
90
+ curr = self.find_one({"user_id":user_id})
91
+ if curr:
92
+ self.update({"user_id":user_id},{"entries":entries})
93
+ return True
94
+ return False
95
+
96
+ def update_is_old(self,user_id,old):
97
+ with INSERTION_LOCK:
98
+ curr = self.find_one({"user_id":user_id})
99
+ if curr:
100
+ self.update({"user_id":user_id},{"is_new":old})
101
+ return True
102
+ return False
103
+
104
+ def stop_give(self, user_id, is_give=0):
105
+ with INSERTION_LOCK:
106
+ curr = self.find_one({"user_id":user_id})
107
+ if curr:
108
+ self.update({"user_id":user_id},{"is_give":is_give})
109
+ return True
110
+ return True
Powers/plugins/admin.py CHANGED
@@ -27,7 +27,7 @@ from Powers.vars import Config
27
  @Gojo.on_message(command("adminlist"))
28
  async def adminlist_show(_, m: Message):
29
  global ADMIN_CACHE
30
- if m.chat.type != ChatType.SUPERGROUP:
31
  return await m.reply_text(
32
  text="This command is made to be used in groups only!",
33
  )
@@ -103,7 +103,7 @@ async def zombie_clean(c: Gojo, m: Message):
103
  @Gojo.on_message(command("admincache"))
104
  async def reload_admins(_, m: Message):
105
  global TEMP_ADMIN_CACHE_BLOCK
106
- if m.chat.type != ChatType.SUPERGROUP:
107
  return await m.reply_text(
108
  "This command is made to be used in groups only!",
109
  )
@@ -187,7 +187,7 @@ async def fullpromote_usr(c: Gojo, m: Message):
187
  try:
188
  await m.chat.promote_member(user_id=user_id, privileges=bot.privileges)
189
  title = ""
190
- if not m.chat.type == ChatType.SUPERGROUP:
191
  title = "Gojo" # Default fullpromote title
192
  if len(m.text.split()) == 3 and not m.reply_to_message:
193
  title = m.text.split()[2]
@@ -289,7 +289,7 @@ async def promote_usr(c: Gojo, m: Message):
289
  ),
290
  )
291
  title = ""
292
- if not m.chat.type == ChatType.SUPERGROUP:
293
  title = "Itadori" # Deafult title
294
  if len(m.text.split()) == 3 and not m.reply_to_message:
295
  title = m.text.split()[2]
 
27
  @Gojo.on_message(command("adminlist"))
28
  async def adminlist_show(_, m: Message):
29
  global ADMIN_CACHE
30
+ if m.chat.type != ChatType.CHANNEL:
31
  return await m.reply_text(
32
  text="This command is made to be used in groups only!",
33
  )
 
103
  @Gojo.on_message(command("admincache"))
104
  async def reload_admins(_, m: Message):
105
  global TEMP_ADMIN_CACHE_BLOCK
106
+ if m.chat.type not in [ChatType.SUPERGROUP,ChatType.GROUP]:
107
  return await m.reply_text(
108
  "This command is made to be used in groups only!",
109
  )
 
187
  try:
188
  await m.chat.promote_member(user_id=user_id, privileges=bot.privileges)
189
  title = ""
190
+ if m.chat.type in [ChatType.SUPERGROUP, ChatType.GROUP]:
191
  title = "Gojo" # Default fullpromote title
192
  if len(m.text.split()) == 3 and not m.reply_to_message:
193
  title = m.text.split()[2]
 
289
  ),
290
  )
291
  title = ""
292
+ if m.chat.type in [ChatType.SUPERGROUP, ChatType.GROUP]:
293
  title = "Itadori" # Deafult title
294
  if len(m.text.split()) == 3 and not m.reply_to_message:
295
  title = m.text.split()[2]
Powers/plugins/bans.py CHANGED
@@ -603,6 +603,14 @@ async def unban_usr(c: Gojo, m: Message):
603
  else:
604
  reason = None
605
 
 
 
 
 
 
 
 
 
606
  try:
607
  await m.chat.unban_member(user_id)
608
  admin = m.from_user.mention
 
603
  else:
604
  reason = None
605
 
606
+ try:
607
+ statu = (await m.chat.get_member(user_id)).status
608
+ if statu not in [enums.ChatMemberStatus.BANNED,enums.ChatMemberStatus.RESTRICTED]:
609
+ await m.reply_text("User is not banned in this chat\nOr using this command as reply to his message")
610
+ return
611
+ except Exception as e:
612
+ LOGGER.error(e)
613
+ LOGGER.exception(format_exc())
614
  try:
615
  await m.chat.unban_member(user_id)
616
  admin = m.from_user.mention
Powers/plugins/dev.py CHANGED
@@ -1,6 +1,9 @@
 
1
  import sys
2
  from asyncio import create_subprocess_shell, sleep, subprocess
3
  from io import BytesIO, StringIO
 
 
4
  from time import gmtime, strftime, time
5
  from traceback import format_exc
6
 
@@ -9,34 +12,50 @@ from pyrogram.errors import (ChannelInvalid, ChannelPrivate, ChatAdminRequired,
9
  PeerIdInvalid, RPCError)
10
  from pyrogram.types import Message
11
 
12
- from Powers import BOT_TOKEN, LOGFILE, LOGGER, MESSAGE_DUMP, UPTIME, OWNER_ID, defult_dev, OWNER_ID
13
- from Powers.bot_class import Gojo
 
 
14
  from Powers.database.chats_db import Chats
15
  from Powers.utils.clean_file import remove_markdown_and_html
16
  from Powers.utils.custom_filters import command
 
17
  from Powers.utils.http_helper import *
18
  from Powers.utils.parser import mention_markdown
19
 
20
- @Gojo.on_message(command("adddev"))
 
21
  async def add_dev(c: Gojo, m:Message):
22
- if m.from_user.id != OWNER_ID:
23
- await m.reply_text("Only owner can do that")
24
- return
25
- split = m.text.split(None)
26
- reply_to = m.reply_to_message
27
- if len(split) != 2 or not reply_to:
28
- await m.reply_text("Give me an id or reply to message to add the user in dev")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
29
  return
30
- if reply_to:
31
- user = reply_to.from_user.id
32
- elif len(split) == 2:
33
- try:
34
- user = int(split[1])
35
- except ValueError:
36
- await m.reply_text("Give me id of the user")
37
- return
38
- defult_dev.append(user)
39
- return
40
 
41
  @Gojo.on_message(command("ping", sudo_cmd=True))
42
  async def ping(_, m: Message):
@@ -92,6 +111,22 @@ async def neofetch_stats(_, m: Message):
92
  await m.delete()
93
  return
94
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
95
 
96
  @Gojo.on_message(command(["eval", "py"], dev_cmd=True))
97
  async def evaluate_code(c: Gojo, m: Message):
@@ -103,6 +138,18 @@ async def evaluate_code(c: Gojo, m: Message):
103
  return
104
  sm = await m.reply_text("`Processing...`")
105
  cmd = m.text.split(None, maxsplit=1)[1]
 
 
 
 
 
 
 
 
 
 
 
 
106
 
107
  reply_to_id = m.id
108
  if m.reply_to_message:
@@ -134,16 +181,27 @@ async def evaluate_code(c: Gojo, m: Message):
134
  evaluation = stdout
135
  else:
136
  evaluation = "Success"
137
- evaluation = evaluation.strip()
138
- if (
139
- (evaluation.startswith(initial) or evaluation.endswith(end))
140
- or (BOT_TOKEN in evaluation)
141
- ) and m.from_user.id != OWNER_ID:
142
- evaluation = "Bhaag ja bsdk bada aya token nikalne wala"
143
- await c.send_message(
144
- MESSAGE_DUMP,
145
- f"@{m.from_user.username} TREID TO FETCH ENV OF BOT \n userid = {m.from_user.id}",
146
- )
 
 
 
 
 
 
 
 
 
 
 
147
  final_output = f"<b>EVAL</b>: <code>{cmd}</code>\n\n<b>OUTPUT</b>:\n<code>{evaluation}</code> \n"
148
 
149
  try:
@@ -167,21 +225,6 @@ async def aexec(code, c, m):
167
  return await locals()["__aexec"](c, m)
168
 
169
 
170
- HARMFUL = [
171
- "base64",
172
- "bash",
173
- "get_me()",
174
- "phone",
175
- "os.system",
176
- "sys.stdout",
177
- "sys.stderr",
178
- "subprocess",
179
- "DB_URI",
180
- "DB_URI",
181
- "BOT_TOKEN",
182
- "API_HASH",
183
- "APP_ID",
184
- ]
185
 
186
 
187
  @Gojo.on_message(command(["exec", "sh"], dev_cmd=True))
@@ -251,6 +294,63 @@ async def execution(c: Gojo, m: Message):
251
  await sm.delete()
252
  return
253
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
254
 
255
  @Gojo.on_message(command("chatlist", dev_cmd=True))
256
  async def chats(c: Gojo, m: Message):
@@ -362,12 +462,18 @@ async def chat_broadcast(c: Gojo, m: Message):
362
  return
363
 
364
 
365
- _DISABLE_CMDS_ = ["ping"]
 
366
 
367
  __HELP__ = """
368
  **DEV and SUDOERS commands**
369
 
 
 
 
 
370
  **Dev's commands:**
 
371
  • /logs : Return the logs of bot.
372
  • /neofetch : Fetch neo.
373
  • /eval : Evaluate the given python code.
 
1
+ import subprocess as subp
2
  import sys
3
  from asyncio import create_subprocess_shell, sleep, subprocess
4
  from io import BytesIO, StringIO
5
+ from os import execvp
6
+ from sys import executable
7
  from time import gmtime, strftime, time
8
  from traceback import format_exc
9
 
 
12
  PeerIdInvalid, RPCError)
13
  from pyrogram.types import Message
14
 
15
+ from Powers import (BOT_TOKEN, DEV_USERS, LOG_DATETIME, LOGFILE, LOGGER,
16
+ MESSAGE_DUMP, OWNER_ID, UPTIME)
17
+ from Powers.bot_class import Gojo, aiohttpsession
18
+ from Powers.database import MongoDB
19
  from Powers.database.chats_db import Chats
20
  from Powers.utils.clean_file import remove_markdown_and_html
21
  from Powers.utils.custom_filters import command
22
+ from Powers.utils.extract_user import extract_user
23
  from Powers.utils.http_helper import *
24
  from Powers.utils.parser import mention_markdown
25
 
26
+
27
+ @Gojo.on_message(command(["adddev", "rmdev"]))
28
  async def add_dev(c: Gojo, m:Message):
29
+ if m.from_user.id != OWNER_ID:
30
+ await m.reply_text("Only owner can do that")
31
+ return
32
+ split = m.text.split(None)
33
+ reply_to = m.reply_to_message
34
+ if len(split) != 2:
35
+ await m.reply_text("Reply to message to add the user in dev")
36
+ return
37
+ elif not reply_to:
38
+ await m.reply_text("Give me an id")
39
+ return
40
+ elif reply_to:
41
+ user = reply_to.from_user.id
42
+ elif len(split) == 2:
43
+ try:
44
+ user,_,_ = extract_user(c,m)
45
+ except Exception as e:
46
+ await m.reply_text(f"Give me id of the user {e}")
47
+ return
48
+ if m.command[0] == "rmdev":
49
+ try:
50
+ DEV_USERS.remove(user)
51
+ await m.reply_text(f"Removed {user} from dev")
52
+ return
53
+ except ValueError:
54
+ await m.reply_text("User is not a dev")
55
+ return
56
+ DEV_USERS.append(user)
57
+ await m.reply_text(f"Added {user} to dev")
58
  return
 
 
 
 
 
 
 
 
 
 
59
 
60
  @Gojo.on_message(command("ping", sudo_cmd=True))
61
  async def ping(_, m: Message):
 
111
  await m.delete()
112
  return
113
 
114
+ HARMFUL = [
115
+ "base64",
116
+ "bash",
117
+ "get_me()",
118
+ "phone",
119
+ "os.system",
120
+ "sys.stdout",
121
+ "sys.stderr",
122
+ "subprocess",
123
+ "DB_URI",
124
+ "DB_URI",
125
+ "BOT_TOKEN",
126
+ "API_HASH",
127
+ "APP_ID",
128
+ ]
129
+
130
 
131
  @Gojo.on_message(command(["eval", "py"], dev_cmd=True))
132
  async def evaluate_code(c: Gojo, m: Message):
 
138
  return
139
  sm = await m.reply_text("`Processing...`")
140
  cmd = m.text.split(None, maxsplit=1)[1]
141
+ if "for" in cmd or "while" in cmd or "with" in cmd:
142
+ if m.from_user.id != OWNER_ID:
143
+ await m.reply_text("Spam kro gaye vai.\nEse kese")
144
+ return
145
+ if "while True:" in cmd:
146
+ await sm.delete()
147
+ await m.reply_text("BSDK SPAM NI")
148
+ await c.send_message(
149
+ MESSAGE_DUMP,
150
+ f"@{m.from_user.username} TREID TO USE `while True` \n userid = {m.from_user.id}"
151
+ )
152
+ return
153
 
154
  reply_to_id = m.id
155
  if m.reply_to_message:
 
181
  evaluation = stdout
182
  else:
183
  evaluation = "Success"
184
+ for i in evaluation.split(None):
185
+ ev = i.strip()
186
+ if (
187
+ (ev.startswith(initial) or ev.endswith(end))
188
+ or (BOT_TOKEN in ev)
189
+ ) and m.from_user.id != OWNER_ID:
190
+ evaluation = "Bhaag ja bsdk"
191
+ await c.send_message(
192
+ MESSAGE_DUMP,
193
+ f"@{m.from_user.username} TREID TO FETCH ENV OF BOT \n userid = {m.from_user.id}",
194
+ )
195
+ for i in evaluation.split():
196
+ for j in i.split("="):
197
+ if j and j[0] in HARMFUL:
198
+ if m.from_user.id != OWNER_ID:
199
+ evaluation = "Bhaag ja bsdk"
200
+ await c.send_message(
201
+ MESSAGE_DUMP,
202
+ f"@{m.from_user.username} TREID TO FETCH ENV OF BOT \n userid = {m.from_user.id}"
203
+ )
204
+
205
  final_output = f"<b>EVAL</b>: <code>{cmd}</code>\n\n<b>OUTPUT</b>:\n<code>{evaluation}</code> \n"
206
 
207
  try:
 
225
  return await locals()["__aexec"](c, m)
226
 
227
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
228
 
229
 
230
  @Gojo.on_message(command(["exec", "sh"], dev_cmd=True))
 
294
  await sm.delete()
295
  return
296
 
297
+ async def stop_and_send_logger(c:Gojo,is_update=False):
298
+ runtime = strftime("%Hh %Mm %Ss", gmtime(time() - UPTIME))
299
+ LOGGER.info("Uploading logs before stopping...!\n")
300
+ # Send Logs to MESSAGE_DUMP and LOG_CHANNEL
301
+ await c.send_document(
302
+ MESSAGE_DUMP,
303
+ document=LOGFILE,
304
+ caption=(
305
+ f"{'Updating and Restarting'if is_update else 'Restarting'} The Bot !\n\n" f"Uptime: {runtime}\n" f"<code>{LOG_DATETIME}</code>"
306
+ ),
307
+ )
308
+ if MESSAGE_DUMP:
309
+ # LOG_CHANNEL is not necessary
310
+ await c.send_document(
311
+ MESSAGE_DUMP,
312
+ document=LOGFILE,
313
+ caption=f"Uptime: {runtime}",
314
+ )
315
+ MongoDB.close()
316
+ LOGGER.info(
317
+ f"""Bot Stopped.
318
+ Logs have been uploaded to the MESSAGE_DUMP Group!
319
+ Runtime: {runtime}s\n
320
+ """,
321
+ )
322
+ LOGGER.info(
323
+ "Closing client session"
324
+ )
325
+ await aiohttpsession.close()
326
+ LOGGER.info(
327
+ "Client session closed"
328
+ )
329
+ return
330
+
331
+ @Gojo.on_message(command(["restart", "update"], owner_cmd=True))
332
+ async def restart_the_bot(c:Gojo,m:Message):
333
+ try:
334
+ cmds = m.command
335
+ await m.reply_text(f"Restarting{' and updating ' if cmds[0] == 'update' else ' '}the bot...\nType `/ping` after few minutes")
336
+ if cmds[0] == "update":
337
+ try:
338
+ out = subp.check_output(["git", "pull"]).decode("UTF-8")
339
+ if "Already up to date." in str(out):
340
+ return await m.reply_text("Its already up-to date!")
341
+ await m.reply_text(f"```{out}```")
342
+ except Exception as e:
343
+ return await m.reply_text(str(e))
344
+ m = await m.reply_text("**Updated with main branch, restarting now.**")
345
+ await stop_and_send_logger(c,True)
346
+ if cmds[0] == "restart":
347
+ await stop_and_send_logger(c)
348
+ execvp(executable, [executable, "-m", "Powers"])
349
+ except Exception as e:
350
+ await m.reply_text(f"Failed to restart the bot due to\n{e}")
351
+ LOGGER.error(e)
352
+ LOGGER.error(format_exc())
353
+ return
354
 
355
  @Gojo.on_message(command("chatlist", dev_cmd=True))
356
  async def chats(c: Gojo, m: Message):
 
462
  return
463
 
464
 
465
+ __PLUGIN__ = "devs"
466
+
467
 
468
  __HELP__ = """
469
  **DEV and SUDOERS commands**
470
 
471
+ **Owner's commands:**
472
+ • /restart : Restart the bot
473
+ • /update : To update the bot with the main stream repo
474
+
475
  **Dev's commands:**
476
+ • /adddev : Reply to message or give me user id or username
477
  • /logs : Return the logs of bot.
478
  • /neofetch : Fetch neo.
479
  • /eval : Evaluate the given python code.
Powers/plugins/downloads.py DELETED
@@ -1,38 +0,0 @@
1
- # Add instagrapi & pytube in requirements.txt
2
- from pyrogram import Client, filters
3
- import urllib.request
4
- from instagrapi import Client as InstaClient
5
- from pytube import YouTube
6
- from Powers.bot_class import Gojo as app
7
-
8
- insta_client = InstaClient()
9
-
10
- @app.on_message(filters.command("download"))
11
- def download_media(client, message):
12
- chat_id = message.chat.id
13
- platform = message.text.split()[1]
14
- client.send_message(chat_id, "Enter your choice 1 for Instagram 2 For YouTube:")
15
- if platform == "1":
16
- client.send_message(chat_id, "Please enter the Instagram post or story URL:")
17
- insta_link = message.text.split()[2]
18
-
19
- media = insta_client.media_info(insta_link)
20
-
21
- video_url = media.video_versions[0].url
22
- urllib.request.urlretrieve(video_url, "video.mp4")
23
-
24
- client.send_video(chat_id, video="video.mp4")
25
-
26
- elif platform == "2":
27
- client.send_message(chat_id, "Please enter the YouTube link:")
28
- yt_link = message.text.split()[2]
29
-
30
- yt = YouTube(yt_link)
31
- stream = yt.streams.get_highest_resolution()
32
-
33
- stream.download(output_path="./", filename="video.mp4")
34
-
35
- client.send_video(chat_id, video="video.mp4")
36
-
37
- else:
38
- client.send_message(chat_id, "Invalid platform choice. Please enter 1 for Instagram or 2 for YouTube.")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Powers/plugins/filters.py CHANGED
@@ -4,6 +4,7 @@ from traceback import format_exc
4
 
5
  from pyrogram import filters
6
  from pyrogram.enums import ChatMemberStatus as CMS
 
7
  from pyrogram.errors import RPCError
8
  from pyrogram.types import CallbackQuery, InlineKeyboardMarkup, Message
9
 
@@ -219,7 +220,7 @@ async def send_filter_reply(c: Gojo, m: Message, trigger: str):
219
  try:
220
  await m.reply_text(
221
  textt,
222
- # parse_mode=enums.ParseMode.MARKDOWN,
223
  reply_markup=button,
224
  disable_web_page_preview=True,
225
  quote=True,
@@ -236,7 +237,7 @@ async def send_filter_reply(c: Gojo, m: Message, trigger: str):
236
  else:
237
  await m.reply_text(
238
  textt,
239
- # parse_mode=enums.ParseMode.MARKDOWN,
240
  quote=True,
241
  disable_web_page_preview=True,
242
  )
@@ -259,7 +260,7 @@ async def send_filter_reply(c: Gojo, m: Message, trigger: str):
259
  m.chat.id,
260
  getfilter["fileid"],
261
  caption=textt,
262
- # parse_mode=enums.ParseMode.MARKDOWN,
263
  reply_markup=button,
264
  reply_to_message_id=m.id,
265
  )
 
4
 
5
  from pyrogram import filters
6
  from pyrogram.enums import ChatMemberStatus as CMS
7
+ from pyrogram.enums import ParseMode as PM
8
  from pyrogram.errors import RPCError
9
  from pyrogram.types import CallbackQuery, InlineKeyboardMarkup, Message
10
 
 
220
  try:
221
  await m.reply_text(
222
  textt,
223
+ parse_mode=PM.MARKDOWN,
224
  reply_markup=button,
225
  disable_web_page_preview=True,
226
  quote=True,
 
237
  else:
238
  await m.reply_text(
239
  textt,
240
+ parse_mode=PM.MARKDOWN,
241
  quote=True,
242
  disable_web_page_preview=True,
243
  )
 
260
  m.chat.id,
261
  getfilter["fileid"],
262
  caption=textt,
263
+ parse_mode=PM.MARKDOWN,
264
  reply_markup=button,
265
  reply_to_message_id=m.id,
266
  )
Powers/plugins/giveaway.py ADDED
@@ -0,0 +1,624 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ from asyncio import sleep
3
+ from datetime import datetime, timedelta
4
+ from random import choice
5
+ from traceback import format_exc
6
+
7
+ from pyrogram import filters
8
+ from pyrogram.enums import ChatMemberStatus as CMS
9
+ from pyrogram.enums import ChatType as CT
10
+ from pyrogram.enums import MessageMediaType as MMT
11
+ from pyrogram.errors import UserNotParticipant
12
+ from pyrogram.types import CallbackQuery
13
+ from pyrogram.types import InlineKeyboardButton as IKB
14
+ from pyrogram.types import InlineKeyboardMarkup as IKM
15
+ from pyrogram.types import Message
16
+
17
+ from Powers import LOGGER
18
+ from Powers.bot_class import Gojo
19
+ from Powers.database.giveaway_db import GIVEAWAY
20
+ from Powers.utils.custom_filters import command
21
+ from Powers.vars import Config
22
+
23
+ user_entry = {} # {c_id : {participants_id : 0}}} dict be like
24
+ voted_user = {} # {c_id : [voter_ids]}} dict be like
25
+ total_entries = {} # {c_id : [user_id]} dict be like for participants
26
+ left_deduct = {} # {c_id:{u_id:p_id}} u_id = user who have voted, p_id = participant id. Will deduct vote from participants account if user leaves
27
+ rejoin_try = {} # store the id of the user who lefts the chat while giveaway under-process {c_id:[]}
28
+ is_start_vote = [] # store id of chat where voting is started
29
+
30
+ @Gojo.on_message(command(["startgiveaway", "startga"]))
31
+ async def start_give_one(c: Gojo, m: Message):
32
+ uWu = True
33
+ try:
34
+ if m.chat.type != CT.PRIVATE:
35
+ await m.reply_text("**USAGE**\n/startgiveaway\nMeant to be used in private")
36
+ return
37
+ GA = GIVEAWAY()
38
+ g_id = await c.ask(text="Send me number of giveaway", chat_id = m.chat.id, filters=filters.text)
39
+ give_id = g_id.text.markdown
40
+ curr = GA.give_info(u_id=m.from_user.id)
41
+ if curr:
42
+ gc_id = curr["chat_id"]
43
+ c_id = curr["where"]
44
+ if curr["is_give"]:
45
+ await m.reply_text("One giveaway is already in progress")
46
+ return
47
+ while True:
48
+ con = await c.ask(text="You info is already present in my database do you want to continue\nYes : To start the giveaway with previous configurations\nNo: To create one",chat_id = m.chat.id,filters=filters.text)
49
+ if con.text.lower() == "yes":
50
+ await c.send_message(m.chat.id,"Done")
51
+ while True:
52
+ yes_no = await c.ask(text="Ok.\nDo you want to allow old member of the channel can vote in this giveaway.\n**Yes: To allow**\n**No: To don't allow**\nNote that old mean user who is present in the chat for more than 48 hours",chat_id = m.from_user.id,filters=filters.text)
53
+ if yes_no.text.lower() == "yes":
54
+ is_old = 0
55
+ break
56
+ elif yes_no.text.lower() == "no":
57
+ is_old = 1
58
+ break
59
+ else:
60
+ await c.send_message(m.chat.id,"Type yes or no only")
61
+ f_c_id = gc_id
62
+ s_c_id = c_id
63
+ is_old = is_old
64
+ GA.update_is_old(m.from_user.id, is_old)
65
+ GA.stop_entries(m.from_user.id, entries = 1) # To start entries
66
+ GA.stop_give(m.from_user.id, is_give=1) # To start giveaway
67
+ link = await c.export_chat_invite_link(s_c_id)
68
+ uWu = False
69
+ await c.send_message(m.chat.id,"Done")
70
+ break
71
+ elif con.text.lower() == "no":
72
+ uWu = True
73
+ break
74
+ else:
75
+ await c.send_message(m.chat.id,"Type yes or no only")
76
+ if uWu:
77
+ while True:
78
+ channel_id = await c.ask(text="OK....send me id of the channel and make sure I am admin their. If you don't have id forward a post from your chat.\nType /cancel cancel the current process",chat_id = m.chat.id,filters=filters.text)
79
+ if channel_id.text:
80
+ if str(channel_id.text).lower() == "/cancel":
81
+
82
+ await c.send_message(m.from_user.id, "Cancelled")
83
+ try:
84
+ c_id = int(channel_id.text)
85
+ try:
86
+ bot_stat = (await c.get_chat_member(c_id,Config.BOT_ID)).status
87
+ if bot_stat == CMS.ADMINISTRATOR:
88
+ break
89
+ else:
90
+ await c.send_message(m.chat.id,f"Looks like I don't have admin privileges in the chat {c_id}\n Make me admin and then send me channel id again")
91
+ except UserNotParticipant:
92
+ await c.send_message(m.chat.id,f"Looks like I am not part of the chat {c_id}\n")
93
+
94
+
95
+ except ValueError:
96
+ await c.send_message(m.chat.id,"Channel id should be integer type")
97
+
98
+ else:
99
+ if channel_id.forward_from_chat:
100
+ try:
101
+ bot_stat = (await c.get_chat_member(c_id,Config.BOT_ID)).status
102
+ if bot_stat == CMS.ADMINISTRATOR:
103
+ break
104
+ else:
105
+ await c.send_message(m.chat.id,f"Looks like I don't have admin privileges in the chat {c_id}\n Make me admin and then send me channel id again")
106
+ except UserNotParticipant:
107
+ await c.send_message(m.chat.id,f"Looks like I am not part of the chat {c_id}\n")
108
+ else:
109
+ await c.send_message(m.chat.id,f"Forward me content from chat where you want to start giveaway")
110
+ f_c_id = c_id
111
+ await c.send_message(m.chat.id,"Channel id received")
112
+ while True:
113
+ chat_id = await c.ask(text="Sende me id of the chat and make sure I am admin their. If you don't have id go in the chat and type /id.\nType /cancel to cancel the current process",chat_id = m.chat.id,filters=filters.text)
114
+ if chat_id.text:
115
+ if str(chat_id.text).lower() == "/cancel":
116
+ await c.send_message(m.from_user.id, "Cancelled")
117
+ try:
118
+ cc_id = int(chat_id.text)
119
+ try:
120
+ cc_id = (await c.get_chat(cc_id)).id
121
+ s_c_id = cc_id
122
+ break
123
+ except Exception:
124
+ try:
125
+ cc_id = await c.resolve_peer(cc_id)
126
+ cc_id = (await c.get_chat(cc_id.channel_id)).id
127
+ s_c_id = cc_id
128
+ break
129
+ except Exception as e:
130
+ await c.send_message(m.chat.id,f"Looks like chat doesn't exist{e}")
131
+ except ValueError:
132
+ await c.send_message(m.chat.id,"Chat id should be integer type")
133
+
134
+ await c.send_message(m.chat.id,"Chat id received")
135
+
136
+ link = await c.export_chat_invite_link(cc_id)
137
+
138
+ yes_no = await c.ask(text="Do you want to allow old member of the channel can vote in this giveaway.\n**Yes: To allow**\n**No: To don't allow**\nNote that old mean user who is present in the chat for more than 48 hours",chat_id = m.from_user.id,filters=filters.text)
139
+ if yes_no.text.lower() == "yes":
140
+ is_old = 0
141
+ elif yes_no.text.lower() == "no":
142
+ is_old = 1
143
+ curr = GA.save_give(f_c_id, s_c_id, m.from_user.id, is_old, force_c=True)
144
+ except Exception as e:
145
+ LOGGER.error(e)
146
+ LOGGER.error(format_exc())
147
+ return
148
+
149
+ reply = m.reply_to_message
150
+ giveaway_text = f"""
151
+ **#Giveaway {give_id} 》**
152
+ ➖➖➖➖➖➖➖➖➖➖➖
153
+ __To win this logo giveaway__
154
+ __participate in the contest__,
155
+ __Comment /enter to begin__
156
+
157
+ Bot should be started!!
158
+ ➖➖➖➖➖➖➖➖➖➖➖
159
+ **Status : Entries open**
160
+ """
161
+
162
+ kb = IKM([[IKB("Join the chat", url=link)],[IKB("Start the bot", url=f"https://{Config.BOT_USERNAME}.t.me/")]])
163
+ try:
164
+ if reply and (reply.media in [MMT.VIDEO, MMT.PHOTO] or (reply.document.mime_type.split("/")[0]=="image")):
165
+ if reply.photo:
166
+ pin = await c.send_photo(f_c_id, reply.photo.file_id, giveaway_text, reply_markup=kb)
167
+ elif reply.video:
168
+ pin = await c.send_video(f_c_id, reply.video.file_id, giveaway_text, reply_markup=kb)
169
+ elif reply.document:
170
+ download = await reply.download()
171
+ pin = await c.send_photo(f_c_id, download, giveaway_text, reply_markup=kb)
172
+ os.remove(download)
173
+ else:
174
+ pin = await c.send_message(f_c_id,giveaway_text, reply_markup=kb, disable_web_page_preview=True)
175
+ except Exception as e:
176
+ LOGGER.error(e)
177
+ LOGGER.error(format_exc())
178
+ await m.reply_text(f"Failed to send message to channel due to\n{e}")
179
+ return
180
+ c_in = await c.get_chat(f_c_id)
181
+ name = c_in.title
182
+ await m.reply_text(f"✨ Giveaway post has been sent to [{name}]({c_in.invite_link})", disable_web_page_preview=True, reply_markup=IKM([[IKB("Go To Post", url=pin.link)]]))
183
+
184
+
185
+ async def message_editor(c:Gojo, m: Message, c_id):
186
+ txt = f"""
187
+ **#Giveaway 》**
188
+ ➖➖➖➖➖➖➖➖➖➖➖
189
+ __To win this logo giveaway__
190
+ __participate in the contest__,
191
+ __Comment /enter to begin__
192
+
193
+ Note: Bot should be started!!
194
+ ➖➖➖➖➖➖➖➖➖➖➖
195
+ **Status : Entries closed**
196
+ **Total entries : {len(total_entries[c_id])}**
197
+ """
198
+ try:
199
+ m_id = int(m.text.split(None)[1].split("/")[-1])
200
+ except ValueError:
201
+ await m.reply_text("The link doesn't contain any message id")
202
+ return False
203
+ try:
204
+ mess = await c.get_messages(c_id,m_id)
205
+ except Exception as e:
206
+ await m.reply_text(f"Failed to get message form the chat id {c_id}. Due to following error\n{e}")
207
+ return False
208
+ try:
209
+ if mess.caption:
210
+ await mess.edit_caption(txt)
211
+ else:
212
+ await mess.edit_text(txt)
213
+ return True
214
+ except Exception as e:
215
+ await m.reply_text(f"Failed to update the message due to following error\n{e}")
216
+ await m.reply_text(f"Here is the text you can edit the message by your self\n`{txt}`\nSorry for inconvenience")
217
+ return False
218
+
219
+
220
+ @Gojo.on_message(command("stopentry"))
221
+ async def stop_give_entry(c:Gojo, m: Message):
222
+ GA = GIVEAWAY()
223
+ u_id = m.from_user.id
224
+ curr = GA.give_info(u_id=u_id)
225
+ if not curr:
226
+ await m.reply_text("You have not started any giveaway yeat.")
227
+ return
228
+ if not curr["entries"]:
229
+ await m.reply_text("You have not started any giveaway yeat.")
230
+ return
231
+ user = curr["user_id"]
232
+ if u_id != user:
233
+ await m.reply_text("You are not the one who have started the giveaway")
234
+ return
235
+ c_id = curr["chat_id"]
236
+ if len(m.text.split(None)) != 2:
237
+ await m.reply_text("**Usage**\n`/stopentry <post link>`")
238
+ return
239
+ GA.stop_entries(u_id)
240
+ z = await message_editor(c,m,c_id)
241
+ if not z:
242
+ return
243
+ await m.reply_text("Stopped the further entries")
244
+ return
245
+
246
+ def clean_values(c_id):
247
+ try:
248
+ rejoin_try[c_id].clear()
249
+ except KeyError:
250
+ pass
251
+ try:
252
+ user_entry[c_id].clear()
253
+ except KeyError:
254
+ pass
255
+ try:
256
+ left_deduct[c_id].clear()
257
+ except KeyError:
258
+ pass
259
+ try:
260
+ total_entries[c_id].clear()
261
+ except KeyError:
262
+ pass
263
+ try:
264
+ is_start_vote.remove(c_id)
265
+ except ValueError:
266
+ pass
267
+ try:
268
+ voted_user[c_id].clear()
269
+ except KeyError:
270
+ pass
271
+ return
272
+
273
+ @Gojo.on_message(command(["stopgiveaway","stopga"]))
274
+ async def stop_give_away(c:Gojo, m: Message):
275
+ GA = GIVEAWAY()
276
+ u_id = m.from_user.id
277
+ curr = GA.give_info(u_id=u_id)
278
+ if not curr:
279
+ await m.reply_text("You have not started any giveaway yet")
280
+ return
281
+ if not curr["is_give"]:
282
+ await m.reply_text("You have not started any giveaway yet")
283
+ return
284
+ user = curr["user_id"]
285
+ c_id = curr["chat_id"]
286
+
287
+ GA.stop_entries(u_id)
288
+ GA.start_vote(u_id,0)
289
+ try:
290
+ if not len(total_entries[c_id]):
291
+ await m.reply_text("No entires found")
292
+ GA.stop_give(u_id)
293
+ clean_values(c_id)
294
+ await m.reply_text("Stopped the giveaway")
295
+ return
296
+ except KeyError:
297
+ await m.reply_text("No entires found")
298
+ GA.stop_give(u_id)
299
+ clean_values(c_id)
300
+ await m.reply_text("Stopped the giveaway")
301
+ return
302
+ if u_id != user:
303
+ await m.reply_text("You are not the one who have started the giveaway")
304
+ return
305
+ try:
306
+ if not len(user_entry[c_id]):
307
+ await m.reply_text("No entries found")
308
+ GA.stop_give(u_id)
309
+ clean_values(c_id)
310
+ await m.reply_text("Stopped the giveaway")
311
+ return
312
+ except KeyError:
313
+ GA.stop_give(u_id)
314
+ clean_values(c_id)
315
+ await m.reply_text("Stopped the giveaway")
316
+ return
317
+ GA.stop_give(u_id)
318
+ try:
319
+ if not len(voted_user[c_id]):
320
+ clean_values(c_id)
321
+ await m.reply_text("No voters found")
322
+ GA.stop_give(u_id)
323
+ await m.reply_text("Stopped the giveaway")
324
+ return
325
+ except KeyError:
326
+ GA.stop_give(u_id)
327
+ clean_values(c_id)
328
+ await m.reply_text("Stopped the giveaway")
329
+ return
330
+ # highest = max(user_entry[c_id], key=lambda k:user_entry[c_id][k])
331
+ # high = user_entry[c_id][highest]
332
+ max_value = max(user_entry[c_id].values())
333
+ max_user = []
334
+ for k,v in user_entry[c_id].items():
335
+ if v == max_value:
336
+ max_user.append(k)
337
+ if len(max_user) == 1:
338
+
339
+ high = max_value
340
+ user_high = (await c.get_users(max_user[0])).mention
341
+ txt = f"""
342
+ **Giveaway complete** ✅
343
+ ➖➖➖➖➖➖➖➖➖➖➖
344
+ ≡ Total participants: {len(total_entries[c_id])}
345
+ ≡ Total number of votes: {len(voted_user[c_id])}
346
+
347
+ ≡ Winner 🏆 : {user_high}
348
+ ≡ Vote got 🗳 : `{high}` votes
349
+ ➖➖➖➖➖➖➖➖➖➖➖
350
+ >>>Thanks for participating
351
+ """
352
+ else:
353
+ to_key = ["Jai hind", "Jai Jawaan","Jai Bharat", "Jai shree ram", "Jai shree shyam", "Jai shree Krishn", "Jai shree radhe", "Radhe radhe", "Sambhu", "Jai mata di", "Jai mahakaal", "Jai bajarangbali"]
354
+ key = choice(to_key)
355
+ high = max_value
356
+ user_h = [i.mention for i in await c.get_users(max_user)]
357
+ txt = f"""
358
+ **Giveaway complete** ✅
359
+ ➖➖➖➖➖➖➖➖➖➖➖
360
+ ≡ Total participants: {len(total_entries[c_id])}
361
+ ≡ Total number of votes: {len(voted_user[c_id])}
362
+
363
+ ≡ It's a tie between following users:
364
+ {", ".join(user_h)}
365
+ ≡ They each got 🗳 : `{high}` votes
366
+ ➖➖➖➖➖➖➖➖➖➖➖
367
+ >>>Thanks for participating
368
+
369
+ The user who will comment the code will win
370
+ Code: `{key}`
371
+ """
372
+ await c.send_message(c_id, txt)
373
+ clean_values(c_id)
374
+ await m.reply_text("Stopped giveaway")
375
+
376
+ @Gojo.on_message(command("startvote"))
377
+ async def start_the_vote(c: Gojo, m: Message):
378
+ GA = GIVEAWAY()
379
+ u_id = m.from_user.id
380
+ curr = GA.give_info(u_id=m.from_user.id)
381
+ if not curr:
382
+ await m.reply_text("You have not started any giveaway yet")
383
+ return
384
+ if not curr["is_give"]:
385
+ await m.reply_text("You have not started any giveaway yet")
386
+ return
387
+ c_id = curr["chat_id"]
388
+ user = curr["user_id"]
389
+ if len(is_start_vote):
390
+ if m.chat.id in is_start_vote:
391
+ await m.reply_text("Voting is already started for this chat")
392
+ return
393
+ if len(m.text.split(None)) == 2:
394
+ await message_editor(c,m,c_id)
395
+ else:
396
+ await m.reply_text("No message link provided to update status to closed")
397
+ GA.stop_entries(u_id)
398
+ if u_id != user:
399
+ await m.reply_text("You are not the one who have started the giveaway")
400
+ return
401
+ try:
402
+ if not len(total_entries[c_id]):
403
+ clean_values(c_id)
404
+ await m.reply_text("No entires found")
405
+ return
406
+ except KeyError:
407
+ clean_values(c_id)
408
+ await m.reply_text("No entires found")
409
+ return
410
+ users = await c.get_users(total_entries[c_id])
411
+ c_link = await c.export_chat_invite_link(c_id)
412
+ for user in users:
413
+ u_id = user.id
414
+ full_name = user.first_name
415
+ if user.last_name and user.first_name:
416
+ full_name = user.first_name +" "+ user.last_name
417
+ u_name = user.username if user.username else user.mention
418
+ txt = f"""
419
+ **Participant's info:** 🔍 》
420
+ ➖➖➖➖➖➖➖➖➖➖➖
421
+ ≡ Participant's name : {full_name}
422
+ ≡ Participant's ID : `{u_id}`
423
+ ≡ Participant's {'username' if user.username else "mention"} : {'@'if user.username else ""}{u_name}
424
+ ➖➖➖➖➖➖➖➖➖➖➖
425
+ >>>Thanks for participating
426
+ """
427
+ if not len(user_entry):
428
+ user_entry[c_id] = {u_id:0}
429
+ else:
430
+ try:
431
+ user_entry[c_id][u_id] = 0
432
+ except KeyError:
433
+ user_entry[c_id] = {u_id:0}
434
+ vote_kb = IKM([[IKB("❤️", f"vote_{c_id}_{u_id}")]])
435
+ um = await c.send_message(c_id, txt, reply_markup=vote_kb)
436
+ if m.chat.username and not c_link:
437
+ c_link = f"https://t.me/{m.chat.username}"
438
+ join_channel_kb = IKM([[IKB("Giveaway Channel", url=c_link)]])
439
+ txt_ib = f"Voting has been started 》\n\n>>>Here is your vote link :\nHere is your vote message link {um.link}.\n\n**Things to keep in mind**\n■ If user lefts the chat after voting your vote count will be deducted.\n■ If an user left and rejoins the chat he will not be able to vote.\n■ If an user is not part of the chat then he'll not be able to vote"
440
+ await c.send_message(u_id, txt_ib, reply_markup=join_channel_kb,disable_web_page_preview=True)
441
+ await sleep(5) # To avoid flood
442
+ GA.start_vote(u_id)
443
+ is_start_vote.append(c_id)
444
+ await m.reply_text("Started the voting")
445
+ return
446
+
447
+
448
+ @Gojo.on_message(command(["enter","register","participate"]))
449
+ async def register_user(c: Gojo, m: Message):
450
+ GA = GIVEAWAY()
451
+ curr = GA.is_vote(m.chat.id)
452
+ if not curr:
453
+ await m.reply_text("No giveaway to participate in.\nOr may be entries are closed now")
454
+ return
455
+ curr = GA.give_info(m.chat.id)
456
+ if not curr["is_give"]:
457
+ await m.reply_text("No giveaway to participate in. Wait for the next one")
458
+ return
459
+ elif not curr["entries"]:
460
+ await m.reply_text("You are late,\nentries are closed 🫤\nTry again in next giveaway")
461
+ return
462
+ c_id = curr["chat_id"]
463
+ if len(total_entries):
464
+ try:
465
+ if m.from_user.id in total_entries[c_id]:
466
+ await m.reply_text("You are already registered")
467
+ return
468
+ except KeyError:
469
+ pass
470
+ try:
471
+ await c.send_message(m.from_user.id, "Thanks for participating in the giveaway")
472
+ except Exception:
473
+ await m.reply_text("Start the bot first\nAnd try again",reply_markup=IKM([[IKB("Star the bot", url=f"https://{Config.BOT_USERNAME}.t.me/")]]))
474
+ return
475
+ curr = GA.give_info(m.chat.id)
476
+ c_id = curr["chat_id"]
477
+ if not len(total_entries):
478
+ total_entries[c_id] = [m.from_user.id]
479
+ else:
480
+ try:
481
+ if m.from_user.id not in total_entries[c_id]:
482
+ total_entries[c_id].append(m.from_user.id)
483
+ else:
484
+ pass
485
+ except KeyError:
486
+ total_entries[c_id] = [m.from_user.id]
487
+ await m.reply_text("You are registered successfully\n**Don't block the bot because you are going to get info about giveaway via bot**")
488
+ return
489
+
490
+ def get_curr_votes(p_id,c_id):
491
+ votess = []
492
+ if votess:
493
+ votess.clear()
494
+ if not len(left_deduct[c_id]):
495
+ votes = 0
496
+ return 0
497
+ for i,j in left_deduct[c_id].items():
498
+ if j == p_id:
499
+ votess.append(i)
500
+ votes = len(votess)
501
+ return votes
502
+
503
+ @Gojo.on_callback_query(filters.regex("^vote_"))
504
+ async def vote_increment(c: Gojo, q: CallbackQuery):
505
+ GA = GIVEAWAY()
506
+ data = q.data.split("_")
507
+ c_id = int(data[1])
508
+ u_id = int(data[2])
509
+ curr = GA.give_info(c_id)
510
+ if not curr["is_give"]:
511
+ await q.answer("Voting is closed")
512
+ return
513
+ if not curr:
514
+ return
515
+ if len(rejoin_try):
516
+ try:
517
+ if q.from_user.id in rejoin_try[c_id]:
518
+ await q.answer("You can't vote. Because your rejoined the chat during giveaway")
519
+ return
520
+ except KeyError:
521
+ pass
522
+ is_old = curr["is_new"]
523
+ can_old = False
524
+ if is_old:
525
+ can_old = datetime.now() - timedelta(days=2)
526
+ try:
527
+ is_part = await c.get_chat_member(c_id,q.from_user.id)
528
+ except UserNotParticipant:
529
+ await q.answer("Join the channel to vote", True)
530
+ return
531
+ if is_part.status not in [CMS.MEMBER, CMS.OWNER, CMS.ADMINISTRATOR]:
532
+ await q.answer("Join the channel to vote", True)
533
+ return
534
+ if can_old and can_old < is_part.joined_date:
535
+ await q.answer("Old member can't vote", True)
536
+ return
537
+ if not len(voted_user):
538
+ voted_user[c_id] = [q.from_user.id]
539
+ elif len(voted_user):
540
+ try:
541
+ if q.from_user.id in voted_user[c_id]:
542
+ await q.answer("You have already voted once", True)
543
+ return
544
+ voted_user[c_id].append(q.from_user.id)
545
+ except KeyError:
546
+ voted_user[c_id] = [q.from_user.id]
547
+ try:
548
+ left_deduct[c_id][q.from_user.id] = u_id
549
+ except KeyError:
550
+ left_deduct[c_id] = {q.from_user.id:u_id}
551
+ votes = get_curr_votes(u_id,c_id)
552
+ try:
553
+ user_entry[c_id][u_id] += 1
554
+ new_vote = IKM([[IKB(f"❤️ {votes}", f"vote_{c_id}_{u_id}")]])
555
+ await q.answer("Voted.")
556
+ await q.edit_message_reply_markup(new_vote)
557
+ except KeyError:
558
+ await q.answer("Voting has been closed for this giveaway",True)
559
+ return
560
+ except Exception as e:
561
+ LOGGER.error(e)
562
+ LOGGER.error(format_exc())
563
+
564
+
565
+ @Gojo.on_message(filters.left_chat_member)
566
+ async def rejoin_try_not(c:Gojo, m: Message):
567
+ user = m.left_chat_member
568
+ if not user:
569
+ return
570
+ GA = GIVEAWAY()
571
+ Ezio = GA.give_info(m.chat.id)
572
+ if not Ezio:
573
+ return
574
+ Captain = user.id
575
+ if len(voted_user):
576
+ if Captain in voted_user[m.chat.id]:
577
+ GB = int(left_deduct[m.chat.id][Captain])
578
+ user_entry[m.chat.id][GB] -= 1
579
+ await c.send_message(GB,f"One user who have voted you left the chat so his vote is reduced from your total votes.\nNote that he will not able to vote if he rejoins the chat\nLeft user : {Captain}")
580
+ try:
581
+ rejoin_try[m.chat.id].append(Captain)
582
+ except KeyError:
583
+ rejoin_try[m.chat.id] = [Captain]
584
+ else:
585
+ try:
586
+ rejoin_try[m.chat.id].append(Captain)
587
+ except KeyError:
588
+ rejoin_try[m.chat.id] = [Captain]
589
+ return
590
+
591
+
592
+ __PLUGIN__ = "giveaway"
593
+
594
+ __alt_name__ = [
595
+ "giveaway",
596
+ "events"
597
+ ]
598
+
599
+ __HELP__ = """
600
+ **Giveaway**
601
+ • /enter (/register, /participate): To participate in giveaway. Make sure the bot is started to get registered.
602
+
603
+ **Admin commands:**
604
+ • /startgiveaway (/startga) : Start the giveaway. Reply to media to send giveaway start message with tagged media (Will only wrok in bot ib).
605
+
606
+ **User dependent commands**
607
+ • /stopentry <post link>: Stop the further entries. Channel for which you want to stop the entries. Pass the post link of the post you want to edit the msg and set it as closed message
608
+ • /stopgiveaway (/stopga) : Stop the giveaway. Channel for which you want to stop the giveaway. Will also close voting at same time.
609
+ • /startvote <post link>: Start uploading all the user info and will start voting. Pass the post link of the post you want to edit the msg and set it as closed message. Not necessary to give post link.
610
+
611
+ **Post link (For Channels) = Message link (For chats)**
612
+
613
+ **All the above command (except `/startgiveaway`) can only be valid iff the user who started the giveaway gives them**
614
+
615
+ **TO USE THE ADMIN COMMANDS YOU MUST BE ADMIN IN BOTH CHANNEL AS WELL AS CHAT**
616
+
617
+ **USER DEPENDENT COMMANDS ARE THOSE COMMANDS WHICH CAN ONLY BE USED BY THE USER WHO HAVE GIVEN `/startgiveaway` COMMAND
618
+
619
+ **Example:**
620
+ `/enter`
621
+
622
+ **NOTE**
623
+ Bot should be admin where you are doing giveaway and where you are taking entries.
624
+ """
Powers/plugins/info.py CHANGED
@@ -52,7 +52,7 @@ async def count(c: Gojo, chat):
52
  except Exception as e:
53
  total_bot = (
54
  total_admin
55
- ) = bot_admin = total_banned = "Can't fetch due to some error."
56
 
57
  return total_bot, total_admin, bot_admin, total_banned
58
 
@@ -66,7 +66,7 @@ async def user_info(c: Gojo, user, already=False):
66
  gbanned, reason_gban = gban_db.get_gban(user.id)
67
  if gbanned:
68
  gban = True
69
- reason = f"The user is gbanned because {reason_gban}"
70
  else:
71
  gban = False
72
  reason = "User is not gbanned"
@@ -149,7 +149,15 @@ async def user_info(c: Gojo, user, already=False):
149
 
150
  async def chat_info(c: Gojo, chat, already=False):
151
  if not already:
152
- chat = await c.get_chat(chat)
 
 
 
 
 
 
 
 
153
  chat_id = chat.id
154
  username = chat.username
155
  total_bot, total_admin, total_bot_admin, total_banned = await count(c, chat.id)
@@ -254,6 +262,8 @@ async def chat_info_func(c: Gojo, message: Message):
254
  except (ValueError, Exception) as ef:
255
  if "invalid literal for int() with base 10:" in str(ef):
256
  chat = str(chat)
 
 
257
  else:
258
  return await message.reply_text(
259
  f"Got and exception {ef}\n**Usage:**/chinfo [USERNAME|ID]"
@@ -262,9 +272,12 @@ async def chat_info_func(c: Gojo, message: Message):
262
  m = await message.reply_text(
263
  f"Fetching chat info of chat from telegram's database....."
264
  )
265
-
266
  try:
267
  info_caption, photo_id = await chat_info(c, chat=chat)
 
 
 
268
  except Exception as e:
269
  await m.delete()
270
  await sleep(0.5)
 
52
  except Exception as e:
53
  total_bot = (
54
  total_admin
55
+ ) = bot_admin = total_banned = "Can't fetch because I am not part of the chat."
56
 
57
  return total_bot, total_admin, bot_admin, total_banned
58
 
 
66
  gbanned, reason_gban = gban_db.get_gban(user.id)
67
  if gbanned:
68
  gban = True
69
+ reason = reason_gban
70
  else:
71
  gban = False
72
  reason = "User is not gbanned"
 
149
 
150
  async def chat_info(c: Gojo, chat, already=False):
151
  if not already:
152
+ try:
153
+ chat = await c.get_chat(chat)
154
+ except Exception:
155
+ try:
156
+ chat_r = await c.resolve_peer(chat)
157
+ chat = await c.get_chat(chat_r.channel_id)
158
+ except KeyError as e:
159
+ caption = f"Failed to find the chat due to\n{e}"
160
+ return caption, None
161
  chat_id = chat.id
162
  username = chat.username
163
  total_bot, total_admin, total_bot_admin, total_banned = await count(c, chat.id)
 
262
  except (ValueError, Exception) as ef:
263
  if "invalid literal for int() with base 10:" in str(ef):
264
  chat = str(chat)
265
+ if chat.startswith("https://"):
266
+ chat = '@'+chat.split("/")[-1]
267
  else:
268
  return await message.reply_text(
269
  f"Got and exception {ef}\n**Usage:**/chinfo [USERNAME|ID]"
 
272
  m = await message.reply_text(
273
  f"Fetching chat info of chat from telegram's database....."
274
  )
275
+
276
  try:
277
  info_caption, photo_id = await chat_info(c, chat=chat)
278
+ if info_caption.startswith("Failed to find the chat due"):
279
+ await message.reply_text(info_caption)
280
+ return
281
  except Exception as e:
282
  await m.delete()
283
  await sleep(0.5)
Powers/plugins/locks.py CHANGED
@@ -1,14 +1,22 @@
1
  from asyncio import sleep
 
2
 
 
3
  from pyrogram.errors import ChatAdminRequired, ChatNotModified, RPCError
4
  from pyrogram.types import ChatPermissions, Message
5
 
6
- from Powers import LOGGER
7
  from Powers.bot_class import Gojo
8
  from Powers.database.approve_db import Approve
 
9
  from Powers.utils.custom_filters import command, restrict_filter
10
 
 
11
 
 
 
 
 
12
  @Gojo.on_message(command("locktypes"))
13
  async def lock_types(_, m: Message):
14
  await m.reply_text(
@@ -25,7 +33,11 @@ async def lock_types(_, m: Message):
25
  " - `inlinebots`, `inline` = Inline bots\n"
26
  " - `animations` = Animations\n"
27
  " - `games` = Game Bots\n"
28
- " - `stickers` = Stickers"
 
 
 
 
29
  ),
30
  )
31
  return
@@ -109,12 +121,51 @@ async def lock_perm(c: Gojo, m: Message):
109
  elif lock_type == "pin":
110
  pin = False
111
  perm = "pin"
112
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
113
  else:
114
  await m.reply_text(
115
  text=""" Invalid Lock Type!
116
 
117
- Use /locktypes to get the lock types"""
118
  )
119
  return
120
 
@@ -153,7 +204,16 @@ async def view_locks(_, m: Message):
153
  if val:
154
  return "✅"
155
  return "❌"
156
-
 
 
 
 
 
 
 
 
 
157
  vmsg = await convert_to_emoji(v_perm.can_send_messages)
158
  vmedia = await convert_to_emoji(v_perm.can_send_media_messages)
159
  vother = await convert_to_emoji(v_perm.can_send_other_messages)
@@ -162,6 +222,10 @@ async def view_locks(_, m: Message):
162
  vinfo = await convert_to_emoji(v_perm.can_change_info)
163
  vinvite = await convert_to_emoji(v_perm.can_invite_users)
164
  vpin = await convert_to_emoji(v_perm.can_pin_messages)
 
 
 
 
165
 
166
  if v_perm is not None:
167
  try:
@@ -177,7 +241,12 @@ async def view_locks(_, m: Message):
177
  <b>Send Polls:</b> {vpolls}
178
  <b>Change Info:</b> {vinfo}
179
  <b>Invite Users:</b> {vinvite}
180
- <b>Pin Messages:</b> {vpin}"""
 
 
 
 
 
181
  LOGGER.info(f"{m.from_user.id} used locks cmd in {m.chat.id}")
182
  await chkmsg.edit_text(permission_view_str)
183
 
@@ -277,7 +346,50 @@ async def unlock_perm(c: Gojo, m: Message):
277
  elif unlock_type == "pin":
278
  upin = True
279
  uperm = "pin"
280
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
281
  else:
282
  await m.reply_text(
283
  text="""Invalid Lock Type!
@@ -313,6 +425,55 @@ async def unlock_perm(c: Gojo, m: Message):
313
  await prevent_approved(m)
314
  return
315
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
316
 
317
  async def prevent_approved(m: Message):
318
  approved_users = Approve(m.chat.id).list_approved()
 
1
  from asyncio import sleep
2
+ from traceback import format_exc
3
 
4
+ from pyrogram import filters
5
  from pyrogram.errors import ChatAdminRequired, ChatNotModified, RPCError
6
  from pyrogram.types import ChatPermissions, Message
7
 
8
+ from Powers import DEV_USERS, LOGGER, OWNER_ID, SUDO_USERS
9
  from Powers.bot_class import Gojo
10
  from Powers.database.approve_db import Approve
11
+ from Powers.utils.caching import ADMIN_CACHE, admin_cache_reload
12
  from Powers.utils.custom_filters import command, restrict_filter
13
 
14
+ SUDO_LEVEL = set(SUDO_USERS + DEV_USERS + [int(OWNER_ID)])
15
 
16
+ anti_c_send = [-1001604479593]
17
+ anti_forward = [-1001604479593]
18
+ anti_forward_u = []
19
+ anti_forward_c = []
20
  @Gojo.on_message(command("locktypes"))
21
  async def lock_types(_, m: Message):
22
  await m.reply_text(
 
33
  " - `inlinebots`, `inline` = Inline bots\n"
34
  " - `animations` = Animations\n"
35
  " - `games` = Game Bots\n"
36
+ " - `stickers` = Stickers\n"
37
+ " - `anonchannel` = Send as chat will be locked\n"
38
+ " - `forwardall` = Forwarding from channel and user\n"
39
+ " - `forwardu` = Forwarding from user\n"
40
+ " - `forwardc` = Forwarding from channel"
41
  ),
42
  )
43
  return
 
121
  elif lock_type == "pin":
122
  pin = False
123
  perm = "pin"
124
+ elif lock_type == "anonchannel":
125
+ if not len(anti_c_send):
126
+ anti_c_send.append(m.chat.id)
127
+ elif m.chat.id not in anti_c_send:
128
+ anti_c_send.append(m.chat.id)
129
+ else:
130
+ await m.reply_text("It is already on")
131
+ return
132
+ await m.reply_text("Locked Send As Chat")
133
+ return
134
+ elif lock_type == "forwardall":
135
+ if not len(anti_forward):
136
+ anti_forward.append(m.chat.id)
137
+ elif m.chat.id not in anti_forward:
138
+ anti_forward.append(m.chat.id)
139
+ else:
140
+ await m.reply_text("It is already on")
141
+ return
142
+ await m.reply_text("Locked Forward from user as well as channel")
143
+ return
144
+ elif lock_type == "forwardu":
145
+ if not len(anti_forward_u):
146
+ anti_forward_u.append(m.chat.id)
147
+ elif m.chat.id not in anti_forward:
148
+ anti_forward_u.append(m.chat.id)
149
+ else:
150
+ await m.reply_text("It is already on")
151
+ return
152
+ await m.reply_text("Locked Forward message from user")
153
+ return
154
+ elif lock_type == "forwardc":
155
+ if not len(anti_forward_c):
156
+ anti_forward_c.append(m.chat.id)
157
+ elif m.chat.id not in anti_forward:
158
+ anti_forward_c.append(m.chat.id)
159
+ else:
160
+ await m.reply_text("It is already on")
161
+ return
162
+ await m.reply_text("Locked Forward message from channel")
163
+ return
164
  else:
165
  await m.reply_text(
166
  text=""" Invalid Lock Type!
167
 
168
+ Use /locktypes to get the lock types"""
169
  )
170
  return
171
 
 
204
  if val:
205
  return "✅"
206
  return "❌"
207
+ anon = False
208
+ if m.chat.id in anti_c_send:
209
+ anon = True
210
+ anti_f = False
211
+ if m.chat.id in anti_forward:
212
+ anti_f = True
213
+ if m.chat.id in anti_forward_u:
214
+ anti_f_u = True
215
+ if m.chat.id in anti_forward_c:
216
+ anti_f_c = True
217
  vmsg = await convert_to_emoji(v_perm.can_send_messages)
218
  vmedia = await convert_to_emoji(v_perm.can_send_media_messages)
219
  vother = await convert_to_emoji(v_perm.can_send_other_messages)
 
222
  vinfo = await convert_to_emoji(v_perm.can_change_info)
223
  vinvite = await convert_to_emoji(v_perm.can_invite_users)
224
  vpin = await convert_to_emoji(v_perm.can_pin_messages)
225
+ vanon = await convert_to_emoji(anon)
226
+ vanti = await convert_to_emoji(anti_f)
227
+ vantiu = await convert_to_emoji(anti_f_u)
228
+ vantic = await convert_to_emoji(anti_f_c)
229
 
230
  if v_perm is not None:
231
  try:
 
241
  <b>Send Polls:</b> {vpolls}
242
  <b>Change Info:</b> {vinfo}
243
  <b>Invite Users:</b> {vinvite}
244
+ <b>Pin Messages:</b> {vpin}
245
+ <b>Send as chat:</b> {vanon}
246
+ <b>Can forward:</b> {vanti}
247
+ <b>Can forward from user:</b> {vantiu}
248
+ <b>Can forward from channel and chats:</b> {vantic}
249
+ """
250
  LOGGER.info(f"{m.from_user.id} used locks cmd in {m.chat.id}")
251
  await chkmsg.edit_text(permission_view_str)
252
 
 
346
  elif unlock_type == "pin":
347
  upin = True
348
  uperm = "pin"
349
+ elif unlock_type == "anonchannel":
350
+ try:
351
+ if not len(anti_c_send) or m.chat.id not in anti_c_send:
352
+ await m.reply_text("Already off")
353
+ return
354
+ anti_c_send.remove(m.chat.id)
355
+ await m.reply_text("Send as chat is now enabled for this chat")
356
+ return
357
+ except ValueError:
358
+ await m.reply_text("It is already off")
359
+ return
360
+ elif unlock_type == "forwardall":
361
+ try:
362
+ if not len(anti_forward) or m.chat.id not in anti_forward:
363
+ await m.reply_text("Already off")
364
+ return
365
+ anti_forward.remove(m.chat.id)
366
+ await m.reply_text("Forwarding content is now enabled for this chat")
367
+ return
368
+ except ValueError:
369
+ await m.reply_text("It is already off")
370
+ return
371
+ elif unlock_type == "forwardu":
372
+ try:
373
+ if not len(anti_forward_u) or m.chat.id not in anti_forward_u:
374
+ await m.reply_text("Already off")
375
+ return
376
+ anti_forward_u.remove(m.chat.id)
377
+ await m.reply_text("Forwarding content is now enabled for this chat")
378
+ return
379
+ except ValueError:
380
+ await m.reply_text("It is already off")
381
+ return
382
+ elif unlock_type == "forwardc":
383
+ try:
384
+ if not len(anti_forward_c) or m.chat.id not in anti_forward_c:
385
+ await m.reply_text("Already off")
386
+ return
387
+ anti_forward_c.remove(m.chat.id)
388
+ await m.reply_text("Forwarding content is now enabled for this chat")
389
+ return
390
+ except ValueError:
391
+ await m.reply_text("It is already off")
392
+ return
393
  else:
394
  await m.reply_text(
395
  text="""Invalid Lock Type!
 
425
  await prevent_approved(m)
426
  return
427
 
428
+ async def delete_messages(c:Gojo, m: Message):
429
+ try:
430
+ await m.delete()
431
+ return
432
+ except RPCError as rp:
433
+ LOGGER.error(rp)
434
+ LOGGER.error(format_exc())
435
+ return
436
+
437
+ async def is_approved_user(c:Gojo, m: Message):
438
+ approved_users = Approve(m.chat.id).list_approved()
439
+ ul = [user[0] for user in approved_users]
440
+ try:
441
+ admins_group = {i[0] for i in ADMIN_CACHE[m.chat.id]}
442
+ except KeyError:
443
+ admins_group = await admin_cache_reload(m, "lock")
444
+
445
+ if m.forward_from:
446
+ if m.from_user.id in ul or m.from_user.id in SUDO_LEVEL or m.from_user.id in admins_group:
447
+ return True
448
+ return False
449
+ elif m.forward_from_chat:
450
+ x_chat = (await c.get_chat(m.forward_from_chat.id)).linked_chat
451
+ if not x_chat:
452
+ return False
453
+ elif x_chat and x_chat.id == m.chat.id:
454
+ return True
455
+ return False
456
+
457
+ @Gojo.on_message(filters.all & ~filters.me,18)
458
+ async def lock_del_mess(c:Gojo, m: Message):
459
+ all_chats = anti_c_send + anti_forward + anti_forward_c + anti_forward_u
460
+ if m.chat.id not in all_chats:
461
+ return
462
+ if m.sender_chat and not (m.forward_from_chat or m.forward_from):
463
+ await delete_messages(c,m)
464
+ return
465
+ elif m.forward_from or m.forward_from_chat:
466
+ is_approved = await is_approved_user(c,m)
467
+ if not is_approved:
468
+ if m.chat.id in anti_forward:
469
+ await delete_messages(c,m)
470
+ return
471
+ elif m.chat.id in anti_forward_u and not m.forward_from_chat:
472
+ await delete_messages(c,m)
473
+ return
474
+ elif m.chat.id in anti_forward_c and m.forward_from_chat:
475
+ await delete_messages(c,m)
476
+ return
477
 
478
  async def prevent_approved(m: Message):
479
  approved_users = Approve(m.chat.id).list_approved()
Powers/plugins/muting.py CHANGED
@@ -1,5 +1,7 @@
1
  from random import choice
 
2
 
 
3
  from pyrogram.errors import (ChatAdminRequired, RightForbidden, RPCError,
4
  UserNotParticipant)
5
  from pyrogram.filters import regex
@@ -576,7 +578,14 @@ async def unmute_usr(c: Gojo, m: Message):
576
  if user_id == Config.BOT_ID:
577
  await m.reply_text("Huh, why would I unmute myself if you are using me?")
578
  return
579
-
 
 
 
 
 
 
 
580
  try:
581
  await m.chat.unban_member(user_id)
582
  LOGGER.info(f"{m.from_user.id} unmuted {user_id} in {m.chat.id}")
 
1
  from random import choice
2
+ from traceback import format_exc
3
 
4
+ from pyrogram import enums
5
  from pyrogram.errors import (ChatAdminRequired, RightForbidden, RPCError,
6
  UserNotParticipant)
7
  from pyrogram.filters import regex
 
578
  if user_id == Config.BOT_ID:
579
  await m.reply_text("Huh, why would I unmute myself if you are using me?")
580
  return
581
+ try:
582
+ statu = (await m.chat.get_member(user_id)).status
583
+ if statu not in [enums.ChatMemberStatus.BANNED,enums.ChatMemberStatus.RESTRICTED]:
584
+ await m.reply_text("User is not muted in this chat\nOr using this command as reply to his message")
585
+ return
586
+ except Exception as e:
587
+ LOGGER.error(e)
588
+ LOGGER.exception(format_exc())
589
  try:
590
  await m.chat.unban_member(user_id)
591
  LOGGER.info(f"{m.from_user.id} unmuted {user_id} in {m.chat.id}")
Powers/plugins/report.py CHANGED
@@ -66,7 +66,7 @@ async def report_setting(_, m: Message):
66
  @Gojo.on_message(command("report") & filters.group)
67
  async def report_watcher(c: Gojo, m: Message):
68
 
69
- if m.chat.type != ChatType.SUPERGROUP:
70
  return
71
 
72
  if not m.from_user:
 
66
  @Gojo.on_message(command("report") & filters.group)
67
  async def report_watcher(c: Gojo, m: Message):
68
 
69
+ if m.chat.type not in [ChatType.SUPERGROUP, ChatType.GROUP]:
70
  return
71
 
72
  if not m.from_user:
Powers/plugins/stats.py CHANGED
@@ -59,7 +59,7 @@ async def get_stats(_, m: Message):
59
  f"<b>Notes:</b> <code>{(notesdb.count_all_notes())}</code> in <code>{(notesdb.count_notes_chats())}</code> chats\n"
60
  f" <b>Private Notes:</b> <code>{(notesettings_db.count_chats())}</code> chats\n"
61
  f"<b>GBanned Users:</b> <code>{(gbandb.count_gbans())}</code>\n"
62
- f"<b>Welcoming Users in:</b> <code>{(grtdb.count_chats('welcome'))}</code> chats"
63
  f"<b>Approved People</b>: <code>{(appdb.count_all_approved())}</code> in <code>{(appdb.count_approved_chats())}</code> chats\n"
64
  f"<b>Disabling:</b> <code>{(dsbl.count_disabled_all())}</code> items in <code>{(dsbl.count_disabling_chats())}</code> chats.\n"
65
  "<b>Action:</b>\n"
 
59
  f"<b>Notes:</b> <code>{(notesdb.count_all_notes())}</code> in <code>{(notesdb.count_notes_chats())}</code> chats\n"
60
  f" <b>Private Notes:</b> <code>{(notesettings_db.count_chats())}</code> chats\n"
61
  f"<b>GBanned Users:</b> <code>{(gbandb.count_gbans())}</code>\n"
62
+ f"<b>Welcoming Users in:</b> <code>{(grtdb.count_chats('welcome'))}</code> chats\n"
63
  f"<b>Approved People</b>: <code>{(appdb.count_all_approved())}</code> in <code>{(appdb.count_approved_chats())}</code> chats\n"
64
  f"<b>Disabling:</b> <code>{(dsbl.count_disabled_all())}</code> items in <code>{(dsbl.count_disabling_chats())}</code> chats.\n"
65
  "<b>Action:</b>\n"
Powers/plugins/utils.py CHANGED
@@ -133,8 +133,8 @@ async def get_lyrics(_, m: Message):
133
  async def id_info(c: Gojo, m: Message):
134
 
135
  ChatType = enums.ChatType
136
- if m.chat.type == ChatType.SUPERGROUP and not m.reply_to_message:
137
- await m.reply_text(text=f"This Group's ID is <code>{m.chat.id}</code>")
138
  return
139
 
140
  if m.chat.type == ChatType.PRIVATE and not m.reply_to_message:
@@ -170,9 +170,15 @@ async def id_info(c: Gojo, m: Message):
170
  parse_mode=enums.ParseMode.HTML,
171
  )
172
  elif m.chat.type == ChatType.PRIVATE:
173
- await m.reply_text(text=f"Your ID is <code>{m.chat.id}</code>.")
 
 
 
 
 
 
174
  else:
175
- await m.reply_text(text=f"This Group's ID is <code>{m.chat.id}</code>")
176
  return
177
 
178
 
 
133
  async def id_info(c: Gojo, m: Message):
134
 
135
  ChatType = enums.ChatType
136
+ if m.chat.type in [ChatType.SUPERGROUP, ChatType.GROUP] and not m.reply_to_message:
137
+ await m.reply_text(text=f"This Group's ID is <code>{m.chat.id}</code>\nYour ID <code>{m.from_user.id}</code>")
138
  return
139
 
140
  if m.chat.type == ChatType.PRIVATE and not m.reply_to_message:
 
170
  parse_mode=enums.ParseMode.HTML,
171
  )
172
  elif m.chat.type == ChatType.PRIVATE:
173
+ text=f"Your ID is <code>{m.chat.id}</code>."
174
+ if m.reply_to_message:
175
+ if m.forward_from:
176
+ text+=f"Forwarded from user ID <code>{m.forward_from.id}</code>."
177
+ elif m.forward_from_chat:
178
+ text+=f"Forwarded from user ID <code>{m.forward_from_chat.id}</code>."
179
+ await m.reply_text()
180
  else:
181
+ await m.reply_text(text=f"This Group's ID is <code>{m.chat.id}</code>\nYour ID <code>{m.from_user.id}</code>")
182
  return
183
 
184
 
Powers/plugins/watchers.py CHANGED
@@ -5,6 +5,7 @@ from traceback import format_exc
5
  from pyrogram import filters
6
  from pyrogram.errors import ChatAdminRequired, RPCError, UserAdminInvalid
7
  from pyrogram.types import ChatPermissions, Message
 
8
 
9
  from Powers import LOGGER, MESSAGE_DUMP, SUPPORT_STAFF
10
  from Powers.bot_class import Gojo
@@ -17,7 +18,6 @@ from Powers.database.warns_db import Warns, WarnSettings
17
  from Powers.utils.caching import ADMIN_CACHE, admin_cache_reload
18
  from Powers.utils.parser import mention_html
19
  from Powers.utils.regex_utils import regex_searcher
20
- from RiZoeLX.functions import update_scanlist
21
 
22
  # Initialise
23
  gban_db = GBan()
@@ -169,10 +169,6 @@ async def bl_watcher(_, m: Message):
169
 
170
  SCANLIST = []
171
 
172
- @Gojo.on_message(filters.command(["start", "ping"])
173
- async def updatescanlist(_, message: Message):
174
- global SCANLIST
175
- SCANLIST = update_scanlist()
176
 
177
  @Gojo.on_message(filters.user(list(ANTISPAM_BANNED)) & filters.group)
178
  async def gban_watcher(c: Gojo, m: Message):
@@ -222,7 +218,7 @@ Scanned by TeamRed7 | Phoenix API ;)
222
  Appeal [Here](https://t.me/Red7WatchSupport)
223
  """
224
  try:
225
- await c.ban_chat_member(m.chat.id, user.id)
226
  await c.send_message(m.chat.id, msg, disable_web_page_preview=True)
227
  except Exception as a:
228
  LOGGER.error(a)
 
5
  from pyrogram import filters
6
  from pyrogram.errors import ChatAdminRequired, RPCError, UserAdminInvalid
7
  from pyrogram.types import ChatPermissions, Message
8
+ from RiZoeLX.functions import update_scanlist
9
 
10
  from Powers import LOGGER, MESSAGE_DUMP, SUPPORT_STAFF
11
  from Powers.bot_class import Gojo
 
18
  from Powers.utils.caching import ADMIN_CACHE, admin_cache_reload
19
  from Powers.utils.parser import mention_html
20
  from Powers.utils.regex_utils import regex_searcher
 
21
 
22
  # Initialise
23
  gban_db = GBan()
 
169
 
170
  SCANLIST = []
171
 
 
 
 
 
172
 
173
  @Gojo.on_message(filters.user(list(ANTISPAM_BANNED)) & filters.group)
174
  async def gban_watcher(c: Gojo, m: Message):
 
218
  Appeal [Here](https://t.me/Red7WatchSupport)
219
  """
220
  try:
221
+ await c.ban_chat_member(m.chat.id, m.from_user.id)
222
  await c.send_message(m.chat.id, msg, disable_web_page_preview=True)
223
  except Exception as a:
224
  LOGGER.error(a)
Powers/utils/custom_filters.py CHANGED
@@ -116,7 +116,7 @@ async def bot_admin_check_func(_, __, m: Message or CallbackQuery):
116
  if isinstance(m, CallbackQuery):
117
  m = m.message
118
 
119
- if m.chat.type != ChatType.SUPERGROUP:
120
  return False
121
 
122
  # Telegram and GroupAnonyamousBot
@@ -149,16 +149,13 @@ async def admin_check_func(_, __, m: Message or CallbackQuery):
149
  if isinstance(m, CallbackQuery):
150
  m = m.message
151
 
152
- if m.chat.type != ChatType.SUPERGROUP:
153
  return False
154
 
155
  # Telegram and GroupAnonyamousBot
156
  if m.sender_chat:
157
  return True
158
 
159
- # Bypass the bot devs, sudos and owner
160
- if m.from_user.id in SUDO_LEVEL:
161
- return True
162
 
163
  try:
164
  admin_group = {i[0] for i in ADMIN_CACHE[m.chat.id]}
@@ -184,13 +181,9 @@ async def owner_check_func(_, __, m: Message or CallbackQuery):
184
  if isinstance(m, CallbackQuery):
185
  m = m.message
186
 
187
- if (m.chat.type != ChatType.SUPERGROUP) and m.chat.id != -1001586309125: # testing chat of the bot
188
  return False
189
 
190
- # Bypass the bot devs, sudos and owner
191
- if m.from_user.id in DEV_LEVEL:
192
- return True
193
-
194
  user = await m.chat.get_member(m.from_user.id)
195
 
196
  if user.status == CMS.OWNER:
@@ -212,13 +205,10 @@ async def restrict_check_func(_, __, m: Message or CallbackQuery):
212
  m = m.message
213
 
214
  if (
215
- m.chat.type != ChatType.SUPERGROUP and m.chat.id != -1001586309125
216
- ): # testing chat of the bot
217
  return False
218
 
219
- # Bypass the bot devs, sudos and owner
220
- if m.from_user.id in DEV_LEVEL:
221
- return True
222
 
223
  user = await m.chat.get_member(m.from_user.id)
224
 
@@ -236,12 +226,9 @@ async def promote_check_func(_, __, m):
236
  if isinstance(m, CallbackQuery):
237
  m = m.message
238
 
239
- if (m.chat.type != ChatType.SUPERGROUP) and m.chat.id != -1001586309125: # testing chat of the bot
240
  return False
241
 
242
- # Bypass the bot devs, sudos and owner
243
- if m.from_user.id in DEV_LEVEL:
244
- return True
245
 
246
  user = await m.chat.get_member(m.from_user.id)
247
 
@@ -259,7 +246,7 @@ async def changeinfo_check_func(_, __, m):
259
  if isinstance(m, CallbackQuery):
260
  m = m.message
261
 
262
- if m.chat.type != ChatType.SUPERGROUP:
263
  await m.reply_text("This command is made to be used in groups not in pm!")
264
  return False
265
 
@@ -267,9 +254,6 @@ async def changeinfo_check_func(_, __, m):
267
  if m.sender_chat:
268
  return True
269
 
270
- # Bypass the bot devs, sudos and owner
271
- if m.from_user.id in SUDO_LEVEL:
272
- return True
273
 
274
  user = await m.chat.get_member(m.from_user.id)
275
 
@@ -287,7 +271,7 @@ async def can_pin_message_func(_, __, m):
287
  if isinstance(m, CallbackQuery):
288
  m = m.message
289
 
290
- if m.chat.type != ChatType.SUPERGROUP:
291
  await m.reply_text("This command is made to be used in groups not in pm!")
292
  return False
293
 
 
116
  if isinstance(m, CallbackQuery):
117
  m = m.message
118
 
119
+ if m.chat.type not in [ChatType.SUPERGROUP, ChatType.GROUP]:
120
  return False
121
 
122
  # Telegram and GroupAnonyamousBot
 
149
  if isinstance(m, CallbackQuery):
150
  m = m.message
151
 
152
+ if m.chat.type not in [ChatType.SUPERGROUP, ChatType.GROUP]:
153
  return False
154
 
155
  # Telegram and GroupAnonyamousBot
156
  if m.sender_chat:
157
  return True
158
 
 
 
 
159
 
160
  try:
161
  admin_group = {i[0] for i in ADMIN_CACHE[m.chat.id]}
 
181
  if isinstance(m, CallbackQuery):
182
  m = m.message
183
 
184
+ if m.chat.type not in [ChatType.SUPERGROUP, ChatType.GROUP]:
185
  return False
186
 
 
 
 
 
187
  user = await m.chat.get_member(m.from_user.id)
188
 
189
  if user.status == CMS.OWNER:
 
205
  m = m.message
206
 
207
  if (
208
+ m.chat.type not in [ChatType.SUPERGROUP, ChatType.GROUP]
209
+ ):
210
  return False
211
 
 
 
 
212
 
213
  user = await m.chat.get_member(m.from_user.id)
214
 
 
226
  if isinstance(m, CallbackQuery):
227
  m = m.message
228
 
229
+ if m.chat.type not in [ChatType.SUPERGROUP, ChatType.GROUP]:
230
  return False
231
 
 
 
 
232
 
233
  user = await m.chat.get_member(m.from_user.id)
234
 
 
246
  if isinstance(m, CallbackQuery):
247
  m = m.message
248
 
249
+ if m.chat.type not in [ChatType.SUPERGROUP, ChatType.GROUP]:
250
  await m.reply_text("This command is made to be used in groups not in pm!")
251
  return False
252
 
 
254
  if m.sender_chat:
255
  return True
256
 
 
 
 
257
 
258
  user = await m.chat.get_member(m.from_user.id)
259
 
 
271
  if isinstance(m, CallbackQuery):
272
  m = m.message
273
 
274
+ if m.chat.type not in [ChatType.SUPERGROUP, ChatType.GROUP]:
275
  await m.reply_text("This command is made to be used in groups not in pm!")
276
  return False
277
 
Powers/utils/extract_user.py CHANGED
@@ -54,7 +54,11 @@ async def extract_user(c: Gojo, m: Message) -> Tuple[int, str, str]:
54
  try:
55
  user = await c.get_users(user_found)
56
  except Exception as ef:
57
- return await m.reply_text(f"User not found ! Error: {ef}")
 
 
 
 
58
  user_id = user.id
59
  user_first_name = user.first_name
60
  user_name = user.username
@@ -89,7 +93,11 @@ async def extract_user(c: Gojo, m: Message) -> Tuple[int, str, str]:
89
  try:
90
  user = await c.get_users(user_id)
91
  except Exception as ef:
92
- return await m.reply_text(f"User not found ! Error: {ef}")
 
 
 
 
93
  user_first_name = user.first_name
94
  user_name = user.username
95
  LOGGER.error(ef)
 
54
  try:
55
  user = await c.get_users(user_found)
56
  except Exception as ef:
57
+ try:
58
+ user_r = await c.resolve_peer(user_found)
59
+ user = await c.get_users(user_r.user_id)
60
+ except Exception as ef:
61
+ return await m.reply_text(f"User not found ! Error: {ef}")
62
  user_id = user.id
63
  user_first_name = user.first_name
64
  user_name = user.username
 
93
  try:
94
  user = await c.get_users(user_id)
95
  except Exception as ef:
96
+ try:
97
+ user_r = await c.resolve_peer(user_found)
98
+ user = await c.get_users(user_r.user_id)
99
+ except Exception as ef:
100
+ return await m.reply_text(f"User not found ! Error: {ef}")
101
  user_first_name = user.first_name
102
  user_name = user.username
103
  LOGGER.error(ef)
Powers/utils/start_utils.py CHANGED
@@ -5,7 +5,7 @@ from traceback import format_exc
5
  from pyrogram.errors import RPCError
6
  from pyrogram.types import CallbackQuery, Message
7
 
8
- from Powers import HELP_COMMANDS, LOGGER, SUPPORT_GROUP, owner_username
9
  from Powers.bot_class import Gojo
10
  from Powers.database.chats_db import Chats
11
  from Powers.database.notes_db import Notes
 
5
  from pyrogram.errors import RPCError
6
  from pyrogram.types import CallbackQuery, Message
7
 
8
+ from Powers import HELP_COMMANDS, LOGGER, SUPPORT_GROUP
9
  from Powers.bot_class import Gojo
10
  from Powers.database.chats_db import Chats
11
  from Powers.database.notes_db import Notes
Powers/vars.py CHANGED
@@ -27,7 +27,7 @@ class Config:
27
  int(i)
28
  for i in config(
29
  "SUDO_USERS",
30
- default="1344569458",
31
  ).split(" ")
32
  ]
33
  WHITELIST_USERS = [
 
27
  int(i)
28
  for i in config(
29
  "SUDO_USERS",
30
+ default="1344569458 1906306037",
31
  ).split(" ")
32
  ]
33
  WHITELIST_USERS = [
Version/version 2.1.0.md ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # V 2.0.0
2
+ ### Changes made:
3
+ - Added giveaway support in the bot. Which will help the user who do giveaways
4
+ - Now Dev users can't promote themselves neither they can restrict members
5
+ - Added **2 owner commands** `/restart` and `/update`
6
+ - Now bot can fetch user info and chat info on large scale. Minimized the chances to get user not found message
7
+ - Added **4 new lock types**
8
+ - Now using `/id <username of user>` will give the user's id as well.
9
+ - Improved stability.
10
+ - Fixed few bugs.
11
+ - Bug known 0
12
+ - Deployed and tested locally.
13
+
14
+ ## Report issues [here](https://github.com/Gojo-Bots/Gojo_Satoru/issues/new/choose) if find any.
15
+
16
+ ## Give ideas [here](https://github.com/Gojo-Bots/Gojo_Satoru/discussions/new?category=ideas) for next update.
17
+
18
+ ## Trying our best to give the best
19
+
20
+ ## Regards 🧑‍💻: [Captain Ezio](https://github.com/iamgojoof6eyes)
requirements.txt CHANGED
@@ -2,7 +2,7 @@ aiofiles==23.1.0; python_full_version >= "3.7"
2
  aiohttp==3.7.4; python_version >= "3.6" and python_version < "4.0"
3
  anyio==3.6.2; python_full_version >= "3.6.2" and python_version >= "3.6"
4
  asyncio==3.4.3
5
- beautifulsoup4==4.12.0; python_full_version >= "3.6"
6
  cachetools==5.2.0; python_version >= "3.7" and python_version < "4.0"
7
  certifi==2022.12.7; python_version >= "3.7" and python_version < "4"
8
  charset-normalizer==2.1.0; python_version >= "3.7" and python_version < "4" and python_full_version >= "3.6.0"
@@ -14,6 +14,8 @@ lxml==4.9.1; python_version >= "2.7" and python_full_version < "3.0.0" or python
14
  prettyconf==2.2.1
15
  pyaes==1.6.1; python_version >= "3.6" and python_version < "4.0"
16
  pymongo==4.3.3
 
 
17
  pyrogram==2.0.102; python_version >= "3.8"
18
  pysocks==1.7.1; python_version >= "3.7" and python_full_version < "3.0.0" and python_version < "4.0" or python_version >= "3.7" and python_version < "4.0" and python_full_version >= "3.4.0"
19
  python-dateutil==2.8.2; (python_version >= "2.7" and python_full_version < "3.0.0") or (python_full_version >= "3.3.0")
@@ -27,8 +29,9 @@ sniffio==1.3.0; python_full_version >= "3.6.2" and python_version >= "3.7"
27
  soupsieve==2.4; python_version >= "3.6" and python_full_version >= "3.6.0"
28
  tgcrypto==1.2.5; python_version >= "3.6" and python_version < "4.0"
29
  tswift==0.7.0
30
- typing-extensions==4.3.0; python_full_version >= "3.6.2" and python_version >= "3.7" and python_version < "3.8"
31
  ujson==5.7.0; python_version >= "3.7"
32
  urllib3==1.26.11; python_version >= "3.7" and python_full_version < "3.0.0" and python_version < "4" or python_full_version >= "3.6.0" and python_version < "4" and python_version >= "3.7"
 
33
  wikipedia==1.4.0
34
- pyRiZoeLX
 
2
  aiohttp==3.7.4; python_version >= "3.6" and python_version < "4.0"
3
  anyio==3.6.2; python_full_version >= "3.6.2" and python_version >= "3.6"
4
  asyncio==3.4.3
5
+ beautifulsoup4==4.11.2; python_full_version >= "3.6"
6
  cachetools==5.2.0; python_version >= "3.7" and python_version < "4.0"
7
  certifi==2022.12.7; python_version >= "3.7" and python_version < "4"
8
  charset-normalizer==2.1.0; python_version >= "3.7" and python_version < "4" and python_full_version >= "3.6.0"
 
14
  prettyconf==2.2.1
15
  pyaes==1.6.1; python_version >= "3.6" and python_version < "4.0"
16
  pymongo==4.3.3
17
+ pyRiZoeLX
18
+ pyroaddon==1.0.6
19
  pyrogram==2.0.102; python_version >= "3.8"
20
  pysocks==1.7.1; python_version >= "3.7" and python_full_version < "3.0.0" and python_version < "4.0" or python_version >= "3.7" and python_version < "4.0" and python_full_version >= "3.4.0"
21
  python-dateutil==2.8.2; (python_version >= "2.7" and python_full_version < "3.0.0") or (python_full_version >= "3.3.0")
 
29
  soupsieve==2.4; python_version >= "3.6" and python_full_version >= "3.6.0"
30
  tgcrypto==1.2.5; python_version >= "3.6" and python_version < "4.0"
31
  tswift==0.7.0
32
+ typing-extensions==4.5.0; python_full_version >= "3.6.2" and python_version >= "3.7" and python_version < "3.8"
33
  ujson==5.7.0; python_version >= "3.7"
34
  urllib3==1.26.11; python_version >= "3.7" and python_full_version < "3.0.0" and python_version < "4" or python_full_version >= "3.6.0" and python_version < "4" and python_version >= "3.7"
35
+ uvloop==0.17.0
36
  wikipedia==1.4.0
37
+ yt-dlp==2023.3.4