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

Few things left

Browse files
Powers/plugins/admin.py CHANGED
@@ -81,25 +81,27 @@ async def adminlist_show(_, m: Message):
81
  return
82
 
83
 
 
84
  @Gojo.on_message(command("zombies") & admin_filter)
85
  async def zombie_clean(c: Gojo, m: Message):
86
  zombie = 0
87
  wait = await m.reply_text("Searching ... and banning ...")
 
88
  async for member in c.get_chat_members(m.chat.id):
89
  if member.user.is_deleted:
90
  zombie += 1
91
  try:
92
  await c.ban_chat_member(m.chat.id, member.user.id)
93
  except UserAdminInvalid:
94
- zombie -= 1
95
  except FloodWait as e:
96
  await sleep(e.x)
97
  if zombie == 0:
98
  return await wait.edit_text("Group is clean!")
99
- return await wait.edit_text(
100
- text=f"<b>{zombie}</b> Zombies found and has been banned!",
101
- )
102
-
103
 
104
  @Gojo.on_message(command("admincache"))
105
  async def reload_admins(_, m: Message):
@@ -163,8 +165,8 @@ async def fullpromote_usr(c: Gojo, m: Message):
163
  user_id, user_first_name, user_name = await extract_user(c, m)
164
  except Exception:
165
  return
166
- bot = await c.get_chat_member(m.chat.id, Config.BOT_ID)
167
- if user_id == Config.BOT_ID:
168
  await m.reply_text("Huh, how can I even promote myself?")
169
  return
170
  if not bot.privileges.can_promote_members:
@@ -259,8 +261,8 @@ async def promote_usr(c: Gojo, m: Message):
259
  user_id, user_first_name, user_name = await extract_user(c, m)
260
  except Exception:
261
  return
262
- bot = await c.get_chat_member(m.chat.id, Config.BOT_ID)
263
- if user_id == Config.BOT_ID:
264
  await m.reply_text("Huh, how can I even promote myself?")
265
  return
266
  if not bot.privileges.can_promote_members:
@@ -290,6 +292,8 @@ async def promote_usr(c: Gojo, m: Message):
290
  can_pin_messages=bot.privileges.can_pin_messages,
291
  can_manage_chat=bot.privileges.can_manage_chat,
292
  can_manage_video_chats=bot.privileges.can_manage_video_chats,
 
 
293
  ),
294
  )
295
  title = ""
@@ -358,7 +362,7 @@ async def demote_usr(c: Gojo, m: Message):
358
  user_id, user_first_name, _ = await extract_user(c, m)
359
  except Exception:
360
  return
361
- if user_id == Config.BOT_ID:
362
  await m.reply_text("Get an admin to demote me!")
363
  return
364
  # If user not already admin
@@ -511,7 +515,7 @@ async def set_user_title(c: Gojo, m: Message):
511
  return
512
  if not user_id:
513
  return await m.reply_text("Cannot find user!")
514
- if user_id == Config.BOT_ID:
515
  return await m.reply_text("Huh, why ?")
516
  if not reason:
517
  return await m.reply_text("Read /help please!")
 
81
  return
82
 
83
 
84
+
85
  @Gojo.on_message(command("zombies") & admin_filter)
86
  async def zombie_clean(c: Gojo, m: Message):
87
  zombie = 0
88
  wait = await m.reply_text("Searching ... and banning ...")
89
+ failed = 0
90
  async for member in c.get_chat_members(m.chat.id):
91
  if member.user.is_deleted:
92
  zombie += 1
93
  try:
94
  await c.ban_chat_member(m.chat.id, member.user.id)
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()
102
+ txt=f"<b>{zombie}</b> Zombies found and {zombie - failed} has been banned!\n{failed} zombies' are immune to me",
103
+ await m.reply_animation("https://graph.org/file/02a1dcf7788186ffb36cb.mp4", caption=txt)
104
+ return
105
 
106
  @Gojo.on_message(command("admincache"))
107
  async def reload_admins(_, m: Message):
 
165
  user_id, user_first_name, user_name = await extract_user(c, m)
166
  except Exception:
167
  return
168
+ bot = await c.get_chat_member(m.chat.id, c.me.id)
169
+ if user_id == c.me.id:
170
  await m.reply_text("Huh, how can I even promote myself?")
171
  return
172
  if not bot.privileges.can_promote_members:
 
261
  user_id, user_first_name, user_name = await extract_user(c, m)
262
  except Exception:
263
  return
264
+ bot = await c.get_chat_member(m.chat.id, c.me.id)
265
+ if user_id == c.me.id:
266
  await m.reply_text("Huh, how can I even promote myself?")
267
  return
268
  if not bot.privileges.can_promote_members:
 
292
  can_pin_messages=bot.privileges.can_pin_messages,
293
  can_manage_chat=bot.privileges.can_manage_chat,
294
  can_manage_video_chats=bot.privileges.can_manage_video_chats,
295
+ can_post_messages=bot.privileges.can_post_messages,
296
+ can_edit_messages=bot.privileges.can_edit_messages
297
  ),
298
  )
299
  title = ""
 
362
  user_id, user_first_name, _ = await extract_user(c, m)
363
  except Exception:
364
  return
365
+ if user_id == c.me.id:
366
  await m.reply_text("Get an admin to demote me!")
367
  return
368
  # If user not already admin
 
515
  return
516
  if not user_id:
517
  return await m.reply_text("Cannot find user!")
518
+ if user_id == c.me.id:
519
  return await m.reply_text("Huh, why ?")
520
  if not reason:
521
  return await m.reply_text("Read /help please!")
Powers/plugins/antispam.py CHANGED
@@ -44,7 +44,7 @@ async def gban(c: Gojo, m: Message):
44
  await m.reply_text(text="This user is part of my Support!, Can't ban our own!")
45
  return
46
 
47
- if user_id == Config.BOT_ID:
48
  await m.reply_text(
49
  text="You don't dare use that command on me again nigga! \n Go straight and fuck your self......"
50
  )
@@ -99,7 +99,7 @@ async def ungban(c: Gojo, m: Message):
99
  await m.reply_text(text="This user is part of my Support!, Can't ban our own!")
100
  return
101
 
