Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/pip/ujson-5.10.0
Browse files Browse the repository at this point in the history
  • Loading branch information
iamgojoof6eyes authored Jan 3, 2025
2 parents 51406da + 55ff5de commit 2eacf69
Show file tree
Hide file tree
Showing 11 changed files with 42 additions and 19 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ repos:
args: [--py36-plus]

- repo: https://github.com/asottile/pyupgrade
rev: v3.19.0
rev: v3.19.1
hooks:
- id: pyupgrade
args: [--py36-plus]
Expand Down
2 changes: 1 addition & 1 deletion Powers/database/locks_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def get_lock_channel(self, chat: int, locktype: str = "all"):
to_return["anti_fwd"]["user"] = True
elif i["locktype"] == "anti_fwd_c":
to_return["anti_fwd"]["chat"] = True
elif i["anti_links"] == "anti_links":
elif i["locktype"] == "anti_links":
to_return["anti_links"] = True
elif i["locktype"] == "bot":
to_return["bot"] = True
Expand Down
1 change: 1 addition & 0 deletions Powers/plugins/dev.py
Original file line number Diff line number Diff line change
Expand Up @@ -720,6 +720,7 @@ async def forward_type_broadcast(c: Gojo, m: Message):
• /neofetch : Fetch neo.
• /eval : Evaluate the given python code.
• /exec : Execute the given code.
• /minfo [module name]: Give info about module
• /chatlist : Return the list of chats present in database
• /uptime : Return the uptime of the bot.
• /leavechat : Bot will leave the provided chat.
Expand Down
9 changes: 4 additions & 5 deletions Powers/plugins/info.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,12 +241,11 @@ async def info_func(c: Gojo, message: Message):
return
try:
user, _, user_name = await extract_user(c, message)
except Exception:
await message.reply_text("Got Some errors failed to fetch user info")
except Exception as e:
await message.reply_text(f"Got Some errors failed to fetch user info\n{e}")
LOGGER.error(e)
LOGGER.error(format_exc)
if not user:
await message.reply_text("Can't find user to fetch info!")
LOGGER.error(format_exc())
return

m = await message.reply_text(
f"Fetching {f'@{user_name}' if user_name else 'user'} info from telegram's database..."
Expand Down
1 change: 1 addition & 0 deletions Powers/plugins/locks.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,7 @@ async def convert_to_emoji(val: bool):
<b>Can send links:</b> {vantil}
<b>Can bot send messages:</b> {vantibot}
"""
await chkmsg.edit_text(permission_view_str)
except RPCError as e_f:
await chkmsg.edit_text(text="Something went wrong!")
await m.reply_text(e_f)
Expand Down
4 changes: 2 additions & 2 deletions Powers/plugins/stickers.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ async def memify_it(c: Gojo, m: Message):
kb = IKM(
[
[
IKB("Join for memes", url="https://t.me/memesofdank")
IKB("You might like", url="https://t.me/me_and_ghost")
]
]
)
Expand Down Expand Up @@ -331,7 +331,7 @@ async def get_sticker_from_file(c: Gojo, m: Message):
if repl.sticker:
if repl.sticker.is_animated:
upp = await repl.download()
up = tgs_to_gif(upp, True)
up = await tgs_to_gif(upp, True)
await x.delete()
await m.reply_animation(up, caption=Caption)
elif repl.sticker.is_video:
Expand Down
1 change: 1 addition & 0 deletions Powers/plugins/web_con.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,7 @@ async def download_instareels(c: Gojo, m: Message):
content = insta.get_media()

if content["code"] == 69 or content["message"] != "success":
await to_edit.delete()
return await m.reply_text(content["message"])

try:
Expand Down
7 changes: 5 additions & 2 deletions Powers/utils/web_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ async def song_search(query, max_results=1):
except Exception as e:
LOGGER.error(e)
LOGGER.error(format_exc())
return yt_dict
return {0: e}
nums = 1
for i in results["result"]:
durr = i['duration'].split(":")
Expand Down Expand Up @@ -169,7 +169,7 @@ async def song_search(query, max_results=1):
thumb = {"thumbnail": i["thumbnails"][0]["url"]}
except Exception:
thumb = {"thumbnail": None}
dict_form |= thumb
dict_form.update(thumb)
yt_dict[nums] = dict_form
nums += 1
return yt_dict
Expand Down Expand Up @@ -226,6 +226,9 @@ async def youtube_downloader(c: Gojo, m: Message, query: str, type_: str):
ext = "mp4"
# ydl = yt_dlp.YoutubeDL(opts)
dicti = await song_search(query, 1)
if err := dicti.get(0, None):
await m.reply_text(err)
return
if not dicti and type(dicti) != str:
await m.reply_text("File with duration less than or equals to 10 minutes is allowed only")
elif type(dicti) == str:
Expand Down
23 changes: 20 additions & 3 deletions Powers/utils/web_scrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

from Powers import *


# import requests
# from selenium import webdriver
# from selenium.webdriver.chrome.options import Options
Expand Down Expand Up @@ -210,7 +209,8 @@ def get_videos(self) -> list:

# else:
# return {}

curr_timeout = 20
timeout = httpx.Timeout(curr_timeout)

class INSTAGRAM:
def __init__(self, url):
Expand All @@ -220,10 +220,27 @@ def is_correct_url(self):
return bool((re.compile(r"^https?://(?:www\.)?instagram\.com/")).match(self.url))

def get_media(self):
global curr_timeout
try:
return httpx.post(
f"https://api.qewertyy.dev/downloaders/instagram?url={self.url}"
f"https://api.qewertyy.dev/downloaders/instagram?url={self.url}",
timeout=timeout
).json()
except httpx.ReadTimeout:
try:
curr_timeout += 10
timeout = httpx.Timeout(curr_timeout)
return httpx.post(
f"https://api.qewertyy.dev/downloaders/instagram?url={self.url}",
timeout=timeout
).json()
except httpx.ReadTimeout:
return {"code": 69, "message": "Please retry after few seconds"}
except Exception as e:
LOGGER.error(e)
LOGGER.error(format_exc())
return {"code": 69, "message": e}

except Exception as e:
LOGGER.error(e)
LOGGER.error(format_exc())
Expand Down
2 changes: 1 addition & 1 deletion Procfile
Original file line number Diff line number Diff line change
@@ -1 +1 @@
worker: pip install --upgrade pip setuptools wheel && pip install -r requirements.txt && python3 -m Powers
worker: python3 -m Powers
9 changes: 5 additions & 4 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
aiofiles==23.2.1
aiofiles==24.1.0
apscheduler==3.10.4
asyncio==3.4.3
beautifulsoup4==4.12.3
cachetools==5.2.0
captcha==0.6.0
certifi==2024.7.4
certifi==2024.12.14
charset-normalizer==3.4.0
dnspython==2.6.1
google==3.0.0
gpytranslate==1.5.1
httpx
httpx==0.27.2
lyricsgenius==3.0.1
pillow == 10.3.0
lottie==0.7.1
lxml==4.9.1
pillow == 10.3.0
prettyconf==2.2.1
pyaes==1.6.1
pymongo==4.6.3
git+https://github.com/KurimuzonAkuma/[email protected].32
git+https://github.com/KurimuzonAkuma/[email protected].34
pysocks==1.7.1
python-dateutil==2.8.2
pytube==15.0.0
Expand Down

0 comments on commit 2eacf69

Please sign in to comment.