Spaces:
Sleeping
Sleeping
Merge branch 'main' into dependabot/pip/sniffio-1.3.1
Browse files- .pre-commit-config.yaml +1 -1
- Powers/database/locks_db.py +1 -1
- Powers/plugins/dev.py +1 -0
- Powers/plugins/info.py +4 -5
- Powers/plugins/locks.py +1 -0
- Powers/plugins/stickers.py +2 -2
- Powers/plugins/web_con.py +1 -0
- Powers/utils/web_helpers.py +5 -2
- Powers/utils/web_scrapper.py +20 -3
- Procfile +1 -1
- requirements.txt +7 -6
.pre-commit-config.yaml
CHANGED
@@ -24,7 +24,7 @@ repos:
|
|
24 |
args: [--py36-plus]
|
25 |
|
26 |
- repo: https://github.com/asottile/pyupgrade
|
27 |
-
rev: v3.19.
|
28 |
hooks:
|
29 |
- id: pyupgrade
|
30 |
args: [--py36-plus]
|
|
|
24 |
args: [--py36-plus]
|
25 |
|
26 |
- repo: https://github.com/asottile/pyupgrade
|
27 |
+
rev: v3.19.1
|
28 |
hooks:
|
29 |
- id: pyupgrade
|
30 |
args: [--py36-plus]
|
Powers/database/locks_db.py
CHANGED
@@ -92,7 +92,7 @@ class LOCKS(MongoDB):
|
|
92 |
to_return["anti_fwd"]["user"] = True
|
93 |
elif i["locktype"] == "anti_fwd_c":
|
94 |
to_return["anti_fwd"]["chat"] = True
|
95 |
-
elif i["
|
96 |
to_return["anti_links"] = True
|
97 |
elif i["locktype"] == "bot":
|
98 |
to_return["bot"] = True
|
|
|
92 |
to_return["anti_fwd"]["user"] = True
|
93 |
elif i["locktype"] == "anti_fwd_c":
|
94 |
to_return["anti_fwd"]["chat"] = True
|
95 |
+
elif i["locktype"] == "anti_links":
|
96 |
to_return["anti_links"] = True
|
97 |
elif i["locktype"] == "bot":
|
98 |
to_return["bot"] = True
|
Powers/plugins/dev.py
CHANGED
@@ -720,6 +720,7 @@ __HELP__ = """
|
|
720 |
• /neofetch : Fetch neo.
|
721 |
• /eval : Evaluate the given python code.
|
722 |
• /exec : Execute the given code.
|
|
|
723 |
• /chatlist : Return the list of chats present in database
|
724 |
• /uptime : Return the uptime of the bot.
|
725 |
• /leavechat : Bot will leave the provided chat.
|
|
|
720 |
• /neofetch : Fetch neo.
|
721 |
• /eval : Evaluate the given python code.
|
722 |
• /exec : Execute the given code.
|
723 |
+
• /minfo [module name]: Give info about module
|
724 |
• /chatlist : Return the list of chats present in database
|
725 |
• /uptime : Return the uptime of the bot.
|
726 |
• /leavechat : Bot will leave the provided chat.
|
Powers/plugins/info.py
CHANGED
@@ -241,12 +241,11 @@ async def info_func(c: Gojo, message: Message):
|
|
241 |
return
|
242 |
try:
|
243 |
user, _, user_name = await extract_user(c, message)
|
244 |
-
except Exception:
|
245 |
-
await message.reply_text("Got Some errors failed to fetch user info")
|
246 |
LOGGER.error(e)
|
247 |
-
LOGGER.error(format_exc)
|
248 |
-
|
249 |
-
await message.reply_text("Can't find user to fetch info!")
|
250 |
|
251 |
m = await message.reply_text(
|
252 |
f"Fetching {f'@{user_name}' if user_name else 'user'} info from telegram's database..."
|
|
|
241 |
return
|
242 |
try:
|
243 |
user, _, user_name = await extract_user(c, message)
|
244 |
+
except Exception as e:
|
245 |
+
await message.reply_text(f"Got Some errors failed to fetch user info\n{e}")
|
246 |
LOGGER.error(e)
|
247 |
+
LOGGER.error(format_exc())
|
248 |
+
return
|
|
|
249 |
|
250 |
m = await message.reply_text(
|
251 |
f"Fetching {f'@{user_name}' if user_name else 'user'} info from telegram's database..."
|
Powers/plugins/locks.py
CHANGED
@@ -254,6 +254,7 @@ async def view_locks(_, m: Message):
|
|
254 |
<b>Can send links:</b> {vantil}
|
255 |
<b>Can bot send messages:</b> {vantibot}
|
256 |
"""
|
|
|
257 |
except RPCError as e_f:
|
258 |
await chkmsg.edit_text(text="Something went wrong!")
|
259 |
await m.reply_text(e_f)
|
|
|
254 |
<b>Can send links:</b> {vantil}
|
255 |
<b>Can bot send messages:</b> {vantibot}
|
256 |
"""
|
257 |
+
await chkmsg.edit_text(permission_view_str)
|
258 |
except RPCError as e_f:
|
259 |
await chkmsg.edit_text(text="Something went wrong!")
|
260 |
await m.reply_text(e_f)
|
Powers/plugins/stickers.py
CHANGED
@@ -276,7 +276,7 @@ async def memify_it(c: Gojo, m: Message):
|
|
276 |
kb = IKM(
|
277 |
[
|
278 |
[
|
279 |
-
IKB("
|
280 |
]
|
281 |
]
|
282 |
)
|
@@ -331,7 +331,7 @@ async def get_sticker_from_file(c: Gojo, m: Message):
|
|
331 |
if repl.sticker:
|
332 |
if repl.sticker.is_animated:
|
333 |
upp = await repl.download()
|
334 |
-
up = tgs_to_gif(upp, True)
|
335 |
await x.delete()
|
336 |
await m.reply_animation(up, caption=Caption)
|
337 |
elif repl.sticker.is_video:
|
|
|
276 |
kb = IKM(
|
277 |
[
|
278 |
[
|
279 |
+
IKB("You might like", url="https://t.me/me_and_ghost")
|
280 |
]
|
281 |
]
|
282 |
)
|
|
|
331 |
if repl.sticker:
|
332 |
if repl.sticker.is_animated:
|
333 |
upp = await repl.download()
|
334 |
+
up = await tgs_to_gif(upp, True)
|
335 |
await x.delete()
|
336 |
await m.reply_animation(up, caption=Caption)
|
337 |
elif repl.sticker.is_video:
|
Powers/plugins/web_con.py
CHANGED
@@ -304,6 +304,7 @@ async def download_instareels(c: Gojo, m: Message):
|
|
304 |
content = insta.get_media()
|
305 |
|
306 |
if content["code"] == 69 or content["message"] != "success":
|
|
|
307 |
return await m.reply_text(content["message"])
|
308 |
|
309 |
try:
|
|
|
304 |
content = insta.get_media()
|
305 |
|
306 |
if content["code"] == 69 or content["message"] != "success":
|
307 |
+
await to_edit.delete()
|
308 |
return await m.reply_text(content["message"])
|
309 |
|
310 |
try:
|
Powers/utils/web_helpers.py
CHANGED
@@ -140,7 +140,7 @@ async def song_search(query, max_results=1):
|
|
140 |
except Exception as e:
|
141 |
LOGGER.error(e)
|
142 |
LOGGER.error(format_exc())
|
143 |
-
return
|
144 |
nums = 1
|
145 |
for i in results["result"]:
|
146 |
durr = i['duration'].split(":")
|
@@ -169,7 +169,7 @@ async def song_search(query, max_results=1):
|
|
169 |
thumb = {"thumbnail": i["thumbnails"][0]["url"]}
|
170 |
except Exception:
|
171 |
thumb = {"thumbnail": None}
|
172 |
-
dict_form
|
173 |
yt_dict[nums] = dict_form
|
174 |
nums += 1
|
175 |
return yt_dict
|
@@ -226,6 +226,9 @@ async def youtube_downloader(c: Gojo, m: Message, query: str, type_: str):
|
|
226 |
ext = "mp4"
|
227 |
# ydl = yt_dlp.YoutubeDL(opts)
|
228 |
dicti = await song_search(query, 1)
|
|
|
|
|
|
|
229 |
if not dicti and type(dicti) != str:
|
230 |
await m.reply_text("File with duration less than or equals to 10 minutes is allowed only")
|
231 |
elif type(dicti) == str:
|
|
|
140 |
except Exception as e:
|
141 |
LOGGER.error(e)
|
142 |
LOGGER.error(format_exc())
|
143 |
+
return {0: e}
|
144 |
nums = 1
|
145 |
for i in results["result"]:
|
146 |
durr = i['duration'].split(":")
|
|
|
169 |
thumb = {"thumbnail": i["thumbnails"][0]["url"]}
|
170 |
except Exception:
|
171 |
thumb = {"thumbnail": None}
|
172 |
+
dict_form.update(thumb)
|
173 |
yt_dict[nums] = dict_form
|
174 |
nums += 1
|
175 |
return yt_dict
|
|
|
226 |
ext = "mp4"
|
227 |
# ydl = yt_dlp.YoutubeDL(opts)
|
228 |
dicti = await song_search(query, 1)
|
229 |
+
if err := dicti.get(0, None):
|
230 |
+
await m.reply_text(err)
|
231 |
+
return
|
232 |
if not dicti and type(dicti) != str:
|
233 |
await m.reply_text("File with duration less than or equals to 10 minutes is allowed only")
|
234 |
elif type(dicti) == str:
|
Powers/utils/web_scrapper.py
CHANGED
@@ -6,7 +6,6 @@ import httpx
|
|
6 |
|
7 |
from Powers import *
|
8 |
|
9 |
-
|
10 |
# import requests
|
11 |
# from selenium import webdriver
|
12 |
# from selenium.webdriver.chrome.options import Options
|
@@ -210,7 +209,8 @@ class SCRAP_DATA:
|
|
210 |
|
211 |
# else:
|
212 |
# return {}
|
213 |
-
|
|
|
214 |
|
215 |
class INSTAGRAM:
|
216 |
def __init__(self, url):
|
@@ -220,10 +220,27 @@ class INSTAGRAM:
|
|
220 |
return bool((re.compile(r"^https?://(?:www\.)?instagram\.com/")).match(self.url))
|
221 |
|
222 |
def get_media(self):
|
|
|
223 |
try:
|
224 |
return httpx.post(
|
225 |
-
f"https://api.qewertyy.dev/downloaders/instagram?url={self.url}"
|
|
|
226 |
).json()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
227 |
except Exception as e:
|
228 |
LOGGER.error(e)
|
229 |
LOGGER.error(format_exc())
|
|
|
6 |
|
7 |
from Powers import *
|
8 |
|
|
|
9 |
# import requests
|
10 |
# from selenium import webdriver
|
11 |
# from selenium.webdriver.chrome.options import Options
|
|
|
209 |
|
210 |
# else:
|
211 |
# return {}
|
212 |
+
curr_timeout = 20
|
213 |
+
timeout = httpx.Timeout(curr_timeout)
|
214 |
|
215 |
class INSTAGRAM:
|
216 |
def __init__(self, url):
|
|
|
220 |
return bool((re.compile(r"^https?://(?:www\.)?instagram\.com/")).match(self.url))
|
221 |
|
222 |
def get_media(self):
|
223 |
+
global curr_timeout
|
224 |
try:
|
225 |
return httpx.post(
|
226 |
+
f"https://api.qewertyy.dev/downloaders/instagram?url={self.url}",
|
227 |
+
timeout=timeout
|
228 |
).json()
|
229 |
+
except httpx.ReadTimeout:
|
230 |
+
try:
|
231 |
+
curr_timeout += 10
|
232 |
+
timeout = httpx.Timeout(curr_timeout)
|
233 |
+
return httpx.post(
|
234 |
+
f"https://api.qewertyy.dev/downloaders/instagram?url={self.url}",
|
235 |
+
timeout=timeout
|
236 |
+
).json()
|
237 |
+
except httpx.ReadTimeout:
|
238 |
+
return {"code": 69, "message": "Please retry after few seconds"}
|
239 |
+
except Exception as e:
|
240 |
+
LOGGER.error(e)
|
241 |
+
LOGGER.error(format_exc())
|
242 |
+
return {"code": 69, "message": e}
|
243 |
+
|
244 |
except Exception as e:
|
245 |
LOGGER.error(e)
|
246 |
LOGGER.error(format_exc())
|
Procfile
CHANGED
@@ -1 +1 @@
|
|
1 |
-
worker:
|
|
|
1 |
+
worker: python3 -m Powers
|
requirements.txt
CHANGED
@@ -1,25 +1,26 @@
|
|
1 |
-
aiofiles==
|
2 |
apscheduler==3.10.4
|
3 |
asyncio==3.4.3
|
4 |
beautifulsoup4==4.12.3
|
5 |
cachetools==5.2.0
|
6 |
captcha==0.6.0
|
7 |
-
certifi==2024.
|
8 |
charset-normalizer==3.4.0
|
9 |
dnspython==2.6.1
|
10 |
google==3.0.0
|
11 |
gpytranslate==1.5.1
|
12 |
-
httpx
|
13 |
lyricsgenius==3.0.1
|
14 |
pillow == 10.3.0
|
|
|
15 |
lxml==4.9.1
|
16 |
pillow == 10.3.0
|
17 |
prettyconf==2.2.1
|
18 |
pyaes==1.6.1
|
19 |
pymongo==4.6.3
|
20 |
-
git+https://github.com/KurimuzonAkuma/[email protected].
|
21 |
pysocks==1.7.1
|
22 |
-
python-dateutil==2.
|
23 |
pytube==15.0.0
|
24 |
pytz==2024.1
|
25 |
pyyaml==6.0.2
|
@@ -34,7 +35,7 @@ soupsieve==2.4
|
|
34 |
tgcrypto==1.2.5
|
35 |
tswift==0.7.0
|
36 |
typing-extensions
|
37 |
-
ujson==5.
|
38 |
Unidecode
|
39 |
wikipedia==1.4.0
|
40 |
youtube-search-python==1.6.6
|
|
|
1 |
+
aiofiles==24.1.0
|
2 |
apscheduler==3.10.4
|
3 |
asyncio==3.4.3
|
4 |
beautifulsoup4==4.12.3
|
5 |
cachetools==5.2.0
|
6 |
captcha==0.6.0
|
7 |
+
certifi==2024.12.14
|
8 |
charset-normalizer==3.4.0
|
9 |
dnspython==2.6.1
|
10 |
google==3.0.0
|
11 |
gpytranslate==1.5.1
|
12 |
+
httpx==0.27.2
|
13 |
lyricsgenius==3.0.1
|
14 |
pillow == 10.3.0
|
15 |
+
lottie==0.7.1
|
16 |
lxml==4.9.1
|
17 |
pillow == 10.3.0
|
18 |
prettyconf==2.2.1
|
19 |
pyaes==1.6.1
|
20 |
pymongo==4.6.3
|
21 |
+
git+https://github.com/KurimuzonAkuma/[email protected].34
|
22 |
pysocks==1.7.1
|
23 |
+
python-dateutil==2.9.0.post0
|
24 |
pytube==15.0.0
|
25 |
pytz==2024.1
|
26 |
pyyaml==6.0.2
|
|
|
35 |
tgcrypto==1.2.5
|
36 |
tswift==0.7.0
|
37 |
typing-extensions
|
38 |
+
ujson==5.10.0
|
39 |
Unidecode
|
40 |
wikipedia==1.4.0
|
41 |
youtube-search-python==1.6.6
|