102
- if user_id == Config.BOT_ID:
103
  await m.reply_text(
104
  text="""You can't gban me nigga!
105
  Fuck yourself.......!"""
@@ -156,7 +156,8 @@ async def gban_list(_, m: Message):
156
 
157
  banfile = "Here are all the globally banned geys!\n\n"
158
  for user in banned_users:
159
- banfile += f"[x] <b>{Users.get_user_info(user['_id'])['name']}</b> - <code>{user['_id']}</code>\n"
 
160
  if user["reason"]:
161
  banfile += f"<b>Reason:</b> {user['reason']}\n"
162
 
 
44
  await m.reply_text(text="This user is part of my Support!, Can't ban our own!")
45
  return
46
 
47
+ if user_id == c.me.id:
48
  await m.reply_text(
49
  text="You don't dare use that command on me again nigga! \n Go straight and fuck your self......"
50
  )
 
99
  await m.reply_text(text="This user is part of my Support!, Can't ban our own!")
100
  return
101
 
102
+ if user_id == c.me.id:
103
  await m.reply_text(
104
  text="""You can't gban me nigga!
105
  Fuck yourself.......!"""
 
156
 
157
  banfile = "Here are all the globally banned geys!\n\n"
158
  for user in banned_users:
159
+ USER = Users.get_user_info(user['_id'])
160
+ banfile += f"[x] <b>{USER['name'] if USER else 'Name NA'}</b> - <code>{user['_id']}</code>\n"
161
  if user["reason"]:
162
  banfile += f"<b>Reason:</b> {user['reason']}\n"
163
 
Powers/plugins/bans.py CHANGED
@@ -35,7 +35,7 @@ async def tban_usr(c: Gojo, m: Message):
35
  if not user_id:
36
  await m.reply_text("Cannot find user to ban")
37
  return
38
- if user_id == Config.BOT_ID:
39
  await m.reply_text("WTF?? Why would I ban myself?")
40
  await m.stop_propagation()
41
 
@@ -171,7 +171,7 @@ async def stban_usr(c: Gojo, m: Message):
171
  if not user_id:
172
  await m.reply_text("Cannot find user to ban")
173
  return
174
- if user_id == Config.BOT_ID:
175
  await m.reply_text("What the heck? Why would I ban myself?")
176
  await m.stop_propagation()
177
 
@@ -265,7 +265,7 @@ async def dtban_usr(c: Gojo, m: Message):
265
  if not user_id:
266
  await m.reply_text("Cannot find user to ban")
267
  return
268
- if user_id == Config.BOT_ID:
269
  await m.reply_text("Huh, why would I ban myself?")
270
  await m.stop_propagation()
271
 
@@ -395,7 +395,7 @@ async def kick_usr(c: Gojo, m: Message):
395
  await m.reply_text("Cannot find user to kick")
396
  return
397
 
398
- if user_id == Config.BOT_ID:
399
  await m.reply_text("Huh, why would I kick myself?")
400
  await m.stop_propagation()
401
 
@@ -486,7 +486,7 @@ async def skick_usr(c: Gojo, m: Message):
486
  await m.reply_text("Cannot find user to kick")
487
  return
488
 
489
- if user_id == Config.BOT_ID:
490
  await m.reply_text("Nuh Hu, why would I kick myself?")
491
  await m.stop_propagation()
492
 
@@ -560,7 +560,7 @@ async def dkick_usr(c: Gojo, m: Message):
560
  await m.reply_text("Cannot find user to kick")
561
  return
562
 
563
- if user_id == Config.BOT_ID:
564
  await m.reply_text("Huh, why would I kick myself?")
565
  await m.stop_propagation()
566
 
@@ -711,7 +711,7 @@ async def sban_usr(c: Gojo, m: Message):
711
  if user_id == m.chat.id:
712
  await m.reply_text("That's an admin!")
713
  await m.stop_propagation()
714
- if user_id == Config.BOT_ID:
715
  await m.reply_text("Huh, why would I ban myself?")
716
  await m.stop_propagation()
717
 
@@ -792,7 +792,7 @@ async def dban_usr(c: Gojo, m: Message):
792
  if user_id == m.chat.id:
793
  await m.reply_text("That's an admin!")
794
  await m.stop_propagation()
795
- if user_id == Config.BOT_ID:
796
  await m.reply_text("Huh, why would I ban myself?")
797
  await m.stop_propagation()
798
 
@@ -893,7 +893,7 @@ async def ban_usr(c: Gojo, m: Message):
893
  if user_id == m.chat.id:
894
  await m.reply_text("That's an admin!")
895
  await m.stop_propagation()
896
- if user_id == Config.BOT_ID:
897
  await m.reply_text("Huh, why would I ban myself?")
898
  await m.stop_propagation()
899
 
 
35
  if not user_id:
36
  await m.reply_text("Cannot find user to ban")
37
  return
38
+ if user_id == c.me.id:
39
  await m.reply_text("WTF?? Why would I ban myself?")
40
  await m.stop_propagation()
41
 
 
171
  if not user_id:
172
  await m.reply_text("Cannot find user to ban")
173
  return
174
+ if user_id == c.me.id:
175
  await m.reply_text("What the heck? Why would I ban myself?")
176
  await m.stop_propagation()
177
 
 
265
  if not user_id:
266
  await m.reply_text("Cannot find user to ban")
267
  return
268
+ if user_id == c.me.id:
269
  await m.reply_text("Huh, why would I ban myself?")
270
  await m.stop_propagation()
271
 
 
395
  await m.reply_text("Cannot find user to kick")
396
  return
397
 
398
+ if user_id == c.me.id:
399
  await m.reply_text("Huh, why would I kick myself?")
400
  await m.stop_propagation()
401
 
 
486
  await m.reply_text("Cannot find user to kick")
487
  return
488
 
489
+ if user_id == c.me.id:
490
  await m.reply_text("Nuh Hu, why would I kick myself?")
491
  await m.stop_propagation()
492
 
 
560
  await m.reply_text("Cannot find user to kick")
561
  return
562
 
563
+ if user_id == c.me.id:
564
  await m.reply_text("Huh, why would I kick myself?")
565
  await m.stop_propagation()
566
 
 
711
  if user_id == m.chat.id:
712
  await m.reply_text("That's an admin!")
713
  await m.stop_propagation()
714
+ if user_id == c.me.id:
715
  await m.reply_text("Huh, why would I ban myself?")
716
  await m.stop_propagation()
717
 
 
792
  if user_id == m.chat.id:
793
  await m.reply_text("That's an admin!")
794
  await m.stop_propagation()
795
+ if user_id == c.me.id:
796
  await m.reply_text("Huh, why would I ban myself?")
797
  await m.stop_propagation()
798
 
 
893
  if user_id == m.chat.id:
894
  await m.reply_text("That's an admin!")
895
  await m.stop_propagation()
896
+ if user_id == c.me.id:
897
  await m.reply_text("Huh, why would I ban myself?")
898
  await m.stop_propagation()
899
 
Powers/plugins/clean_db.py CHANGED
@@ -1,12 +1,10 @@
1
  import time
2
- from asyncio import sleep
3
  from traceback import format_exc
4
 
5
- from apscheduler.schedulers.asyncio import AsyncIOScheduler
6
  from pyrogram.enums import ChatMemberStatus as CMS
7
- from pyrogram.errors import PeerIdInvalid, UserNotParticipant
8
 
9
- from Powers import LOGGER, MESSAGE_DUMP, TIME_ZONE
10
  from Powers.bot_class import Gojo
11
  from Powers.database.approve_db import Approve
12
  from Powers.database.blacklist_db import Blacklist
@@ -20,18 +18,17 @@ 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:Gojo,is_cmd=False, id=None):
28
  to_clean = list()
29
  chats_list = Chats.list_chats_by_id()
30
  to_clean.clear()
31
  start = time.time()
32
  for chats in chats_list:
33
  try:
34
- stat = await c.get_chat_member(chat_id=chats,user_id=Config.BOT_ID)
35
  if stat.status not in [CMS.MEMBER, CMS.ADMINISTRATOR, CMS.OWNER]:
36
  to_clean.append(chats)
37
  except UserNotParticipant:
@@ -64,12 +61,9 @@ async def clean_my_db(c:Gojo,is_cmd=False, id=None):
64
  if is_cmd:
65
  txt += f"\nClean type: Forced\nInitiated by: {(await c.get_users(user_ids=id)).mention}"
66
  txt += f"\nClean type: Manual\n\tTook {round(nums,2)} seconds to complete the process"
67
- await c.send_message(chat_id=MESSAGE_DUMP,text=txt)
68
  return txt
69
  else:
70
  txt += f"\nClean type: Auto\n\tTook {round(nums,2)} seconds to complete the process"
71
- await c.send_message(chat_id=MESSAGE_DUMP,text=txt)
72
  return txt
73
-
74
-
75
-
 
1
  import time
 
2
  from traceback import format_exc
3
 
 
4
  from pyrogram.enums import ChatMemberStatus as CMS
5
+ from pyrogram.errors import UserNotParticipant
6
 
7
+ from Powers import LOGGER, MESSAGE_DUMP
8
  from Powers.bot_class import Gojo
9
  from Powers.database.approve_db import Approve
10
  from Powers.database.blacklist_db import Blacklist
 
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):
25
  to_clean = list()
26
  chats_list = Chats.list_chats_by_id()
27
  to_clean.clear()
28
  start = time.time()
29
  for chats in chats_list:
30
  try:
