diff --git a/Powers/plugins/dev.py b/Powers/plugins/dev.py index 536a95c2..1da043df 100644 --- a/Powers/plugins/dev.py +++ b/Powers/plugins/dev.py @@ -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. diff --git a/Powers/plugins/info.py b/Powers/plugins/info.py index 3a546491..095c87ab 100644 --- a/Powers/plugins/info.py +++ b/Powers/plugins/info.py @@ -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..." diff --git a/Powers/utils/web_scrapper.py b/Powers/utils/web_scrapper.py index 387e987b..29ff3fa5 100644 --- a/Powers/utils/web_scrapper.py +++ b/Powers/utils/web_scrapper.py @@ -209,8 +209,8 @@ def get_videos(self) -> list: # else: # return {} - -timeout = httpx.Timeout(20) +curr_timeout = 20 +timeout = httpx.Timeout(curr_timeout) class INSTAGRAM: def __init__(self, url): @@ -220,12 +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: - return self.get_media(self.url) + 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()) diff --git a/requirements.txt b/requirements.txt index a115077d..092a7d28 100644 --- a/requirements.txt +++ b/requirements.txt @@ -9,7 +9,7 @@ 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 @@ -18,7 +18,7 @@ pillow == 10.3.0 prettyconf==2.2.1 pyaes==1.6.1 pymongo==4.6.3 -git+https://github.com/KurimuzonAkuma/pyrogram.git@v2.1.32 +git+https://github.com/KurimuzonAkuma/pyrogram.git@v2.1.34 pysocks==1.7.1 python-dateutil==2.8.2 pytube==15.0.0