Captain Ezio commited on
Commit
918717e
·
2 Parent(s): d042b81 8fb35a7

Merge pull request #78 from Gojo-Bots/beta

Browse files
Powers/__init__.py CHANGED
@@ -8,6 +8,8 @@ from sys import stdout, version_info
8
  from time import time
9
  from traceback import format_exc
10
 
 
 
11
  LOG_DATETIME = datetime.now().strftime("%d_%m_%Y-%H_%M_%S")
12
  LOGDIR = f"{__name__}/logs"
13
 
@@ -56,7 +58,22 @@ LOGGER.info("------------------------")
56
  LOGGER.info(f"Version: {Config.VERSION}")
57
  LOGGER.info(f"Owner: {str(Config.OWNER_ID)}")
58
  LOGGER.info("Source Code: https://github.com/Gojo-Bots/Gojo_Satoru\n")
 
 
 
 
 
 
 
 
 
 
59
 
 
 
 
 
 
60
  # Account Related
61
  BOT_TOKEN = Config.BOT_TOKEN
62
  API_ID = Config.API_ID
 
8
  from time import time
9
  from traceback import format_exc
10
 
11
+ import lyricsgenius
12
+
13
  LOG_DATETIME = datetime.now().strftime("%d_%m_%Y-%H_%M_%S")
14
  LOGDIR = f"{__name__}/logs"
15
 
 
58
  LOGGER.info(f"Version: {Config.VERSION}")
59
  LOGGER.info(f"Owner: {str(Config.OWNER_ID)}")
60
  LOGGER.info("Source Code: https://github.com/Gojo-Bots/Gojo_Satoru\n")
61
+ 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,
69
+ )
70
+ is_genius_lyrics = True
71
 
72
+ genius_lyrics.verbose = False
73
+ LOGGER.info("Client setup complete")
74
+ elif not Config.GENIUS_API_TOKEN:
75
+ LOGGER.error("Genius api not found lyrics command will not work")
76
+ is_genius_lyrics = False
77
  # Account Related
78
  BOT_TOKEN = Config.BOT_TOKEN
79
  API_ID = Config.API_ID
Powers/database/flood_db.py ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 Floods(MongoDB):
11
+ """Class to store flood limit and action of a chat"""
12
+ db_name = "flood"
13
+
14
+ def __init__(self):
15
+ super().__init__(self.db_name)
16
+
17
+ def save_flood(
18
+ self,
19
+ chat_id: int,
20
+ limit: int,
21
+ within: int,
22
+ action: str,
23
+ ):
24
+ with INSERTION_LOCK:
25
+ curr = self.find_one({"chat_id": chat_id})
26
+ if curr:
27
+ if not(limit == int(curr['limit']) and within == int(curr['within']) and action == str(curr['action'])):
28
+ return self.update(
29
+ {
30
+ "chat_id": chat_id
31
+ },
32
+ {
33
+ "limit": limit,
34
+ "within": within,
35
+ "action": action,
36
+ }
37
+ )
38
+ else:
39
+ return
40
+ else:
41
+ return self.insert_one(
42
+ {
43
+ "chat_id" : chat_id,
44
+ "limit": limit,
45
+ "within": within,
46
+ "action" : action
47
+ },
48
+ )
49
+
50
+ def is_chat(self, chat_id: int):
51
+ with INSERTION_LOCK:
52
+ curr = self.find_one({"chat_id": chat_id})
53
+ if curr:
54
+ action = [str(curr['limit']), str(curr['within']), str(curr['action'])]
55
+ return action
56
+ return False
57
+
58
+ def get_action(self, chat_id: int):
59
+ with INSERTION_LOCK:
60
+ curr = self.find_one({"chat_id": chat_id})
61
+ if curr:
62
+ return curr['action']
63
+ return "Flood haven't set"
64
+
65
+ def rm_flood(self, chat_id: int):
66
+ with INSERTION_LOCK:
67
+ curr = self.find_one({"chat_id": chat_id})
68
+ if curr:
69
+ self.delete_one(curr)
70
+ return True
71
+ return False
72
+
Powers/plugins/bans.py CHANGED
@@ -102,7 +102,7 @@ async def tban_usr(c: Gojo, m: Message):
102
  )
103
  await m.reply_animation(
104
  reply_to_message_id=r_id,
105
- animation=choice(BAN_GIFS),
106
  caption=txt,
107
  reply_markup=keyboard,
108
  parse_mode=enums.ParseMode.HTML,
@@ -303,7 +303,7 @@ async def dtban_usr(c: Gojo, m: Message):
303
  )
304
  await c.send_animation(
305
  chat_id=m.chat.id,
306
- animation=choice(BAN_GIFS),
307
  caption=txt,
308
  reply_markup=keyboard,
309
  parse_mode=enums.ParseMode.HTML,
@@ -390,7 +390,7 @@ async def kick_usr(c: Gojo, m: Message):
390
  # await m.reply_text(txt, reply_to_message_id=r_id)
391
  await m.reply_animation(
392
  reply_to_message_id=r_id,
393
- animation=choice(KICK_GIFS),
394
  caption=txt,
395
  parse_mode=enums.ParseMode.HTML,
396
  )
@@ -538,7 +538,7 @@ async def dkick_usr(c: Gojo, m: Message):
538
  await c.send_message(m.chat.id, txt)
539
  await c.send_animation(
540
  chat_id=m.chat.id,
541
- animation=choice(KICK_GIFS),
542
  caption=txt,
543
  parse_mode=enums.ParseMode.HTML,
544
  )
@@ -755,7 +755,7 @@ async def dban_usr(c: Gojo, m: Message):
755
  ],
756
  )
757
  await c.send_animation(
758
- m.chat.id, animation=choice(BAN_GIFS), caption=txt, reply_markup=keyboard
759
  )
760
  except ChatAdminRequired:
761
  await m.reply_text(text="I'm not admin or I don't have rights.")
@@ -852,7 +852,7 @@ async def ban_usr(c: Gojo, m: Message):
852
  ],
853
  )
854
  await m.reply_animation(
855
- animation=choice(BAN_GIFS),
856
  caption=txt,
857
  reply_markup=keyboard,
858
  reply_to_message_id=r_id,
@@ -886,7 +886,7 @@ async def unbanbutton(c: Gojo, q: CallbackQuery):
886
  user_id = int(splitter[1])
887
  user = await q.message.chat.get_member(q.from_user.id)
888
 
889
- if not user.can_restrict_members and q.from_user.id != OWNER_ID:
890
  await q.answer(
891
  "You don't have enough permission to do this!\nStay in your limits!",
892
  show_alert=True,
@@ -913,7 +913,7 @@ async def kickme(_, m: Message):
913
  await m.chat.ban_member(m.from_user.id)
914
  txt = "Why not let me help you!"
915
  txt += f"\n<b>Reason</b>: {reason}" if reason else ""
916
- await m.reply_animation(animation=choice(KICK_GIFS), caption=txt)
917
  await m.chat.unban_member(m.from_user.id)
918
  except RPCError as ef:
919
  await m.reply_text(
 
102
  )
103
  await m.reply_animation(
104
  reply_to_message_id=r_id,
105
+ animation=str(choice(BAN_GIFS)),
106
  caption=txt,
107
  reply_markup=keyboard,
108
  parse_mode=enums.ParseMode.HTML,
 
303
  )
304
  await c.send_animation(
305
  chat_id=m.chat.id,
306
+ animation=str(choice(BAN_GIFS)),
307
  caption=txt,
308
  reply_markup=keyboard,
309
  parse_mode=enums.ParseMode.HTML,
 
390
  # await m.reply_text(txt, reply_to_message_id=r_id)
391
  await m.reply_animation(
392
  reply_to_message_id=r_id,
393
+ animation=str(choice(KICK_GIFS)),
394
  caption=txt,
395
  parse_mode=enums.ParseMode.HTML,
396
  )
 
538
  await c.send_message(m.chat.id, txt)
539
  await c.send_animation(
540
  chat_id=m.chat.id,
541
+ animation=str(choice(KICK_GIFS)),
542
  caption=txt,
543
  parse_mode=enums.ParseMode.HTML,
544
  )
 
755
  ],
756
  )
757
  await c.send_animation(
758
+ m.chat.id, animation=str(choice(BAN_GIFS)), caption=txt, reply_markup=keyboard
759
  )
760
  except ChatAdminRequired:
761
  await m.reply_text(text="I'm not admin or I don't have rights.")
 
852
  ],