31
+ stat = await c.get_chat_member(chat_id=chats, user_id=c.me.id)
32
  if stat.status not in [CMS.MEMBER, CMS.ADMINISTRATOR, CMS.OWNER]:
33
  to_clean.append(chats)
34
  except UserNotParticipant:
 
61
  if is_cmd:
62
  txt += f"\nClean type: Forced\nInitiated by: {(await c.get_users(user_ids=id)).mention}"
63
  txt += f"\nClean type: Manual\n\tTook {round(nums,2)} seconds to complete the process"
64
+ await c.send_message(chat_id=MESSAGE_DUMP, text=txt)
65
  return txt
66
  else:
67
  txt += f"\nClean type: Auto\n\tTook {round(nums,2)} seconds to complete the process"
68
+ await c.send_message(chat_id=MESSAGE_DUMP, text=txt)
69
  return txt
 
 
 
Powers/plugins/dev.py CHANGED
@@ -1,6 +1,7 @@
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
@@ -209,6 +210,52 @@ async def ping(_, m: Message):
209
  await replymsg.edit_text(f"<b>Pong!</b>\n{delta_ping * 1000:.3f} ms")
210
  return
211
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
212
 
213
  @Gojo.on_message(command("logs", dev_cmd=True))
214
  async def send_log(c: Gojo, m: Message):
 
1
  import subprocess as subp
2
  import sys
3
  from asyncio import create_subprocess_shell, sleep, subprocess
4
+ from importlib.metadata import PackageNotFoundError, metadata
5
  from io import BytesIO, StringIO
6
  from os import execvp
7
  from sys import executable
 
210
  await replymsg.edit_text(f"<b>Pong!</b>\n{delta_ping * 1000:.3f} ms")
211
  return
212
 
213
+ """
214
+
215
+ ['Metadata-Version', 'Name', 'Version', 'Summary', 'Home-page', 'Author', 'Author-email', 'License', 'Download-URL', 'Project-URL', 'Project-URL', 'Project-URL', 'Project-URL', 'Keywords', 'Platform', 'Classifier', 'Classifier', 'Classifier', 'Classifier', 'Classifier', 'Classifier', 'Classifier', 'Classifier', 'Classifier', 'Classifier', 'Classifier', 'Classifier', 'Classifier', 'Classifier', 'Classifier', 'Classifier', 'Classifier', 'Classifier', 'Classifier', 'Classifier', 'Classifier', 'Requires-Python', 'Description-Content-Type', 'License-File', 'License-File', 'License-File', 'Requires-Dist', 'Requires-Dist', 'Description']
216
+
217
+ """
218
+
219
+ @Gojo.on_message(command(["minfo", "moduleinfo"], dev_cmd=True))
220
+ async def check_module_info(_, m: Message):
221
+ if len(m.command) != 2:
222
+ await m.reply_text("**USAGE**\n/minfo [module name]")
223
+ return
224
+
225
+ module = m.command[-1]
226
+
227
+ try:
228
+ minfo = metadata(module)
229
+ except PackageNotFoundError:
230
+ await m.reply_text(f"No module found with name {module}")
231
+ return
232
+
233
+ name = minfo["Name"]
234
+ version = minfo["Version"]
235
+ summary = minfo["Summary"]
236
+ home_page = minfo["Home-Page"]
237
+ author = minfo["Author"]
238
+ license = minfo["License"]
239
+ download = minfo["Download-URL"]
240
+
241
+ txt = f"""
242
+ Here are the info about the module **{name}**
243
+ • Version: {version}
244
+
245
+ • Summary: {summary}
246
+
247
+ • Home page: {home_page}
248
+
249
+ • Author: {author}
250
+
251
+ • License: {license}
252
+
253
+ • Download: {download}
254
+ """
255
+ await m.reply_text(txt, disable_web_page_preview=True)
256
+ return
257
+
258
+
259
 
260
  @Gojo.on_message(command("logs", dev_cmd=True))
261
  async def send_log(c: Gojo, m: Message):
Powers/plugins/filters.py CHANGED
@@ -110,7 +110,7 @@ async def add_filter(_, m: Message):
110
  async def stop_filter(_, m: Message):
111
  args = m.command
112
 
113
- if len(args) < 1:
114
  return await m.reply_text("What should I stop replying to?")
115
 
116
  chat_filters = db.get_all_filters(m.chat.id)
@@ -283,7 +283,6 @@ async def filters_watcher(c: Gojo, m: Message):
283
  if match:
284
  try:
285
  msgtype = await send_filter_reply(c, m, trigger)
286
- LOGGER.info(f"Replied with {msgtype} to {trigger} in {m.chat.id}")
287
  except Exception as ef:
288
  await m.reply_text(f"Error: {ef}")
289
  LOGGER.error(ef)
 
110
  async def stop_filter(_, m: Message):
111
  args = m.command
112
 
113
+ if len(args) <= 1:
114
  return await m.reply_text("What should I stop replying to?")
115
 
116
  chat_filters = db.get_all_filters(m.chat.id)
 
283
  if match:
284
  try:
285
  msgtype = await send_filter_reply(c, m, trigger)
 
286
  except Exception as ef:
287
  await m.reply_text(f"Error: {ef}")
288
  LOGGER.error(ef)