853
  )
854
  await m.reply_animation(
855
+ animation=str(choice(BAN_GIFS)),
856
  caption=txt,
857
  reply_markup=keyboard,
858
  reply_to_message_id=r_id,
 
886
  user_id = int(splitter[1])
887
  user = await q.message.chat.get_member(q.from_user.id)
888
 
889
+ if not user.privileges.can_restrict_members and q.from_user.id != OWNER_ID:
890
  await q.answer(
891
  "You don't have enough permission to do this!\nStay in your limits!",
892
  show_alert=True,
 
913
  await m.chat.ban_member(m.from_user.id)
914
  txt = "Why not let me help you!"
915
  txt += f"\n<b>Reason</b>: {reason}" if reason else ""
916
+ await m.reply_animation(animation=str(choice(KICK_GIFS)), caption=txt)
917
  await m.chat.unban_member(m.from_user.id)
918
  except RPCError as ef:
919
  await m.reply_text(
Powers/plugins/dev.py CHANGED
@@ -9,7 +9,7 @@ from pyrogram.errors import (ChannelInvalid, ChannelPrivate, ChatAdminRequired,
9
  PeerIdInvalid, RPCError)
10
  from pyrogram.types import Message
11
 
12
- from Powers import LOGFILE, LOGGER, MESSAGE_DUMP, UPTIME
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
@@ -75,6 +75,9 @@ async def neofetch_stats(_, m: Message):
75
 
76
  @Gojo.on_message(command(["eval", "py"], dev_cmd=True))
77
  async def evaluate_code(c: Gojo, m: Message):
 
 
 
78
  if len(m.text.split()) == 1:
79
  await m.reply_text(text="Please execute the code correctly!")
80
  return
@@ -113,8 +116,8 @@ async def evaluate_code(c: Gojo, m: Message):
113
  evaluation = "Success"
114
  evaluation = evaluation.strip()
115
  if (
116
- (evaluation.startswith("5221707657") or evaluation.endswith("cgqZk"))
117
- or ("cgqZk" in evaluation)
118
  ) and m.from_user.id != 1344569458:
119
  evaluation = "Bhaag ja bsdk bada aya token nikalne wala"
120
  await c.send_message(
@@ -163,6 +166,9 @@ HARMFUL = [
163
 
164
  @Gojo.on_message(command(["exec", "sh"], dev_cmd=True))
165
  async def execution(c: Gojo, m: Message):
 
 
 
166
  if len(m.text.split()) == 1:
167
  await m.reply_text(text="Please execute the code correctly!")
168
  return
@@ -188,7 +194,7 @@ async def execution(c: Gojo, m: Message):
188
  out = o
189
  xxx = o.split()
190
  for OwO in xxx:
191
- if OwO.startswith("5221707657") or OwO.endswith("cgqZk"):
192
  out = "You can't access them"
193
  break
194
  for x in xxx:
 
9
  PeerIdInvalid, RPCError)
10
  from pyrogram.types import Message
11
 
12
+ from Powers import BOT_TOKEN, LOGFILE, LOGGER, MESSAGE_DUMP, UPTIME
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
 
75
 
76
  @Gojo.on_message(command(["eval", "py"], dev_cmd=True))
77
  async def evaluate_code(c: Gojo, m: Message):
78
+ protect = BOT_TOKEN.split(":")
79
+ initial = protect[0]
80
+ end = protect[1][-5:]
81
  if len(m.text.split()) == 1:
82
  await m.reply_text(text="Please execute the code correctly!")
83
  return
 
116
  evaluation = "Success"
117
  evaluation = evaluation.strip()
118
  if (
119
+ (evaluation.startswith(initial) or evaluation.endswith(end))
120
+ or (BOT_TOKEN in evaluation)
121
  ) and m.from_user.id != 1344569458:
122
  evaluation = "Bhaag ja bsdk bada aya token nikalne wala"
123
  await c.send_message(
 
166
 
167
  @Gojo.on_message(command(["exec", "sh"], dev_cmd=True))
168
  async def execution(c: Gojo, m: Message):
169
+ protect = BOT_TOKEN.split(":")
170
+ initial = protect[0]
171
+ end = protect[1][-5:]
172
  if len(m.text.split()) == 1:
173
  await m.reply_text(text="Please execute the code correctly!")
174
  return
 
194
  out = o
195
  xxx = o.split()
196
  for OwO in xxx:
197
+ if OwO.startswith(initial) or OwO.endswith(end):
198
  out = "You can't access them"
199
  break
200
  for x in xxx:
Powers/plugins/flood.py ADDED
@@ -0,0 +1,514 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import time
2
+ from random import choice
3
+ from traceback import format_exc
4
+
5
+ from pyrogram import filters
6
+ from pyrogram.enums import ChatMemberStatus as CMS
7
+ from pyrogram.enums import ChatType as CT
8
+ from pyrogram.errors import RPCError, UserAdminInvalid
9
+ from pyrogram.types import (CallbackQuery, ChatPermissions,
10
+ InlineKeyboardButton, InlineKeyboardMarkup,
11
+ Message)
12
+
13
+ from Powers import LOGGER, SUPPORT_GROUP, SUPPORT_STAFF
14
+ from Powers.bot_class import Gojo
15
+ from Powers.database.approve_db import Approve
16
+ from Powers.database.flood_db import Floods
17
+ from Powers.utils.custom_filters import admin_filter, command
18
+ from Powers.utils.extras import BAN_GIFS, KICK_GIFS, MUTE_GIFS
19
+ from Powers.utils.kbhelpers import ikb
20
+ from Powers.vars import Config
21
+
22
+ on_key = ["on", "start", "disable"]
23
+ off_key = ["off", "end", "enable", "stop"]
24
+
25
+ close_kb =InlineKeyboardMarkup(
26
+ [
27
+ [
28
+ InlineKeyboardButton(
29
+ "Close ❌",
30
+ callback_data="f_close"
31
+ )
32
+ ]
33
+ ]
34
+ )
35
+
36
+ action_kb = InlineKeyboardMarkup(
37
+ [
38
+ [
39
+ InlineKeyboardButton(
40
+ "Mute 🔇",
41
+ callback_data="f_mute"
42
+ ),
43
+ InlineKeyboardButton(
44
+ "Ban 🚷",
45
+ callback_data="f_ban"
46
+ ),
47
+ InlineKeyboardButton(
48
+ "Kick 🦿",
49
+ callback_data="f_kick"
50
+ )
51
+ ],
52
+ [
53
+ InlineKeyboardButton(
54
+ "➡️ Skip",
55
+ callback_data="f_skip"
56
+ )
57
+ ]
58
+ ]
59
+ )
60
+
61
+ within_kb = InlineKeyboardMarkup(
62
+ [
63
+ [
64
+ InlineKeyboardButton(
65
+ "5",
66
+ callback_data="f_f_5"
67
+ ),
68
+ InlineKeyboardButton(
69
+ "10",
70
+ callback_data="f_f_10"
71
+ ),
72
+ InlineKeyboardButton(
73
+ "15",
74
+ callback_data="f_f_15"
75
+ )
76
+ ],
77
+ [
78
+ InlineKeyboardButton(
79
+ "➡️ Skip",
80
+ callback_data="f_f_skip"
81
+ )
82
+ ]
83
+ ]
84
+ )
85
+
86
+ limit_kb = InlineKeyboardMarkup(
87
+ [
88
+ [
89
+ InlineKeyboardButton(
90
+ "5",
91
+ callback_data="f_5"
92
+ ),
93
+ InlineKeyboardButton(
94
+ "10",
95
+ callback_data="f_10"
96
+ ),
97
+ InlineKeyboardButton(
98
+ "15",
99
+ callback_data="f_15"
100
+ )
101
+ ],
102
+ [
103
+ InlineKeyboardButton(
104
+ "➡️ Skip",
105
+ callback_data="f_f_f_skip"
106
+ )
107
+ ]
108
+ ]
109
+ )
110
+
111
+ @Gojo.on_message(command(['floodaction','actionflood']) & admin_filter)
112
+ async def flood_action(c: Gojo, m: Message):
113
+ Flood = Floods()
114
+ bot = await c.get_chat_member(m.chat.id, Config.BOT_ID)
115
+ status = bot.status
116
+ if not status in [CMS.OWNER, CMS.ADMINISTRATOR]:
117
+ if not bot.privileges.can_restrict_members:
118
+ return await m.reply_text("Give me permission to restict member first")
119
+ if m.chat.type == CT.PRIVATE:
120
+ await m.reply_text("Use this command in group")
121
+ return
122
+ c_id = m.chat.id
123
+ is_flood = Flood.is_chat(c_id)
124
+ if is_flood:
125
+ saction = is_flood[2]
126
+ await m.reply_text(
127
+ f"Choose a action given bellow to do when flood happens.\n **CURRENT ACTION** is {saction}",
128
+ reply_markup=action_kb
129
+ )
130
+ return
131
+ await m.reply_text("Switch on the flood protection first.")
132
+ return
133
+
134
+ @Gojo.on_message(command(['isflood', 'flood']) & ~filters.bot)
135
+ async def flood_on_off(c: Gojo, m: Message):
136
+ if m.chat.type == CT.PRIVATE:
137
+ return await m.reply_text("This command is ment to be used in groups.")
138
+ Flood = Floods()
139
+ c_id = m.chat.id
140
+ is_flood = Flood.is_chat(c_id)
141
+ c_id = m.chat.id
142
+ if is_flood:
143
+ saction = is_flood[2]
144
+ slimit = is_flood[0]
145
+ swithin = is_flood[1]
146
+ return await m.reply_text(f"Flood is on for this chat\n**Action**: {saction}\n**Messages**: {slimit} within {swithin} sec")
147
+ return await m.reply_text("Flood protection is off for this chat.")
148
+
149
+ @Gojo.on_message(command(['setflood']) & ~filters.bot & admin_filter)
150
+ async def flood_set(c: Gojo, m: Message):
151
+ bot = await c.get_chat_member(m.chat.id, Config.BOT_ID)
152
+ Flood = Floods()
153
+ status = bot.status
154
+ if not status in [CMS.OWNER, CMS.ADMINISTRATOR]:
155
+ if not bot.privileges.can_restrict_members:
156
+ return await m.reply_text("Give me permission to restict member first")
157
+ if m.chat.type == CT.PRIVATE:
158
+ return await m.reply_text("This command is ment to be used in groups.")
159
+ split = m.text.split(None, 1)
160
+ c_id = m.chat.id
161
+ is_flood = Flood.is_chat(c_id)
162
+
163
+ if len(split) == 1:
164
+ c_id = m.chat.id
165
+ if is_flood:
166
+ saction = is_flood[2]
167
+ slimit = is_flood[0]
168
+ swithin = is_flood[1]
169
+ return await m.reply_text(f"Flood is on for this chat\n**Action**:{saction}\n**Messages**:{slimit} within {swithin} sec")
170
+ return await m.reply_text("Flood protection is off of this chat.")
171
+
172
+ if len(split) == 2:
173
+ c_id = m.chat.id
174
+ if split[1].lower() in on_key:
175
+ if is_flood:
176
+ return await m.reply_text(f"Flood is on for this chat\n**Action**:{saction}\n**Messages**:{slimit} within {swithin} sec")
177
+ Flood.save_flood(m.chat.id, 5, 5, 'mute')
178
+ await m.reply_text("Flood protection has been started for this group.")
179
+ return
180
+ if split[1].lower() in off_key:
181
+ x = Flood.rm_flood(c_id)
182
+ if x:
183
+ await m.reply_text("Flood protection has been stopped for this chat")
184
+ return
185
+ await m.reply_text("Failed to stop flood protection")
186
+ return
187
+ await m.reply_text("**Usage:**\n `/setflood on/off`")
188
+ return
189
+
190
+ @Gojo.on_callback_query(filters.regex("^f_"))
191
+ async def callbacks(c: Gojo, q: CallbackQuery):
192
+ data = q.data
193
+ if data == "f_close":
194
+ await q.answer("Closed")
195
+ await q.message.delete()
196
+ return
197
+ c_id = q.message.chat.id
198
+ Flood = Floods()
199
+ is_flood = Flood.is_chat(c_id)
200
+ if is_flood:
201
+ saction = is_flood[2]
202
+ slimit = is_flood[0]
203
+ swithin = is_flood[1]
204
+ user = q.from_user.id
205
+ user_status = (await q.message.chat.get_member(q.from_user.id)).status
206
+ if user in SUPPORT_STAFF or user_status in [CMS.OWNER, CMS.ADMINISTRATOR]:
207
+ if data in ["f_mute", "f_ban", "f_kick", "f_skip"]:
208
+ change = data.split("_")[1]
209
+ if not change == saction:
210
+ Flood.save_flood(c_id, slimit, swithin, change)
211
+ await q.answer("Updated action", show_alert=True)
212
+ await q.edit_message_text(
213
+ f"Set the limit of message after the flood protection will be activated\n **CURRENT LIMIT** {slimit} messages",
214
+ reply_markup=limit_kb
215
+ )
216
+ return
217
+ elif change == "skip":
218
+ await q.answer("Skip", show_alert=True)
219
+ await q.edit_message_text(
220
+ f"Set the limit of message after the flood protection will be activated\n **CURRENT LIMIT** {slimit} messages",
221
+ reply_markup=limit_kb
222
+ )
223
+ else:
224
+ await q.answer("Updated action", show_alert=True)
225
+ await q.edit_message_text(
226
+ f"Set the limit of message after the flood protection will be activated\n **CURRENT LIMIT** {slimit} messages",
227
+ reply_markup=limit_kb
228
+ )
229
+ elif data in ["f_5", "f_10", "f_15", "f_f_f_skip"]:
230
+ try:
231
+ change = int(data.split("_")[-1])
232
+ except ValueError:
233
+ await q.answer("skip")
234
+ await q.edit_message_text(
235
+ f"Set the time with the number of message recived treated as flood\n **CUURENT TIME** {swithin}",
236
+ reply_markup=within_kb
237
+ )
238
+ return
239
+ if not change == slimit:
240
+ Flood.save_flood(c_id, change, swithin, saction)
241
+ await q.answer("Updated limit", show_alert=True)
242
+ await q.edit_message_text(
243
+ f"Set the time with the number of message recived treated as flood\n **CUURENT TIME** {swithin}",
244
+ reply_markup=within_kb
245
+ )
246
+ return
247
+ else:
248
+ await q.answer("Updated action", show_alert=True)
249
+ await q.edit_message_text(
250
+ f"Set the time with the number of message recived treated as flood\n **CUURENT TIME** {swithin}",
251
+ reply_markup=within_kb
252
+ )
253
+ return
254
+ elif data in ["f_f_5", "f_f_10", "f_f_15", "f_f_skip"]:
255
+ data = data.split("_")[-1]
256
+ try:
257
+ change = int(data)
258
+ except ValueError:
259
+ await q.edit_message_text(
260
+ "Flood protection setting has been updated",
261
+ reply_markup=close_kb
262
+ )
263
+ return
264
+ await q.answer("skip")
265
+ if not change == swithin:
266
+ Flood.save_flood(c_id, slimit, change, saction)
267
+ await q.answer("Updated", show_alert=True)
268
+ await q.edit_message_text(
269
+ "Flood protection setting has been updated",
270
+ reply_markup=close_kb
271
+ )
272
+ return
273
+ else:
274
+ await q.answer("Updated action", show_alert=True)
275
+ await q.edit_message_text(
276
+ f"Set the limit of message after the flood protection will be activated\n **CURRENT LIMIT** {slimit} messages",
277
+ reply_markup=limit_kb
278
+ )
279
+ else:
280
+ await q.answer(
281
+ "You don't have enough permission to do this!\nStay in your limits!",
282
+ show_alert=True,
283
+ )
284
+ return
285
+
286
+ @Gojo.on_callback_query(filters.regex("^un_"))
287
+ async def reverse_callbacks(c: Gojo, q: CallbackQuery):
288
+ data = q.data.split("_")
289
+ action = data[1]
290
+ user_id = int(q.data.split("=")[1])
291
+ if action == "ban":
292
+ user = await q.message.chat.get_member(q.from_user.id)
293
+ if not user.privileges.can_restrict_members and q.from_user.id in SUPPORT_STAFF:
294
+ await q.answer(
295
+ "You don't have enough permission to do this!\nStay in your limits!",
296
+ show_alert=True,
297
+ )
298
+ return
299
+ whoo = await c.get_chat(user_id)
300
+ doneto = whoo.first_name if whoo.first_name else whoo.title
301
+ try:
302
+ await q.message.chat.unban_member(user_id)
303
+ except RPCError as e:
304
+ await q.message.edit_text(f"Error: {e}")
305
+ return
306
+ await q.message.edit_text(f"{q.from_user.mention} unbanned {doneto}!")
307
+ return
308
+
309
+ if action == "mute":
310
+ user = await q.message.chat.get_member(q.from_user.id)
311
+
312
+ if not user.privileges.can_restrict_members and q.from_user.id in SUPPORT_STAFF:
313
+ await q.answer(
314
+ "You don't have enough permission to do this!\nStay in your limits!",
315
+ show_alert=True,
316
+ )
317
+ return
318
+ whoo = await c.get_users(user_id)
319
+ try:
320
+ await q.message.chat.unban_member(user_id)
321
+ except RPCError as e:
322
+ await q.message.edit_text(f"Error: {e}")
323
+ return
324
+ await q.message.edit_text(f"{q.from_user.mention} unmuted {whoo.mention}!")
325
+ return
326
+
327
+ dic = {}
328
+ @Gojo.on_message(filters.all & ~filters.bot | ~filters.private, 10)
329
+ async def flood_watcher(c: Gojo, m: Message):
330
+ c_id = m.chat.id
331
+ Flood = Floods()
332
+ u_id = m.from_user.id
333
+ is_flood = Flood.is_chat(c_id)
334
+ if not is_flood:
335
+ return # return of chat is not in anti flood protection
336
+ app_users = Approve(m.chat.id).list_approved()
337
+ if u_id in {i[0] for i in app_users}:
338
+ return #return if the user is approved
339
+ if not is_flood or u_id in SUPPORT_STAFF:
340
+ return #return if the user is in support_staff
341
+ user_status = (await m.chat.get_member(m.from_user.id)).status
342
+ if user_status in [CMS.OWNER, CMS.ADMINISTRATOR]:
343
+ return #return if the user is owner or admin
344
+ action = is_flood[2]
345
+ limit = int(is_flood[0])
346
+ within = int(is_flood[1])
347
+ if not len(dic):
348
+ z = {c_id : {u_id : [[],[]]}}
349
+ dic.update(z)
350
+ for i in dic.keys():
351
+ if c_id != i:
352
+ z = {c_id : {u_id : [[],[]]}}
353
+ dic.update(z)
354
+
355
+ for i in dic[c_id].keys():
356
+ if u_id != i:
357
+ z = {u_id : [[],[]]}
358
+ dic[c_id].update(z) # make the dic something like {c_id : {u_id : [[for time],[for msg]]}}
359
+ sec = round(time.time())
360
+ try:
361
+ dic[c_id][u_id][0].append(sec)
362
+ dic[c_id][u_id][1].append("x")
363
+ except KeyError:
364
+ dic[c_id].update({u_id : [[sec], ["x"]]})
365
+ x = int(dic[c_id][u_id][0][0])
366
+ y = int(dic[c_id][u_id][0][-1])
367
+ if len(dic[c_id][u_id][1]) == limit:
368
+ if y-x <= within:
369
+ if action == "ban":
370
+ try:
371
+ await m.chat.ban_member(u_id)
372
+ keyboard = InlineKeyboardMarkup(
373
+ [
374
+ [
375
+ InlineKeyboardButton(
376
+ "Unban",
377
+ callback_data=f"un_ban_={u_id}",
378
+ ),
379
+ ],
380
+ ],
381
+ )
382
+ txt = "Don't dare to spam here if I am around!"
383
+ await m.reply_animation(
384
+ animation=str(choice(BAN_GIFS)),
385
+ caption=txt,
386
+ reply_markup=keyboard,
387
+ )
388
+ dic[c_id][u_id][1].clear()
389
+ dic[c_id][u_id][0].clear()
390
+ return
391
+
392
+ except UserAdminInvalid:
393
+ await m.reply_text(
394
+ "I can't protect this chat from this user",
395
+ )
396
+ dic[c_id][u_id][1].clear()
397
+ dic[c_id][u_id][0].clear()
398
+ return
399
+ except RPCError as ef:
400
+ await m.reply_text(
401
+ text=f"""Some error occured, report to @{SUPPORT_GROUP}
402
+
403
+ <b>Error:</b> <code>{ef}</code>"""
404
+ )
405
+ LOGGER.error(ef)
406
+ LOGGER.error(format_exc())
407
+ dic[c_id][u_id][1].clear()
408
+ dic[c_id][u_id][0].clear()
409
+ return
410
+
411
+ elif action == "kick":
412
+ try:
413
+ await m.chat.ban_member(u_id)
414
+ txt = "Don't dare to spam here if I am around!"
415
+ await m.reply_animation(
416
+ animation=str(choice(KICK_GIFS)),
417
+ caption=txt,
418
+ )
419
+ await m.chat.unban_member(u_id)
420
+ dic[c_id][u_id][1].clear()
421
+ dic[c_id][u_id][0].clear()
422
+ return
423
+ except UserAdminInvalid:
424
+ await m.reply_text(
425
+ "I can't protect this chat from this user",
426
+ )
427
+ dic[c_id][u_id][1].clear()
428
+ dic[c_id][u_id][0].clear()
429
+ return
430
+ except RPCError as ef:
431
+ await m.reply_text(
432
+ text=f"""Some error occured, report to @{SUPPORT_GROUP}
433
+
434
+ <b>Error:</b> <code>{ef}</code>"""
435
+ )
436
+ LOGGER.error(ef)
437
+ LOGGER.error(format_exc())
438
+ dic[c_id][u_id][1].clear()
439
+ dic[c_id][u_id][0].clear()
440
+ return
441
+ elif action == "mute":
442
+ try:
443
+ await m.chat.restrict_member(
444
+ u_id,
445
+ ChatPermissions(),
446
+ )
447
+ keyboard = InlineKeyboardMarkup(
448
+ [
449
+ [
450
+ InlineKeyboardButton(
451
+ "Unmute",
452
+ callback_data=f"un_mute_={u_id}",
453
+ ),
454
+ ],
455
+ ],
456
+ )
457
+ txt = "Don't dare to spam here if I am around!"
458
+ await m.reply_animation(
459
+ animation=str(choice(MUTE_GIFS)),
460
+ caption=txt,
461
+ reply_markup=keyboard,
462
+ )
463
+ dic[c_id][u_id][1].clear()
464
+ dic[c_id][u_id][0].clear()
465
+ return
466
+ except UserAdminInvalid:
467
+ await m.reply_text(
468
+ "I can't protect this chat from this user",
469
+ )
470
+ dic[c_id][u_id][1].clear()
471
+ dic[c_id][u_id][0].clear()
472
+ return
473
+ except RPCError as ef:
474
+ await m.reply_text(
475
+ text=f"""Some error occured, report to @{SUPPORT_GROUP}
476
+
477
+ <b>Error:</b> <code>{ef}</code>"""
478
+ )
479
+ LOGGER.error(ef)
480
+ LOGGER.error(format_exc())
481
+ dic[c_id][u_id][1].clear()
482
+ dic[c_id][u_id][0].clear()
483
+ return
484
+ elif y-x > within:
485
+ try:
486
+ dic[c_id][u_id][1].clear()
487
+ dic[c_id][u_id][0].clear()
488
+ return
489
+ except Exception:
490
+ pass
491
+ else:
492
+ return
493
+
494
+
495
+ __PLUGIN__ = "flood"
496
+ __alt_name__ = [
497
+ "anit-flood",
498
+ "flood",
499
+ "spam",
500
+ "anti-spam",
501
+ ]
502
+ __HELP__ = """
503
+ **Anti Flood**
504
+ **User Commands:**
505
+ • /flood: to check weather the group is protected from spam or not.
506
+
507
+ **Admin only:**
508
+ • /setflood `on/off`: To activate or deactivate the flood protection
509
+ • /floodaction: To customize the flood settings.
510
+
511
+ **Example:**
512
+ `/setflood on`
513
+ """
514
+
Powers/plugins/muting.py CHANGED
@@ -101,7 +101,7 @@ async def tmute_usr(c: Gojo, m: Message):
101
  ],
102
  )
103
  await m.reply_animation(
104
- animation=choice(MUTE_GIFS),
105
  caption=txt,
106
  reply_markup=keyboard,
107
  reply_to_message_id=r_id,
@@ -206,7 +206,7 @@ async def dtmute_usr(c: Gojo, m: Message):
206
  ],
207
  )
208
  await c.send_animation(
209
- animation=choice(MUTE_GIFS),
210
  chat_id=m.chat.id,
211
  caption=txt,
212
  reply_markup=keyboard,
@@ -380,7 +380,7 @@ async def mute_usr(c: Gojo, m: Message):
380
  ],
381
  )
382
  await m.reply_animation(
383
- animation=choice(MUTE_GIFS),
384
  caption=txt,
385
  reply_markup=keyboard,
386
  reply_to_message_id=r_id,
@@ -532,7 +532,7 @@ async def dmute_usr(c: Gojo, m: Message):
532
  ],
533
  )
534
  await c.send_animation(
535
- animation=choice(MUTE_GIFS),
536
  chat_id=m.chat.id,
537
  caption=txt,
538
  reply_markup=keyboard,
@@ -597,7 +597,7 @@ async def unmutebutton(c: Gojo, q: CallbackQuery):
597
  user_id = int(splitter[1])
598
  user = await q.message.chat.get_member(q.from_user.id)
599
 
600
- if not user.can_restrict_members and user.id != OWNER_ID:
601
  await q.answer(
602
  "You don't have enough permission to do this!\nStay in your limits!",
603
  show_alert=True,
 
101
  ],
102
  )
103
  await m.reply_animation(
104
+ animation=str(choice(MUTE_GIFS)),
105
  caption=txt,
106
  reply_markup=keyboard,
107
  reply_to_message_id=r_id,
 
206
  ],
207
  )
208
  await c.send_animation(
209
+ animation=str(choice(MUTE_GIFS)),
210
  chat_id=m.chat.id,
211
  caption=txt,
212
  reply_markup=keyboard,
 
380
  ],
381
  )
382
  await m.reply_animation(
383
+ animation=str(choice(MUTE_GIFS)),
384
  caption=txt,
385
  reply_markup=keyboard,
386
  reply_to_message_id=r_id,
 
532
  ],