Powers/plugins/flood.py CHANGED
@@ -152,7 +152,7 @@ limit_kb = InlineKeyboardMarkup(
152
  @Gojo.on_message(command(['floodaction','actionflood']) & admin_filter)
153
  async def flood_action(c: Gojo, m: Message):
154
  Flood = Floods()
155
- bot = await c.get_chat_member(m.chat.id, Config.BOT_ID)
156
  status = bot.status
157
  if not status in [CMS.OWNER, CMS.ADMINISTRATOR]:
158
  if not bot.privileges.can_restrict_members:
@@ -189,7 +189,7 @@ async def flood_on_off(c: Gojo, m: Message):
189
 
190
  @Gojo.on_message(command(['setflood']) & ~filters.bot & admin_filter)
191
  async def flood_set(c: Gojo, m: Message):
192
- bot = await c.get_chat_member(m.chat.id, Config.BOT_ID)
193
  Flood = Floods()
194
  status = bot.status
195
  if not status in [CMS.OWNER, CMS.ADMINISTRATOR]:
 
152
  @Gojo.on_message(command(['floodaction','actionflood']) & admin_filter)
153
  async def flood_action(c: Gojo, m: Message):
154
  Flood = Floods()
155
+ bot = await c.get_chat_member(m.chat.id, c.me.id)
156
  status = bot.status
157
  if not status in [CMS.OWNER, CMS.ADMINISTRATOR]:
158
  if not bot.privileges.can_restrict_members:
 
189
 
190
  @Gojo.on_message(command(['setflood']) & ~filters.bot & admin_filter)
191
  async def flood_set(c: Gojo, m: Message):
192
+ bot = await c.get_chat_member(m.chat.id, c.me.id)
193
  Flood = Floods()
194
  status = bot.status
195
  if not status in [CMS.OWNER, CMS.ADMINISTRATOR]:
Powers/plugins/greetings.py CHANGED
@@ -4,7 +4,7 @@ from traceback import format_exc
4
 
5
  from pyrogram import emoji, enums, filters
6
  from pyrogram.enums import ChatMemberStatus as CMS
7
- from pyrogram.errors import ChatAdminRequired, RPCError
8
  from pyrogram.types import ChatMemberUpdated, Message
9
 
10
  from Powers import LOGGER
@@ -257,7 +257,7 @@ async def member_has_joined(c: Gojo, member: ChatMemberUpdated):
257
  db = Greetings(member.chat.id)
258
  banned_users = gdb.check_gban(user.id)
259
  try:
260
- if user.id == Config.BOT_ID:
261
  return
262
  if user.id in DEV_USERS:
263
  await c.send_animation(
@@ -332,6 +332,8 @@ async def member_has_joined(c: Gojo, member: ChatMemberUpdated):
332
 
333
  if jj:
334
  db.set_cleanwlcm_id(int(jj.id))
 
 
335
  except RPCError as e:
336
  LOGGER.error(e)
337
  LOGGER.error(format_exc(e))
 
4
 
5
  from pyrogram import emoji, enums, filters
6
  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
 
257
  db = Greetings(member.chat.id)
258
  banned_users = gdb.check_gban(user.id)
259
  try:
260
+ if user.id == c.me.id:
261
  return
262
  if user.id in DEV_USERS:
263
  await c.send_animation(
 
332
 
333
  if jj:
334
  db.set_cleanwlcm_id(int(jj.id))
335
+ except ChannelPrivate:
336
+ return
337
  except RPCError as e:
338
  LOGGER.error(e)
339
  LOGGER.error(format_exc(e))
Powers/plugins/info.py CHANGED
@@ -96,17 +96,17 @@ async def user_info(c: Gojo, user, already=False):
96
  is_restricted = user.is_restricted
97
  photo_id = user.photo.big_file_id if user.photo else None
98
  is_support = True if user_id in SUPPORT_STAFF else False
99
- if user_id == Config.BOT_ID:
100
  is_support = "A person is a great support to himself"
101
  omp = "Hmmm.......Who is that again?"
102
- if is_support or Config.BOT_ID:
103
  if user_id in DEV_USERS:
104
  omp = "Dev"
105
  elif user_id in SUDO_USERS:
106
  omp = "Sudoer"
107
  elif user_id in WHITELIST_USERS:
108
  omp = "Whitelist"
109
- elif user_id == Config.BOT_ID:
110
  omp = "I am the targeted user"
111
  elif user_id == OWNER_ID:
112
  omp = "Owner of the bot"
 
96
  is_restricted = user.is_restricted
97
  photo_id = user.photo.big_file_id if user.photo else None
98
  is_support = True if user_id in SUPPORT_STAFF else False
99
+ if user_id == c.me.id:
100
  is_support = "A person is a great support to himself"
101
  omp = "Hmmm.......Who is that again?"
102
+ if is_support or c.me.id:
103
  if user_id in DEV_USERS:
104
  omp = "Dev"
105
  elif user_id in SUDO_USERS:
106
  omp = "Sudoer"
107
  elif user_id in WHITELIST_USERS:
108
  omp = "Whitelist"
109
+ elif user_id == c.me.id:
110
  omp = "I am the targeted user"
111
  elif user_id == OWNER_ID:
112
  omp = "Owner of the bot"
Powers/plugins/locks.py CHANGED
@@ -473,19 +473,19 @@ async def is_approved_user(c: Gojo, m: Message):
473
  SUDO_LEVEL = get_support_staff("sudo_level")
474
 
475
  if m.forward_from:
476
- 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 == Config.BOT_ID:
477
  return True
478
  return False
479
  elif m.forward_from_chat:
480
  x_chat = (await c.get_chat(m.forward_from_chat.id)).linked_chat
481
- 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 == Config.BOT_ID:
482
  return True
483
- if not x_chat:
484
- return False
485
  elif x_chat and x_chat.id == m.chat.id:
486
  return True
 
 
487
  elif m.from_user:
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 == Config.BOT_ID:
489
  return True
490
  return False
491
 
 
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):
477
  return True
478
  return False
479
  elif m.forward_from_chat:
480
  x_chat = (await c.get_chat(m.forward_from_chat.id)).linked_chat
481
+ 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):
482
  return True
 
 
483
  elif x_chat and x_chat.id == m.chat.id:
484
  return True
485
+ else:
486
+ return False
487
  elif m.from_user:
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
 
Powers/plugins/muting.py CHANGED
@@ -35,7 +35,7 @@ async def tmute_usr(c: Gojo, m: Message):
35
  if not user_id:
36
  await m.reply_text("Cannot find user to mute !")
37
  return
38
- if user_id == Config.BOT_ID:
39
  await m.reply_text("Huh, why would I mute myself?")
40
  return
41
 
@@ -149,7 +149,7 @@ async def dtmute_usr(c: Gojo, m: Message):
149
  if not user_id:
150
  await m.reply_text("Cannot find user to mute !")
151
  return
152
- if user_id == Config.BOT_ID:
153
  await m.reply_text("Huh, why would I mute myself?")
154
  return
155
 
@@ -258,7 +258,7 @@ async def stmute_usr(c: Gojo, m: Message):
258
  if not user_id:
259
  await m.reply_text("Cannot find user to mute !")
260
  return
261
- if user_id == Config.BOT_ID:
262
  await m.reply_text("Huh, why would I mute myself?")
263
  return
264
 
@@ -352,7 +352,7 @@ async def mute_usr(c: Gojo, m: Message):
352
  if not user_id:
353
  await m.reply_text("Cannot find user to mute")
354
  return
355
- if user_id == Config.BOT_ID:
356
  await m.reply_text("Huh, why would I mute myself?")
357
  return
358
 
@@ -438,7 +438,7 @@ async def smute_usr(c: Gojo, m: Message):
438
  if not user_id:
439
  await m.reply_text("Cannot find user to mute")
440
  return
441
- if user_id == Config.BOT_ID:
442
  await m.reply_text("Huh, why would I mute myself?")
443
  return
444
 
@@ -511,7 +511,7 @@ async def dmute_usr(c: Gojo, m: Message):
511
  if not user_id:
512
  await m.reply_text("Cannot find user to mute")
513
  return
514
- if user_id == Config.BOT_ID:
515
  await m.reply_text("Huh, why would I mute myself?")
516
  return
517
 
@@ -595,7 +595,7 @@ async def unmute_usr(c: Gojo, m: Message):
595
  except Exception:
596
  return
597
 
598
- if user_id == Config.BOT_ID:
599
  await m.reply_text("Huh, why would I unmute myself if you are using me?")
600
  return
601
  try:
 
35
  if not user_id:
36
  await m.reply_text("Cannot find user to mute !")
37
  return
38
+ if user_id == c.me.id:
39
  await m.reply_text("Huh, why would I mute myself?")
40
  return
41
 
 
149
  if not user_id:
150
  await m.reply_text("Cannot find user to mute !")
151
  return
152
+ if user_id == c.me.id:
153
  await m.reply_text("Huh, why would I mute myself?")
154
  return
155
 
 
258
  if not user_id:
259
  await m.reply_text("Cannot find user to mute !")
260
  return
261
+ if user_id == c.me.id:
262
  await m.reply_text("Huh, why would I mute myself?")
263
  return
264
 
 
352
  if not user_id:
353
  await m.reply_text("Cannot find user to mute")
354
  return
355
+ if user_id == c.me.id:
356
  await m.reply_text("Huh, why would I mute myself?")
357
  return
358
 
 
438
  if not user_id:
439
  await m.reply_text("Cannot find user to mute")
440
  return
441
+ if user_id == c.me.id:
442
  await m.reply_text("Huh, why would I mute myself?")
443
  return
444
 
 
511
  if not user_id:
512
  await m.reply_text("Cannot find user to mute")
513
  return
514
+ if user_id == c.me.id:
515
  await m.reply_text("Huh, why would I mute myself?")
516
  return
517
 
 
595
  except Exception:
596
  return
597
 
598
+ if user_id == c.me.id:
599
  await m.reply_text("Huh, why would I unmute myself if you are using me?")
600
  return
601
  try:
Powers/plugins/notes.py CHANGED
@@ -84,7 +84,7 @@ async def get_note_func(c: Gojo, m: Message, note_name, priv_notes_status):
84
  [
85
  (
86
  "Click Me!",
87
- f"https://t.me/{Config.BOT_USERNAME}?start=note_{m.chat.id}_{note_hash}",
88
  "url",
89
  ),
90
  ],
@@ -323,7 +323,7 @@ async def priv_notes(_, m: Message):
323
 
324
 
325
  @Gojo.on_message(command("notes") & filters.group & ~filters.bot)
326
- async def local_notes(_, 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
 
@@ -341,7 +341,7 @@ async def local_notes(_, m: Message):
341
  [
342
  (
343
  "All Notes",
344
- f"https://t.me/{Config.BOT_USERNAME}?start=notes_{m.chat.id}",
345
  "url",
346
  ),
347
  ],
 
84
  [
85
  (
86
  "Click Me!",
87
+ f"https://t.me/{c.me.username}?start=note_{m.chat.id}_{note_hash}",
88
  "url",
89
  ),
90
  ],
 
323
 
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
 
 
341
  [
342
  (
343
  "All Notes",
344
+ f"https://t.me/{c.me.username}?start=notes_{m.chat.id}",
345
  "url",
346
  ),
347
  ],
Powers/plugins/rules.py CHANGED
@@ -11,7 +11,7 @@ from Powers.vars import Config
11
 
12
 
13
  @Gojo.on_message(command("rules") & filters.group)
14
- async def get_rules(_, m: Message):
15
  db = Rules(m.chat.id)
16
  msg_id = m.reply_to_message.id if m.reply_to_message else m.id
17
 
@@ -35,7 +35,7 @@ async def get_rules(_, m: Message):
35
  [
36
  (
37
  "Rules",
38
- f"https://t.me/{Config.BOT_USERNAME}?start=rules_{m.chat.id}",
39
  "url",
40
  ),
41
  ],
 
11
 
12
 
13
  @Gojo.on_message(command("rules") & filters.group)
14
+ async def get_rules(c: Gojo, m: Message):
15
  db = Rules(m.chat.id)
16
  msg_id = m.reply_to_message.id if m.reply_to_message else m.id
17
 
 
35
  [
36
  (
37
  "Rules",
38
+ f"https://t.me/{c.me.username}?start=rules_{m.chat.id}",
39
  "url",
40
  ),
41
  ],
Powers/plugins/scheduled_jobs.py CHANGED
@@ -31,7 +31,7 @@ async def clean_my_db(c:Client,is_cmd=False, id=None):
31
  start = TIME.time()
32
  for chats in chats_list:
33
  try:
34
- stat = await c.get_chat_member(chat_id=chats,user_id=Config.BOT_ID)
35
  if stat.status not in [CMS.MEMBER, CMS.ADMINISTRATOR, CMS.OWNER]:
36
  to_clean.append(chats)
37
  except UserNotParticipant:
 
31
  start = TIME.time()
32
  for chats in chats_list:
33
  try:
34
+ stat = await c.get_chat_member(chat_id=chats,user_id=c.me.id)
35
  if stat.status not in [CMS.MEMBER, CMS.ADMINISTRATOR, CMS.OWNER]:
36
  to_clean.append(chats)
37
  except UserNotParticipant:
Powers/plugins/start.py CHANGED
@@ -150,7 +150,7 @@ Join my [News Channel](https://t.me/gojo_bots_network) to get information on all
150
  [
151
  InlineKeyboardButton(
152
  "Connect me to pm",
153
- url=f"https://{Config.BOT_USERNAME}.t.me/",
154
  ),
155
  ],
156
  ],
@@ -253,7 +253,7 @@ async def help_menu(c: Gojo, m: Message):
253
  [
254
  InlineKeyboardButton(
255
  "Help",
256
- url=f"t.me/{Config.BOT_USERNAME}?start={help_option}",
257
  ),
258
  ],
259
  ],
@@ -276,7 +276,7 @@ Commands available:
276
  [
277
  InlineKeyboardButton(
278
  "Help",
279
- url=f"t.me/{Config.BOT_USERNAME}?start=start_help",
280
  ),
281
  ],
282
  ],
 