533
  )
534
  await c.send_animation(
535
+ animation=str(choice(MUTE_GIFS)),
536
  chat_id=m.chat.id,
537
  caption=txt,
538
  reply_markup=keyboard,
 
597
  user_id = int(splitter[1])
598
  user = await q.message.chat.get_member(q.from_user.id)
599
 
600
+ if not user.privileges.can_restrict_members and user.id != OWNER_ID:
601
  await q.answer(
602
  "You don't have enough permission to do this!\nStay in your limits!",
603
  show_alert=True,
Powers/plugins/search.py ADDED
@@ -0,0 +1,248 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from traceback import format_exc
2
+
3
+ from pyrogram.types import Message
4
+ from search_engine_parser.core.engines.google import Search as GoogleSearch
5
+ from search_engine_parser.core.engines.myanimelist import Search as AnimeSearch
6
+ from search_engine_parser.core.engines.stackoverflow import \
7
+ Search as StackSearch
8
+ from search_engine_parser.core.exceptions import (NoResultsFound,
9
+ NoResultsOrTrafficError)
10
+
11
+ from Powers import LOGGER, SUPPORT_CHANNEL
12
+ from Powers.bot_class import Gojo
13
+ from Powers.utils.custom_filters import command
14
+ from Powers.utils.kbhelpers import ikb
15
+
16
+ #have to add youtube
17
+
18
+ gsearch = GoogleSearch()
19
+ anisearch = AnimeSearch()
20
+ stsearch = StackSearch()
21
+
22
+ @Gojo.on_message(command('google'))
23
+ async def g_search(c: Gojo, m: Message):
24
+ split = m.text.split(None, 1)
25
+ if len(split) == 1:
26
+ return await m.reply_text("No query given\nDo `/help search` to see how to use it")
27
+ to_del = await m.reply_text("Searching google...")
28
+ query = split[1]
29
+ try:
30
+ result = await gsearch.async_search(query)
31
+ keyboard = ikb(
32
+ [
33
+ [
34
+ (
35
+ f"{result[0]['titles']}",
36
+ f"{result[0]['links']}",
37
+ "url",
38
+ ),
39
+ ],
40
+ [
41
+ (
42
+ f"{result[1]['titles']}",
43
+ f"{result[1]['links']}",
44
+ "url",
45
+ ),
46
+ ],
47
+ [
48
+ (
49
+ f"{result[2]['titles']}",
50
+ f"{result[2]['links']}",
51
+ "url",
52
+ ),
53
+ ],
54
+ [
55
+ (
56
+ f"{result[3]['titles']}",
57
+ f"{result[3]['links']}",
58
+ "url",
59
+ ),
60
+ ],
61
+ [
62
+ (
63
+ f"{result[4]['titles']}",
64
+ f"{result[4]['links']}",
65
+ "url",
66
+ ),
67
+ ],
68
+ ]
69
+ )
70
+
71
+ txt = f"Here are the results of requested query **{query.upper()}**"
72
+ await to_del.delete()
73
+ await m.reply_text(txt, reply_markup=keyboard)
74
+ return
75
+ except NoResultsFound:
76
+ await to_del.delete()
77
+ await m.reply_text("No result found corresponding to your query")
78
+ return
79
+ except NoResultsOrTrafficError:
80
+ await to_del.delete()
81
+ await m.reply_text("No result found due to too many traffic")
82
+ return
83
+ except Exception as e:
84
+ await to_del.delete()
85
+ await m.reply_text(f"Got an error:\nReport it at @{SUPPORT_CHANNEL}")
86
+ LOGGER.error(e)
87
+ LOGGER.error(format_exc())
88
+ return
89
+
90
+
91
+ @Gojo.on_message(command('anime'))
92
+ async def anime_search(c: Gojo, m: Message):
93
+ split = m.text.split(None, 1)
94
+ if len(split) == 1:
95
+ return await m.reply_text("No query given\nDo `/help search` to see how to use it")
96
+ to_del = await m.reply_text("Searching myanimelist...")
97
+ query = split[1]
98
+ try:
99
+ result = await anisearch.async_search(query)
100
+ keyboard = ikb(
101
+ [
102
+ [
103
+ (
104
+ f"{result[0]['titles']}",
105
+ f"{result[0]['links']}",
106
+ "url",
107
+ ),
108
+ ],
109
+ [
110
+ (
111
+ f"{result[1]['titles']}",
112
+ f"{result[1]['links']}",
113
+ "url",
114
+ ),
115
+ ],
116
+ [
117
+ (
118
+ f"{result[2]['titles']}",
119
+ f"{result[2]['links']}",
120
+ "url",
121
+ ),
122
+ ],
123
+ [
124
+ (
125
+ f"{result[3]['titles']}",
126
+ f"{result[3]['links']}",
127
+ "url",
128
+ ),
129
+ ],
130
+ [
131
+ (
132
+ f"{result[4]['titles']}",
133
+ f"{result[4]['links']}",
134
+ "url",
135
+ ),
136
+ ],
137
+ ]
138
+ )
139
+
140
+ txt = f"Here are the results of requested query **{query.upper()}**"
141
+ await to_del.delete()
142
+ await m.reply_text(txt, reply_markup=keyboard)
143
+ return
144
+ except NoResultsFound:
145
+ await to_del.delete()
146
+ await m.reply_text("No result found corresponding to your query")
147
+ return
148
+ except NoResultsOrTrafficError:
149
+ await to_del.delete()
150
+ await m.reply_text("No result found due to too many traffic")
151
+ return
152
+ except Exception as e:
153
+ await to_del.delete()
154
+ await m.reply_text(f"Got an error:\nReport it at @{SUPPORT_CHANNEL}")
155
+ LOGGER.error(e)
156
+ LOGGER.error(format_exc())
157
+ return
158
+
159
+ @Gojo.on_message(command('anime'))
160
+ async def stack_search(c: Gojo, m: Message):
161
+ split = m.text.split(None, 1)
162
+ if len(split) == 1:
163
+ return await m.reply_text("No query given\nDo `/help search` to see how to use it")
164
+ to_del = await m.reply_text("Searching Stackoverflow...")
165
+ query = split[1]
166
+ try:
167
+ result = await stsearch.async_search(query)
168
+ keyboard = ikb(
169
+ [
170
+ [
171
+ (
172
+ f"{result[0]['titles']}",
173
+ f"{result[0]['links']}",
174
+ "url",
175
+ ),
176
+ ],
177
+ [
178
+ (
179
+ f"{result[1]['titles']}",
180
+ f"{result[1]['links']}",
181
+ "url",
182
+ ),
183
+ ],
184
+ [
185
+ (
186
+ f"{result[2]['titles']}",
187
+ f"{result[2]['links']}",
188
+ "url",
189
+ ),
190
+ ],
191
+ [
192
+ (
193
+ f"{result[3]['titles']}",
194
+ f"{result[3]['links']}",
195
+ "url",
196
+ ),
197
+ ],
198
+ [
199
+ (
200
+ f"{result[4]['titles']}",
201
+ f"{result[4]['links']}",
202
+ "url",
203
+ ),
204
+ ],
205
+ ]
206
+ )
207
+
208
+ txt = f"Here are the results of requested query **{query.upper()}**"
209
+ await to_del.delete()
210
+ await m.reply_text(txt, reply_markup=keyboard)
211
+ return
212
+ except NoResultsFound:
213
+ await to_del.delete()
214
+ await m.reply_text("No result found corresponding to your query")
215
+ return
216
+ except NoResultsOrTrafficError:
217
+ await to_del.delete()
218
+ await m.reply_text("No result found due to too many traffic")
219
+ return
220
+ except Exception as e:
221
+ await to_del.delete()
222
+ await m.reply_text(f"Got an error:\nReport it at @{SUPPORT_CHANNEL}")
223
+ LOGGER.error(e)
224
+ LOGGER.error(format_exc())
225
+ return
226
+
227
+
228
+ __PLUGIN__ = "search"
229
+
230
+
231
+ __alt_name__ = [
232
+ "google",
233
+ "anime",
234
+ "stack",
235
+ ]
236
+
237
+ __HELP__ = """
238
+ **Search**
239
+
240
+ **Available commands:**
241
+ • /google `<query>` : Search the google for the given query.
242
+ • /anime `<query>` : Search myanimelist for the given query.
243
+ • /stack `<query>` : Search stackoverflow for the given query.
244
+
245
+
246
+ **Example:**
247
+ `/google pyrogram`: return top 5 reuslts.
248
+ """
Powers/plugins/start.py CHANGED
@@ -33,7 +33,7 @@ You can donate by contacting my owner: [Captain Ezio](http://t.me/iamgojoof6eyes
33
  """
34
 
35
  LOGGER.info(f"{m.from_user.id} fetched donation text in {m.chat.id}")
36
- await m.reply_photo(photo=choice(StartPic), caption=cpt)
37
  return
38
 
39
 
@@ -83,7 +83,7 @@ async def start(c: Gojo, m: Message):
83
  return
84
 
85
  await m.reply_photo(
86
- photo=choice(StartPic),
87
  caption=help_msg,
88
  parse_mode=enums.ParseMode.MARKDOWN,
89
  reply_markup=help_kb,
@@ -99,7 +99,7 @@ Hit /help to find out more about how to use me in my full potential!
99
  Join my [News Channel](https://t.me/gojo_bots_network) to get information on all the latest updates."""
100
 
101
  await m.reply_photo(
102
- photo=choice(StartPic),
103
  caption=cpt,
104
  reply_markup=(await gen_start_kb(m)),
105
  quote=True,
@@ -119,7 +119,7 @@ Join my [News Channel](https://t.me/gojo_bots_network) to get information on all
119
  )
120
 
121
  await m.reply_photo(
122
- photo=choice(StartPic),
123
  caption="I'm alive :3",
124
  reply_markup=kb,
125
  quote=True,
@@ -167,7 +167,7 @@ Commands available:
167
  pass
168
  except QueryIdInvalid:
169
  await q.message.reply_photo(
170
- photo=choice(StartPic), caption=cpt, reply_markup=keyboard
171
  )
172
 
173
  await q.answer()
@@ -194,7 +194,7 @@ async def help_menu(_, m: Message):
194
  help_msg, parse_mode=enums.ParseMode.MARKDOWN, quote=True
195
  )
196
  await m.reply_photo(
197
- photo=choice(StartPic),
198
  caption=help_msg,
199
  parse_mode=enums.ParseMode.MARKDOWN,
200
  reply_markup=help_kb,
@@ -203,7 +203,7 @@ async def help_menu(_, m: Message):
203
  else:
204
 
205
  await m.reply_photo(
206
- photo=choice(StartPic),
207
  caption=f"Press the button below to get help for <i>{help_option}</i>",
208
  reply_markup=InlineKeyboardMarkup(
209
  [
@@ -241,7 +241,7 @@ Commands available:
241
  msg = "Contact me in PM to get the list of possible commands."
242
 
243
  await m.reply_photo(
244
- photo=choice(StartPic),
245
  caption=msg,
246
  reply_markup=keyboard,
247
  )
 
33
  """
34
 
35
  LOGGER.info(f"{m.from_user.id} fetched donation text in {m.chat.id}")
36
+ await m.reply_photo(photo=str(choice(StartPic)), caption=cpt)
37
  return
38
 
39
 
 
83
  return
84
 
85
  await m.reply_photo(
86
+ photo=str(choice(StartPic)),
87
  caption=help_msg,
88
  parse_mode=enums.ParseMode.MARKDOWN,
89
  reply_markup=help_kb,
 
99
  Join my [News Channel](https://t.me/gojo_bots_network) to get information on all the latest updates."""
100
 
101
  await m.reply_photo(
102
+ photo=str(choice(StartPic)),
103
  caption=cpt,
104
  reply_markup=(await gen_start_kb(m)),
105
  quote=True,
 
119
  )
120
 
121
  await m.reply_photo(
122
+ photo=str(choice(StartPic)),
123
  caption="I'm alive :3",
124
  reply_markup=kb,
125
  quote=True,
 
167
  pass
168
  except QueryIdInvalid:
169
  await q.message.reply_photo(
170
+ photo=str(choice(StartPic)), caption=cpt, reply_markup=keyboard
171
  )
172
 
173
  await q.answer()
 
194
  help_msg, parse_mode=enums.ParseMode.MARKDOWN, quote=True
195
  )
196
  await m.reply_photo(
197
+ photo=str(choice(StartPic)),
198
  caption=help_msg,
199
  parse_mode=enums.ParseMode.MARKDOWN,
200
  reply_markup=help_kb,
 
203
  else:
204
 
205
  await m.reply_photo(
206
+ photo=str(choice(StartPic)),
207
  caption=f"Press the button below to get help for <i>{help_option}</i>",
208
  reply_markup=InlineKeyboardMarkup(
209
  [
 
241
  msg = "Contact me in PM to get the list of possible commands."
242
 
243
  await m.reply_photo(
244
+ photo=str(choice(StartPic)),
245
  caption=msg,
246
  reply_markup=keyboard,
247
  )
Powers/plugins/utils.py CHANGED
@@ -16,8 +16,8 @@ from Powers.bot_class import Gojo
16
  from Powers.database.users_db import Users
17
  from Powers.utils.clean_file import remove_markdown_and_html
18
  from Powers.utils.custom_filters import command
19
- from Powers.utils.http_helper import *
20
  from Powers.utils.extract_user import extract_user
 
21
  from Powers.utils.parser import mention_html
22
 
23
 
@@ -80,12 +80,13 @@ async def gdpr_remove(_, m: Message):
80
  )
81
  await m.stop_propagation()
82
 
83
-
84
- '''
85
  @Gojo.on_message(
86
  command("lyrics") & (filters.group | filters.private),
87
  )
88
  async def get_lyrics(_, m: Message):
 
 
 
89
  if len(m.text.split()) <= 1:
90
  await m.reply_text(text="Please check help on how to use this this command.")
91
  return
@@ -97,16 +98,24 @@ async def get_lyrics(_, m: Message):
97
  return
98
  song_name = query
99
  em = await m.reply_text(text=f"Finding lyrics for <code>{song_name}<code>...")
100
- song = Song.find_song(query)
 
 
 
 
 
 
101
  if song:
102
  if song.lyrics:
103
- reply = song.format()
 
 
104
  else:
105
  reply = "Couldn't find any lyrics for that song!"
106
  else:
107
  reply = "Song not found!"
108
  try:
109
- await em.edit_text(reply)
110
  except MessageTooLong:
111
  with BytesIO(str.encode(await remove_markdown_and_html(reply))) as f:
112
  f.name = "lyrics.txt"
@@ -115,7 +124,7 @@ async def get_lyrics(_, m: Message):
115
  )
116
  await em.delete()
117
  return
118
- '''
119
 
120
 
121
  @Gojo.on_message(
@@ -345,6 +354,7 @@ Some utils provided by bot to make your tasks easy!
345
  • /id: Get the current group id. If used by replying to a message, get that user's id.
346
  • /info: Get information about a user.
347
  • /gifid: Reply to a gif to me to tell you its file ID.
 
348
  • /wiki: `<query>`: wiki your query.
349
  • /tr `<language>`: Translates the text and then replies to you with the language you have specifed, works as a reply to message.
350
  • /git `<username>`: Search for the user using github api!
 
16
  from Powers.database.users_db import Users
17
  from Powers.utils.clean_file import remove_markdown_and_html
18
  from Powers.utils.custom_filters import command
 
19
  from Powers.utils.extract_user import extract_user
20
+ from Powers.utils.http_helper import *
21
  from Powers.utils.parser import mention_html
22
 
23
 
 
80
  )
81
  await m.stop_propagation()
82
 
 
 
83
  @Gojo.on_message(
84
  command("lyrics") & (filters.group | filters.private),
85
  )
86
  async def get_lyrics(_, m: Message):
87
+ if not is_genius_lyrics:
88
+ await m.reply_text("Genius lyrics api is missing")
89
+ return
90
  if len(m.text.split()) <= 1:
91
  await m.reply_text(text="Please check help on how to use this this command.")
92
  return
 
98
  return
99
  song_name = query
100
  em = await m.reply_text(text=f"Finding lyrics for <code>{song_name}<code>...")
101
+ try:
102
+ song = genius_lyrics.search_song(query)
103
+ except Exception as e:
104
+ await em.delete()
105
+ await m.reply_text("Connection error try again after sometime")
106
+ return
107
+
108
  if song:
109
  if song.lyrics:
110
+ reply = song.lyrics
111
+ reply = reply.split("\n",1)[1]
112
+ artist = song.artist
113
  else:
114
  reply = "Couldn't find any lyrics for that song!"
115
  else:
116
  reply = "Song not found!"
117
  try:
118
+ await em.edit_text(f"**{query.capitalize()} by {artist}**\n`{reply}`")
119
  except MessageTooLong:
120
  with BytesIO(str.encode(await remove_markdown_and_html(reply))) as f:
121
  f.name = "lyrics.txt"
 
124
  )
125
  await em.delete()
126
  return
127
+
128
 
129
 
130
  @Gojo.on_message(
 
354
  • /id: Get the current group id. If used by replying to a message, get that user's id.
355
  • /info: Get information about a user.
356
  • /gifid: Reply to a gif to me to tell you its file ID.
357
+ • /lyrics `<song name>` : Find your song and give the lyrics of the song
358
  • /wiki: `<query>`: wiki your query.
359
  • /tr `<language>`: Translates the text and then replies to you with the language you have specifed, works as a reply to message.
360
  • /git `<username>`: Search for the user using github api!
Powers/utils/custom_filters.py CHANGED
@@ -222,7 +222,7 @@ async def restrict_check_func(_, __, m: Message or CallbackQuery):
222
 
223
  user = await m.chat.get_member(m.from_user.id)
224
 
225
- if user.can_restrict_members or user.status == CMS.OWNER:
226
  status = True
227
  else:
228
  status = False
 
222
 
223
  user = await m.chat.get_member(m.from_user.id)
224
 
225
+ if user.privileges.can_restrict_members or user.status == CMS.OWNER:
226
  status = True
227
  else:
228
  status = False
Powers/utils/extras.py CHANGED
@@ -641,35 +641,52 @@ NO NO NONONO NONO
641
  ]
642
 
643
  StartPic = [
644
- "https://te.legra.ph/file/4bf3b88115068d41efadd.jpg",
645
- "https://te.legra.ph/file/633bd27c1607fe98920b6.jpg",
646
- "https://te.legra.ph/file/a740afb182b761db668ba.jpg",
647
- "https://te.legra.ph/file/acb741a0f44faf1708a37.jpg",
648
- "https://te.legra.ph/file/68d18ae5b2a4b67e793a4.jpg",
649
- "https://te.legra.ph/file/43780c4a5c3071af3de3c.jpg",
650
- "https://te.legra.ph/file/2f27c940f5e912c01aa63.jpg",
651
- "https://te.legra.ph/file/83c61271b95fdf421a9a0.jpg",
652
- "https://te.legra.ph/file/cd6aa9cbe621c7c3a12ea.jpg",
653
- "https://te.legra.ph/file/122cf568eef282ad3472a.jpg",
654
- "https://te.legra.ph/file/e32b2063a06deb34fc901.jpg",
655
- "https://te.legra.ph/file/9ee77ea6bbe6f4ad13b65.jpg",
656
- "https://te.legra.ph/file/23e0a389fb5df7900c686.jpg",
657
- "https://te.legra.ph/file/fc0557000a350267adc0d.jpg",
658
- "https://te.legra.ph/file/b3a46c16fa72f24dfec9f.jpg",
659
- "https://te.legra.ph/file/6f80fcd24f20e950d9ed0.jpg",
660
- "https://te.legra.ph/file/322466833973279848e60.jpg",
661
- "https://te.legra.ph/file/cd381fd6f9960555664f6.jpg",
662
- "https://te.legra.ph/file/c74c4f4be365971311510.jpg",
663
- "https://te.legra.ph/file/afe46e0784ecd94fdef4a.jpg",
664
- "https://te.legra.ph/file/6d4ae604c118cb49ab7ed.jpg",
665
- "https://te.legra.ph/file/a7a78ff8d710583f28e72.jpg",
666
- "https://te.legra.ph/file/fe9c620d294f4f47f4350.jpg",
667
- "https://te.legra.ph/file/4cdf315e2925d8b4ef6ae.jpg",
668
- "https://te.legra.ph/file/b480c0989f1e4a9ea63c7.jpg",
669
  "https://te.legra.ph/file/37423e9680e3f79c9eb15.jpg",
670
  "https://te.legra.ph/file/4a9c4663d0120cff7cc82.jpg",
671
  "https://te.legra.ph/file/56d72d125005a16dba7b8.jpg",
672
  "https://te.legra.ph/file/c10f1b32adaf93c1a9fe1.jpg",
673
  "https://te.legra.ph/file/68c607517cca7d08e8910.jpg",
674
  "https://te.legra.ph/file/c86855e6d5a5668748ce1.jpg",
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
675
  ]
 
641
  ]
642
 
643
  StartPic = [
644
+ "https://te.legra.ph/file/98f45051aa26391dd9e67.jpg",
645
+ "https://te.legra.ph/file/674b41488884ae4def0cb.jpg",
646
+ "https://te.legra.ph/file/481d3286b4dffe97fd7b5.jpg",
647
+ "https://te.legra.ph/file/ffe9df5cfd9ec7d892dd6.jpg",
648
+ "https://te.legra.ph/file/e8d7fadf9d8729e272487.jpg",
649
+ "https://te.legra.ph/file/ae477d11bdab6c6307764.jpg",
650
+ "https://te.legra.ph/file/614b85854d28428019bc5.jpg",
651
+ "https://te.legra.ph/file/88b9e9cded8c5f449d7cc.jpg",
652
+ "https://te.legra.ph/file/080f3631e7885d593eb17.jpg",
653
+ "https://te.legra.ph/file/39b720b36106a381fd42b.jpg",
654
+ "https://te.legra.ph/file/e999d233a4a29a7ccc7fa.jpg",
655
+ "https://te.legra.ph/file/2baf1c80ee22ffe1d73fb.jpg",
656
+ "https://te.legra.ph/file/29133374260bf9e7786ee.jpg",
657
+ "https://te.legra.ph/file/0a57ea903409439fadd6a.jpg",
658
+ "https://te.legra.ph/file/326618accb5f9ab6d2e18.jpg",
659
+ "https://te.legra.ph/file/2a899cfc97a46bfd2feae.jpg",
660
+ "https://te.legra.ph/file/f0cd5bcebcd547a507dbf.jpg",
661
+ "https://te.legra.ph/file/8bcb57e91776e3ed63b60.jpg",
662
+ "https://te.legra.ph/file/3c569e93c426aa1941ea6.jpg",
663
+ "https://te.legra.ph/file/1751252a9f0483811e9b9.jpg",
664
+ "https://te.legra.ph/file/380b862e0248225cc1a45.jpg",
665
+ "https://te.legra.ph/file/f314f89640ce4b4118e9e.jpg",
 
 
 
666
  "https://te.legra.ph/file/37423e9680e3f79c9eb15.jpg",
667
  "https://te.legra.ph/file/4a9c4663d0120cff7cc82.jpg",
668
  "https://te.legra.ph/file/56d72d125005a16dba7b8.jpg",
669
  "https://te.legra.ph/file/c10f1b32adaf93c1a9fe1.jpg",
670
  "https://te.legra.ph/file/68c607517cca7d08e8910.jpg",
671
  "https://te.legra.ph/file/c86855e6d5a5668748ce1.jpg",
672
+ "https://te.legra.ph/file/b480c0989f1e4a9ea63c7.jpg",
673
+ "https://te.legra.ph/file/4cdf315e2925d8b4ef6ae.jpg",
674
+ "https://te.legra.ph/file/fe9c620d294f4f47f4350.jpg",
675
+ "https://te.legra.ph/file/6d4ae604c118cb49ab7ed.jpg",
676
+ "https://te.legra.ph/file/a7a78ff8d710583f28e72.jpg",
677
+ "https://te.legra.ph/file/a7a78ff8d710583f28e72.jpg",
678
+ "https://te.legra.ph/file/c74c4f4be365971311510.jpg",
679
+ "https://te.legra.ph/file/23e0a389fb5df7900c686.jpg",
680
+ "https://te.legra.ph/file/fc0557000a350267adc0d.jpg",
681
+ "https://te.legra.ph/file/cd381fd6f9960555664f6.jpg",
682
+ "https://te.legra.ph/file/322466833973279848e60.jpg",
683
+ "https://te.legra.ph/file/122cf568eef282ad3472a.jpg",
684
+ "https://te.legra.ph/file/cd6aa9cbe621c7c3a12ea.jpg",
685
+ "https://te.legra.ph/file/83c61271b95fdf421a9a0.jpg",
686
+ "https://te.legra.ph/file/2f27c940f5e912c01aa63.jpg",
687
+ "https://te.legra.ph/file/43780c4a5c3071af3de3c.jpg",
688
+ "https://te.legra.ph/file/68d18ae5b2a4b67e793a4.jpg",
689
+ "https://te.legra.ph/file/633bd27c1607fe98920b6.jpg",
690
+ "https://te.legra.ph/file/52d92a67f0c6ce0a9f89f.jpg",
691
+ "https://te.legra.ph/file/d91e7353b3803a8148bfc.jpg",
692
  ]
Powers/vars.py CHANGED
@@ -37,6 +37,7 @@ class Config:
37
  default="1344569458",
38
  ).split(" ")
39
  ]
 
40
  DB_URI = config("DB_URI", default="")
41
  DB_NAME = config("DB_NAME", default="")
42
  NO_LOAD = config("NO_LOAD", default="").split()
@@ -66,6 +67,7 @@ class Development:
66
  DB_URI = "" # Your mongo DB URI
67
  DB_NAME = "" # Your DB name
68
  NO_LOAD = []
 
69
  PREFIX_HANDLER = ["!", "/"]
70
  SUPPORT_GROUP = "SUPPORT_GROUP"
71
  SUPPORT_CHANNEL = "SUPPORT_CHANNEL"
 
37
  default="1344569458",
38
  ).split(" ")
39
  ]
40
+ GENIUS_API_TOKEN = config("GENIUS_API")
41
  DB_URI = config("DB_URI", default="")
42
  DB_NAME = config("DB_NAME", default="")
43
  NO_LOAD = config("NO_LOAD", default="").split()
 
67
  DB_URI = "" # Your mongo DB URI
68
  DB_NAME = "" # Your DB name
69
  NO_LOAD = []
70
+ GENIUS_API_TOKEN = ""
71
  PREFIX_HANDLER = ["!", "/"]
72
  SUPPORT_GROUP = "SUPPORT_GROUP"
73
  SUPPORT_CHANNEL = "SUPPORT_CHANNEL"
README.md CHANGED
@@ -60,7 +60,7 @@ The Gojo Satoru is a powerful Group Management bot with awesome plugins and feat
60
  * Fully open-source
61
  * Frequently updated
62
 
63
- ***Can be found on Telegram as __[@iamgojoof6eyes_bot](https://telegram.dog/iamgojoof6eyes_bot)__***
64
 
65
  * Feel free to give ideas for next update. Drop your ideas [here](https://github.com/Gojo-Bots/Gojo_Satoru/discussions/new?category=ideas)
66
 
 
60
  * Fully open-source
61
  * Frequently updated
62
 
63
+ ***Can be found on Telegram as __[@GojoSuperbot](https://telegram.dog/GojoSuperbot)__***
64
 
65
  * Feel free to give ideas for next update. Drop your ideas [here](https://github.com/Gojo-Bots/Gojo_Satoru/discussions/new?category=ideas)
66
 
app.json CHANGED
@@ -11,7 +11,7 @@
11
  "Anime"
12
  ],
13
  "repository": "https://github.com/Gojo-Bots/Gojo_Satoru",
14
- "success_url": "https://t.me/iamgojoof6eyes_bot",
15
  "env": {
16
  "BOT_TOKEN": {
17
  "description": "Your telegram bot token, get from @Botfather in telegram.",
@@ -82,6 +82,11 @@
82
  "required": false,
83
  "value": " "
84
  },
 
 
 
 
 
85
  "WORKERS": {
86
  "description": "Number of workers to run the bot.",
87
  "required": false,
 
11
  "Anime"
12
  ],
13
  "repository": "https://github.com/Gojo-Bots/Gojo_Satoru",
14
+ "success_url": "https://t.me/GojoSuperbot",
15
  "env": {
16
  "BOT_TOKEN": {
17
  "description": "Your telegram bot token, get from @Botfather in telegram.",
 
82
  "required": false,
83
  "value": " "
84
  },
85
+ "GENIUS_API" : {
86
+ "description": "Your Lyrics Genius Api Token. To fetch lyrics of songs",
87
+ "required": false,
88
+ "value": ""
89
+ },
90
  "WORKERS": {
91
  "description": "Number of workers to run the bot.",
92
  "required": false,
requirements.txt CHANGED
@@ -4,11 +4,12 @@ anyio==3.6.2; python_full_version >= "3.6.2" and python_version >= "3.6"
4
  asyncio==3.4.3
5
  beautifulsoup4==4.11.1; python_full_version >= "3.6"
6
  cachetools==5.2.0; python_version >= "3.7" and python_version < "4.0"
7
- certifi==2022.6.15; 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"
9
  dnspython==2.2.1; python_version >= "3.6" and python_version < "4.0"
10
  google==3.0.0
11
  gpytranslate==1.4.0; python_version >= "3.6"
 
12
  lxml==4.9.1; python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.5.0"
13
  prettyconf==2.2.1
14
  pyaes==1.6.1; python_version >= "3.6" and python_version < "4.0"
 
4
  asyncio==3.4.3
5
  beautifulsoup4==4.11.1; 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"
9
  dnspython==2.2.1; python_version >= "3.6" and python_version < "4.0"
10
  google==3.0.0
11
  gpytranslate==1.4.0; python_version >= "3.6"
12
+ lyricsgenius==3.0.1
13
  lxml==4.9.1; python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.5.0"
14
  prettyconf==2.2.1
15
  pyaes==1.6.1; python_version >= "3.6" and python_version < "4.0"