150
  [
151
  InlineKeyboardButton(
152
  "Connect me to pm",
153
+ url=f"https://{c.me.username}.t.me/",
154
  ),
155
  ],
156
  ],
 
253
  [
254
  InlineKeyboardButton(
255
  "Help",
256
+ url=f"t.me/{c.me.username}?start={help_option}",
257
  ),
258
  ],
259
  ],
 
276
  [
277
  InlineKeyboardButton(
278
  "Help",
279
+ url=f"t.me/{c.me.username}?start=start_help",
280
  ),
281
  ],
282
  ],
Powers/plugins/stickers.py CHANGED
@@ -3,10 +3,12 @@ from asyncio import gather
3
  from random import choice
4
  from traceback import format_exc
5
 
 
6
  from pyrogram.errors import (PeerIdInvalid, ShortnameOccupyFailed,
7
  StickerEmojiInvalid, StickerPngDimensions,
8
  StickerPngNopng, StickerTgsNotgs,
9
  StickerVideoNowebm, UserIsBlocked)
 
10
  from pyrogram.types import InlineKeyboardButton as IKB
11
  from pyrogram.types import InlineKeyboardMarkup as IKM
12
  from pyrogram.types import Message
@@ -15,8 +17,8 @@ from Powers import LOGGER
15
  from Powers.bot_class import Gojo
16
  from Powers.utils.custom_filters import command
17
  from Powers.utils.sticker_help import *
 
18
  from Powers.utils.web_helpers import get_file_size
19
- from Powers.vars import Config
20
 
21
 
22
  @Gojo.on_message(command(["stickerinfo","stinfo"]))
@@ -171,22 +173,25 @@ async def kang(c:Gojo, m: Message):
171
 
172
  try:
173
  while not packname_found:
174
- packname = f"CE{str(m.from_user.id)}{st_type}{packnum}_by_{Config.BOT_USERNAME}"
175
- 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 @{Config.BOT_USERNAME}"
176
  if limit >= 50: # To prevent this loop from running forever
177
  await m.reply_text("Failed to kang\nMay be you have made more than 50 sticker packs with me try deleting some")
178
  return
179
  sticker_set = await get_sticker_set_by_name(c,packname)
180
  if not sticker_set:
181
- sticker_set = await create_sticker_set(
182
- client=c,
183
- owner=m.from_user.id,
184
- title=kangpack,
185
- short_name=packname,
186
- stickers=[sticker],
187
- animated=is_anim,
188
- video=is_vid
189
- )
 
 
 
190
  elif sticker_set.set.count >= kang_lim:
191
  packnum += 1
192
  limit += 1
@@ -213,7 +218,7 @@ async def kang(c:Gojo, m: Message):
213
  )
214
  except (PeerIdInvalid, UserIsBlocked):
215
  keyboard = IKM(
216
- [[IKB("Start me first", url=f"t.me/{Config.BOT_USERNAME}")]]
217
  )
218
  await msg.delete()
219
  await m.reply_text(
@@ -316,7 +321,7 @@ async def memify_it(c: Gojo, m: Message):
316
 
317
  @Gojo.on_message(command(["getsticker","getst"]))
318
  async def get_sticker_from_file(c: Gojo, m: Message):
319
- Caption = f"Converted by:\n@{Config.BOT_USERNAME}"
320
  repl = m.reply_to_message
321
  if not repl:
322
  await m.reply_text("Reply to a sticker or file")
@@ -365,6 +370,62 @@ async def get_sticker_from_file(c: Gojo, m: Message):
365
  os.remove(up)
366
  return
367
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
368
 
369
  __PLUGIN__ = "sticker"
370
  __alt_name__ = [
@@ -377,6 +438,7 @@ __HELP__ = """
377
  • /stickerinfo (/stinfo) : Reply to any sticker to get it's info
378
  • /getsticker (/getst) : Get sticker as photo, gif or vice versa.
379
  • /stickerid (/stid) : Reply to any sticker to get it's id
 
380
  • /mmf <your text>: Reply to a normal sticker or a photo or video file to memify it. If you want to right text at bottom use `;right your message`
381
  ■ For e.g.
382
  ○ /mmf Hello freinds : this will add text to the top
 
3
  from random import choice
4
  from traceback import format_exc
5
 
6
+ from pyrogram import filters
7
  from pyrogram.errors import (PeerIdInvalid, ShortnameOccupyFailed,
8
  StickerEmojiInvalid, StickerPngDimensions,
9
  StickerPngNopng, StickerTgsNotgs,
10
  StickerVideoNowebm, UserIsBlocked)
11
+ from pyrogram.types import CallbackQuery
12
  from pyrogram.types import InlineKeyboardButton as IKB
13
  from pyrogram.types import InlineKeyboardMarkup as IKM
14
  from pyrogram.types import Message
 
17
  from Powers.bot_class import Gojo
18
  from Powers.utils.custom_filters import command
19
  from Powers.utils.sticker_help import *
20
+ from Powers.utils.string import encode_decode
21
  from Powers.utils.web_helpers import get_file_size
 
22
 
23
 
24
  @Gojo.on_message(command(["stickerinfo","stinfo"]))
 
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
181
  sticker_set = await get_sticker_set_by_name(c,packname)
182
  if not sticker_set:
183
+ try:
184
+ sticker_set = await create_sticker_set(
185
+ client=c,
186
+ owner=m.from_user.id,
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")
195
  elif sticker_set.set.count >= kang_lim:
196
  packnum += 1
197
  limit += 1
 
218
  )
219
  except (PeerIdInvalid, UserIsBlocked):
220
  keyboard = IKM(
221
+ [[IKB("Start me first", url=f"t.me/{c.me.username}")]]
222
  )
223
  await msg.delete()
224
  await m.reply_text(
 
321
 
322
  @Gojo.on_message(command(["getsticker","getst"]))
323
  async def get_sticker_from_file(c: Gojo, m: Message):
324
+ Caption = f"Converted by:\n@{c.me.username}"
325
  repl = m.reply_to_message
326
  if not repl:
327
  await m.reply_text("Reply to a sticker or file")
 
370
  os.remove(up)
371
  return
372
 
373
+ @Gojo.on_message(command(["rmsticker", "rmst", "removesticker"]))
374
+ async def remove_from_MY_pack(c: Gojo, m: Message):
375
+ if not m.reply_to_message or not m.reply_to_message.sticker:
376
+ await m.reply_text("Please reply to a sticker to remove it from your pack")
377
+ return
378
+
379
+ sticker = m.reply_to_message.sticker
380
+ sticker_set = await get_sticker_set_by_name(c, sticker.set_name)
381
+
382
+ if not sticker_set:
383
+ await m.reply_text("This sticker is not part of your pack")
384
+ return
385
+
386
+ try:
387
+ await remove_sticker(c, sticker.file_id)
388
+ await m.reply_text(f"Deleted [this]({m.reply_to_message.link}) from pack: {sticker_set.et.title}")
389
+ return
390
+ except Exception as e:
391
+ await m.reply_text(f"Error\n{e}\nReport it using /bug")
392
+ LOGGER.error(e)
393
+ LOGGER.error(format_exc(e))
394
+ return
395
+
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:
405
+ await m.reply_text("Looks like you haven't made any sticker using me...")
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])
416
+
417
+ if q.from_user.id != user:
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
 
430
  __PLUGIN__ = "sticker"
431
  __alt_name__ = [
 
438
  • /stickerinfo (/stinfo) : Reply to any sticker to get it's info
439
  • /getsticker (/getst) : Get sticker as photo, gif or vice versa.
440
  • /stickerid (/stid) : Reply to any sticker to get it's id
441
+ • /mypacks : Get all of your current sticker pack you have made via me.
442
  • /mmf <your text>: Reply to a normal sticker or a photo or video file to memify it. If you want to right text at bottom use `;right your message`
443
  ■ For e.g.
444
  ○ /mmf Hello freinds : this will add text to the top
Powers/plugins/warns.py CHANGED
@@ -44,7 +44,7 @@ async def warn(c: Gojo, m: Message):
44
 
45
  user_id, user_first_name, _ = await extract_user(c, m)
46
 
47
- if user_id == Config.BOT_ID:
48
  await m.reply_text("Huh, why would I warn myself?")
49
  return
50
 
@@ -102,7 +102,7 @@ async def warn(c: Gojo, m: Message):
102
  if rules:
103
  kb = InlineKeyboardButton(
104
  "Rules 📋",
105
- url=f"https://t.me/{Config.BOT_USERNAME}?start=rules_{m.chat.id}",
106
  )
107
  else:
108
  kb = InlineKeyboardButton(
@@ -147,7 +147,7 @@ async def reset_warn(c: Gojo, m: Message):
147
 
148
  user_id, user_first_name, _ = await extract_user(c, m)
149
 
150
- if user_id == Config.BOT_ID:
151
  await m.reply_text("Huh, why would I warn myself?")
152
  return
153
 
@@ -183,7 +183,7 @@ async def list_warns(c: Gojo, m: Message):
183
 
184
  user_id, user_first_name, _ = await extract_user(c, m)
185
 
186
- if user_id == Config.BOT_ID:
187
  await m.reply_text("Huh, why would I warn myself?")
188
  return
189
 
@@ -232,7 +232,7 @@ async def remove_warn(c: Gojo, m: Message):
232
 
233
  user_id, user_first_name, _ = await extract_user(c, m)
234
 
235
- if user_id == Config.BOT_ID:
236
  await m.reply_text("Huh, why would I warn myself?")
237
  return
238
 
 
44
 
45
  user_id, user_first_name, _ = await extract_user(c, m)
46
 
47
+ if user_id == c.me.id:
48
  await m.reply_text("Huh, why would I warn myself?")
49
  return
50
 
 
102
  if rules:
103
  kb = InlineKeyboardButton(
104
  "Rules 📋",
105
+ url=f"https://t.me/{c.me.username}?start=rules_{m.chat.id}",
106
  )
107
  else:
108
  kb = InlineKeyboardButton(
 
147
 
148
  user_id, user_first_name, _ = await extract_user(c, m)
149
 
150
+ if user_id == c.me.id:
151
  await m.reply_text("Huh, why would I warn myself?")
152
  return
153
 
 
183
 
184
  user_id, user_first_name, _ = await extract_user(c, m)
185
 
186
+ if user_id == c.me.id:
187
  await m.reply_text("Huh, why would I warn myself?")
188
  return
189
 
 
232
 
233
  user_id, user_first_name, _ = await extract_user(c, m)
234
 
235
+ if user_id == c.me.id:
236
  await m.reply_text("Huh, why would I warn myself?")
237
  return
238
 
Powers/plugins/web_con.py CHANGED
@@ -257,8 +257,7 @@ async def song_down_up(c: Gojo, m: Message):
257
  return
258
  _id = get_video_id(splited)
259
  if not _id:
260
- await m.reply_text("Invalid youtube link")
261
- return
262
  else:
263
  query = _id
264
  XnX = await m.reply_text("⏳")
@@ -284,8 +283,7 @@ async def video_down_up(c: Gojo, m: Message):
284
  return
285
  _id = get_video_id(splited)
286
  if not _id:
287
- await m.reply_text("Invalid youtube link")
288
- return
289
  else:
290
  query = _id
291
  XnX = await m.reply_text("⏳")
 
257
  return
258
  _id = get_video_id(splited)
259
  if not _id:
260
+ query = splited
 
261
  else:
262
  query = _id
263
  XnX = await m.reply_text("⏳")
 
283
  return
284
  _id = get_video_id(splited)
285
  if not _id:
286
+ query = splited
 
287
  else:
288
  query = _id
289
  XnX = await m.reply_text("⏳")
Powers/utils/custom_filters.py CHANGED
@@ -9,14 +9,14 @@ from pyrogram.errors import RPCError, UserNotParticipant
9
  from pyrogram.filters import create
10
  from pyrogram.types import CallbackQuery, ChatJoinRequest, Message
11
 
12
- from Powers import DEV_USERS, OWNER_ID, SUDO_USERS
 
13
  from Powers.database.afk_db import AFK
14
  from Powers.database.approve_db import Approve
15
  from Powers.database.autojoin_db import AUTOJOIN
16
  from Powers.database.disable_db import Disabling
17
  from Powers.database.flood_db import Floods
18
  from Powers.utils.caching import ADMIN_CACHE, admin_cache_reload
19
- from Powers.vars import Config
20
 
21
 
22
  def command(
@@ -26,7 +26,7 @@ def command(
26
  dev_cmd: bool = False,
27
  sudo_cmd: bool = False,
28
  ):
29
- async def func(flt, _, m: Message):
30
  if not m:
31
  return
32
 
@@ -62,8 +62,8 @@ def command(
62
  if not text:
63
  return False
64
  regex = r"^[{prefix}](\w+)(@{bot_name})?(?: |$)(.*)".format(
65
- prefix="|".join(escape(x) for x in Config.PREFIX_HANDLER),
66
- bot_name=Config.BOT_USERNAME,
67
  )
68
  matches = compile_re(regex).search(text)
69
  if matches:
@@ -111,7 +111,7 @@ def command(
111
  )
112
 
113
 
114
- async def bot_admin_check_func(_, __, m: Message or CallbackQuery):
115
  """Check if bot is Admin or not."""
116
 
117
  if isinstance(m, CallbackQuery):
@@ -135,7 +135,7 @@ async def bot_admin_check_func(_, __, m: Message or CallbackQuery):
135
  if ("The chat_id" and "belongs to a user") in ef:
136
  return True
137
 
138
- if Config.BOT_ID in admin_group:
139
  return True
140
 
141
  await m.reply_text(
 
9
  from pyrogram.filters import create
10
  from pyrogram.types import CallbackQuery, ChatJoinRequest, Message
11
 
12
+ from Powers import DEV_USERS, OWNER_ID, PREFIX_HANDLER, SUDO_USERS
13
+ from Powers.bot_class import Gojo
14
  from Powers.database.afk_db import AFK
15
  from Powers.database.approve_db import Approve
16
  from Powers.database.autojoin_db import AUTOJOIN
17
  from Powers.database.disable_db import Disabling
18
  from Powers.database.flood_db import Floods
19
  from Powers.utils.caching import ADMIN_CACHE, admin_cache_reload
 
20
 
21
 
22
  def command(
 
26
  dev_cmd: bool = False,
27
  sudo_cmd: bool = False,
28
  ):
29
+ async def func(flt, c: Gojo, m: Message):
30
  if not m:
31
  return
32
 
 
62
  if not text:
63
  return False
64
  regex = r"^[{prefix}](\w+)(@{bot_name})?(?: |$)(.*)".format(
65
+ prefix="|".join(escape(x) for x in PREFIX_HANDLER),
66
+ bot_name=c.me.username,
67
  )
68
  matches = compile_re(regex).search(text)
69
  if matches:
 
111
  )
112
 
113
 
114
+ async def bot_admin_check_func(_, c: Gojo, m: Message or CallbackQuery):
115
  """Check if bot is Admin or not."""
116
 
117
  if isinstance(m, CallbackQuery):
 
135
  if ("The chat_id" and "belongs to a user") in ef:
136
  return True
137
 
138
+ if c.me.id in admin_group:
139
  return True
140
 
141
  await m.reply_text(
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
9
  from Powers.bot_class import Gojo
10
  from Powers.database.chats_db import Chats
11
  from Powers.database.notes_db import Notes
@@ -65,7 +65,7 @@ async def gen_start_kb(q: Message or CallbackQuery):
65
  ),
66
  (
67
  "Owner ❤️",
68
- Config.OWNER_ID,
69
  "user_id",
70
  ),
71
  ],
@@ -77,7 +77,7 @@ async def gen_start_kb(q: Message or CallbackQuery):
77
  ),
78
  (
79
  "Powered by ⚡️",
80
- f"https://{Config.SUPPORT_CHANNEL}.t.me",
81
  "url",
82
  ),
83
  ],
@@ -95,7 +95,7 @@ async def get_private_note(c: Gojo, m: Message, help_option: str):
95
  chat_title = Chats.get_chat_info(chat_id)["chat_name"]
96
  rply = f"Notes in {chat_title}:\n\n"
97
  note_list = [
98
- f"- [{note[0]}](https://t.me/{Config.BOT_USERNAME}?start=note_{chat_id}_{note[1]})"
99
  for note in all_notes
100
  ]
101
  rply = f"Available notes in {chat_title}\n"
 
5
  from pyrogram.errors import RPCError
6
  from pyrogram.types import CallbackQuery, Message
7
 
8
+ from Powers import HELP_COMMANDS, LOGGER, OWNER_ID, SUPPORT_CHANNEL
9
  from Powers.bot_class import Gojo
10
  from Powers.database.chats_db import Chats
11
  from Powers.database.notes_db import Notes
 
65
  ),
66
  (
67
  "Owner ❤️",
68
+ OWNER_ID,
69
  "user_id",
70
  ),
71
  ],
 
77
  ),
78
  (
79
  "Powered by ⚡️",
80
+ f"https://{SUPPORT_CHANNEL}.t.me",
81
  "url",
82
  ),
83
  ],
 
95
  chat_title = Chats.get_chat_info(chat_id)["chat_name"]
96
  rply = f"Notes in {chat_title}:\n\n"
97
  note_list = [
98
+ f"- [{note[0]}](https://t.me/{c.me.username}?start=note_{chat_id}_{note[1]})"
99
  for note in all_notes
100
  ]
101
  rply = f"Available notes in {chat_title}\n"
Powers/utils/sticker_help.py CHANGED
@@ -9,10 +9,89 @@ from typing import List, Tuple
9
  from PIL import Image, ImageDraw, ImageFont
10
  from pyrogram import errors, raw
11
  from pyrogram.file_id import FileId
 
 
12
  from pyrogram.types import Message
13
  from unidecode import unidecode
14
 
15
  from Powers.bot_class import Gojo
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
 
17
 
18
  async def runcmd(cmd: str) -> Tuple[str, str, int, int]:
 
9
  from PIL import Image, ImageDraw, ImageFont
10
  from pyrogram import errors, raw
11
  from pyrogram.file_id import FileId
12
+ from pyrogram.types import InlineKeyboardButton as ikb
13
+ from pyrogram.types import InlineKeyboardMarkup as ikm
14
  from pyrogram.types import Message
15
  from unidecode import unidecode
16
 
17
  from Powers.bot_class import Gojo
18
+ from Powers.utils.string import encode_decode
19
+
20
+
21
+ async def get_all_sticker_packs(c: Gojo, user_id: int, st_type: str, offset: int = 1, limit: int = 25):
22
+ packnum = 25 * (offset - 1)
23
+ if st_type == "norm":
24
+ st_ = "Static"
25
+ elif st_type == "vid":
26
+ st_ = "Video"
27
+ else:
28
+ st_ = "Animated"
29
+ txt = f"Here is your {st_} stickers that I have created:\nPage: {offset}\n"
30
+ while True:
31
+ packname = f"CE{str(user_id)}{st_type}{packnum}_by_{c.me.username}"
32
+ sticker_set = await get_sticker_set_by_name(c,packname)
33
+ if not sticker_set and packnum == 0:
34
+ txt, kb = None, None
35
+ break
36
+ elif sticker_set and packnum <= (packnum + limit - 1):
37
+ base_ = f"t.me/addstickers/{packname}"
38
+ txt += f"`{packnum}`. [{sticker_set.set.name}]({base_})\n"
39
+ packnum += 1
40
+ else:
41
+ page = await encode_decode(f"1_{user_id}")
42
+ if st_type == "norm":
43
+ st_kb = [
44
+ [
45
+ ikb("Video stickers", f"stickers_vid_{page}"),
46
+ ikb("Animated stickers", f"stickers_ani_{page}"),
47
+ ]
48
+ ]
49
+ elif st_type == "vid":
50
+ st_kb = [
51
+ [
52
+ ikb("Static stickers", f"stickers_norm_{page}"),
53
+ ikb("Animated stickers", f"stickers_ani_{page}"),
54
+ ]
55
+ ]
56
+ else:
57
+ st_kb = [
58
+ [
59
+ ikb("Static stickers", f"stickers_norm_{page}"),
60
+ ikb("Video stickers", f"stickers_vid_{page}"),
61
+ ]
62
+ ]
63
+
64
+ b64_next = await encode_decode(f"{offset+1}_{user_id}")
65
+ b64_prev = await encode_decode(f"{offset-1}_{user_id}")
66
+
67
+ if (packnum > (packnum + limit - 1)) and offset >= 2:
68
+ kb = [
69
+ [
70
+ ikb("Previous", f"stickers_{st_type}_{b64_prev}"),
71
+ ikb("Next", f"stickers_{st_type}_{b64_next}")
72
+ ],
73
+ ]
74
+ kb.extend(st_kb)
75
+ elif offset >= 2 and (packnum <= (packnum + limit - 1)):
76
+ kb = [
77
+ [
78
+ ikb("Previous", f"stickers_{st_type}_{b64_prev}")
79
+ ],
80
+ ]
81
+ kb.extend(st_kb)
82
+ elif packnum > (packnum + limit - 1) and offset == 1:
83
+ kb = [
84
+ [
85
+ ikb("Next", f"stickers_{st_type}_{b64_next}")
86
+ ],
87
+ ]
88
+ kb.extend(st_kb)
89
+ else:
90
+ kb = st_kb
91
+ kb = ikm(kb)
92
+ break
93
+
94
+ return txt, kb
95
 
96
 
97
  async def runcmd(cmd: str) -> Tuple[str, str, int, int]:
Powers/utils/web_helpers.py CHANGED
@@ -118,7 +118,7 @@ async def youtube_downloader(c: Gojo, m: Message, query: str, is_direct: bool, t
118
  video = True
119
  song = False
120
  # ydl = yt_dlp.YoutubeDL(opts)
121
- dicti = await song_search(query, is_direct, 1)
122
  if not dicti and type(dicti) != str:
123
  await m.reply_text("File with duration less than or equals to 10 minutes is allowed only")
124
  elif type(dicti) == str:
 
118
  video = True
119
  song = False
120
  # ydl = yt_dlp.YoutubeDL(opts)
121
+ dicti = await song_search(query, 1)
122
  if not dicti and type(dicti) != str:
123
  await m.reply_text("File with duration less than or equals to 10 minutes is allowed only")
124
  elif type(dicti) == str:
Powers/vars.py CHANGED
@@ -52,10 +52,9 @@ class Config:
52
  SUPPORT_CHANNEL = config("SUPPORT_CHANNEL", default="gojo_bots_network")
53
  WORKERS = int(config("WORKERS", default=16))
54
  TIME_ZONE = config("TIME_ZONE", default='Asia/Kolkata')
55
- BOT_USERNAME = ""
56
- BOT_ID = ""
57
- BOT_NAME = ""
58
- owner_username = ""
59
 
60
 
61
  class Development:
 
52
  SUPPORT_CHANNEL = config("SUPPORT_CHANNEL", default="gojo_bots_network")
53
  WORKERS = int(config("WORKERS", default=16))
54
  TIME_ZONE = config("TIME_ZONE", default='Asia/Kolkata')
55
+ BOT_USERNAME = "" # Leave it as it is
56
+ BOT_ID = "" # Leave it as it is
57
+ BOT_NAME = "" # Leave it as it is
 
58
 
59
 
60
  class Development:
requirements.txt CHANGED
@@ -1,41 +1,41 @@
1
- aiofiles==23.2.1; python_full_version >= "3.7"
2
- anyio==4.2.0; python_full_version >= "3.6.2" and python_version >= "3.6"
3
  apscheduler==3.10.4
4
  asyncio==3.4.3
5
- beautifulsoup4==4.12.2; python_full_version >= "3.6"
6
- cachetools==5.2.0; python_version >= "3.7" and python_version < "4.0"
7
  captcha==0.5.0
8
- certifi==2023.7.22; python_version >= "3.7" and python_version < "4"
9
- charset-normalizer==2.1.0; python_version >= "3.7" and python_version < "4" and python_full_version >= "3.6.0"
10
- dnspython==2.2.1; python_version >= "3.6" and python_version < "4.0"
11
  google==3.0.0
12
- gpytranslate==1.5.1; python_version >= "3.6"
13
  lyricsgenius==3.0.1
14
- lxml==4.9.1; python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.5.0"
15
  pillow == 10.1.0
16
  prettyconf==2.2.1
17
- pyaes==1.6.1; python_version >= "3.6" and python_version < "4.0"
18
  pymongo==4.6.1
19
- pyrogram==2.0.106; 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")
22
  pytube==15.0.0
23
  pytz==2023.3
24
- pyyaml==6.0.1; python_version >= "3.6"
25
  qrcode==7.4.2
26
- regex==2023.12.25; python_version >= "3.6"
27
  requests==2.31.0
28
- rfc3986==1.5.0; python_version >= "3.7"
29
  search-engine-parser==0.6.8
30
  selenium==4.18.1
31
- six==1.16.0; python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.3.0"
32
- sniffio==1.3.0; python_full_version >= "3.6.2" and python_version >= "3.7"
33
- soupsieve==2.4; python_version >= "3.6" and python_full_version >= "3.6.0"
34
- tgcrypto==1.2.5; python_version >= "3.6" and python_version < "4.0"
35
  tswift==0.7.0
36
- typing-extensions==4.5.0; python_full_version >= "3.6.2" and python_version >= "3.7" and python_version < "3.8"
37
- ujson==5.8.0; python_version >= "3.7"
38
- urllib3==1.26.18; 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"
39
  uvloop==0.19.0
40
  wikipedia==1.4.0
41
  youtube-search-python==1.6.6
 
1
+ aiofiles==23.2.1
2
+ anyio==4.2.0
3
  apscheduler==3.10.4
4
  asyncio==3.4.3
5
+ beautifulsoup4==4.12.2
6
+ cachetools==5.2.0
7
  captcha==0.5.0
8
+ certifi==2023.7.22
9
+ charset-normalizer==2.1.0
10
+ dnspython==2.2.1
11
  google==3.0.0
12
+ gpytranslate==1.5.1
13
  lyricsgenius==3.0.1
14
+ lxml==4.9.1
15
  pillow == 10.1.0
16
  prettyconf==2.2.1
17
+ pyaes==1.6.1
18
  pymongo==4.6.1
19
+ git+https://github.com/KurimuzonAkuma/pyrogram.git@v2.1.22
20
+ pysocks==1.7.1
21
+ python-dateutil==2.8.2
22
  pytube==15.0.0
23
  pytz==2023.3
24
+ pyyaml==6.0.1
25
  qrcode==7.4.2
26
+ regex==2023.12.25
27
  requests==2.31.0
28
+ rfc3986==1.5.0
29
  search-engine-parser==0.6.8
30
  selenium==4.18.1
31
+ six==1.16.0
32
+ sniffio==1.3.0
33
+ soupsieve==2.4
34
+ tgcrypto==1.2.5
35
  tswift==0.7.0
36
+ typing-extensions==4.5.0
37
+ ujson==5.8.0
38
+ urllib3==1.26.18
39
  uvloop==0.19.0
40
  wikipedia==1.4.0
41
  youtube-search-python==1.6.6