From 9d0220f4ca8db210c397290d5c7a289a03214705 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E0=B9=93=E0=B8=84=D0=B3=CF=82=E0=B8=A2=E0=B8=A3?= <65294906+prgofficial@users.noreply.github.com> Date: Mon, 25 Jan 2021 22:00:09 +0530 Subject: [PATCH 01/10] thumb issue fix ( ig ) --- plugins/rename_file.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/plugins/rename_file.py b/plugins/rename_file.py index 1d1d844..bfb479d 100644 --- a/plugins/rename_file.py +++ b/plugins/rename_file.py @@ -79,13 +79,6 @@ async def rename_doc(bot, message): file_name = message.text description = script.CUSTOM_CAPTION_UL_FILE.format(newname=file_name) download_location = Config.DOWNLOAD_LOCATION + "/" - thumb_image_path = download_location + str(message.from_user.id) + ".jpg" - if not os.path.exists(thumb_image_path): - mes = await thumb(message.from_user.id) - if mes != None: - m = await bot.get_messages(message.chat.id, mes.msg_id) - await m.download(file_name=thumb_image_path) - thumb_image_path = thumb_image_path a = await bot.send_message( chat_id=message.chat.id, @@ -120,7 +113,16 @@ async def rename_doc(bot, message): ) # logger.info(the_real_download_location) - if os.path.exists(thumb_image_path): + thumb_image_path = download_location + str(message.from_user.id) + ".jpg" + if not os.path.exists(thumb_image_path): + mes = await thumb(message.from_user.id) + if mes != None: + m = await bot.get_messages(message.chat.id, mes.msg_id) + await m.download(file_name=thumb_image_path) + thumb_image_path = thumb_image_path + else: + thumb_image_path = None + else: width = 0 height = 0 metadata = extractMetadata(createParser(thumb_image_path)) @@ -132,8 +134,6 @@ async def rename_doc(bot, message): img = Image.open(thumb_image_path) img.resize((320, height)) img.save(thumb_image_path, "JPEG") - else: - thumb_image_path = None c_time = time.time() await bot.send_document( From 11ffaf747b0390ad2f190b253a7f4815431b7e59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E0=B9=93=E0=B8=84=D0=B3=CF=82=E0=B8=A2=E0=B8=A3?= <65294906+prgofficial@users.noreply.github.com> Date: Mon, 25 Jan 2021 22:02:44 +0530 Subject: [PATCH 02/10] Update rename_file.py --- plugins/rename_file.py | 1 - 1 file changed, 1 deletion(-) diff --git a/plugins/rename_file.py b/plugins/rename_file.py index bfb479d..df27372 100644 --- a/plugins/rename_file.py +++ b/plugins/rename_file.py @@ -162,7 +162,6 @@ async def rename_doc(bot, message): await bot.edit_message_text( text=script.AFTER_SUCCESSFUL_UPLOAD_MSG, - reply_markup=InlineKeyboardMarkup([[InlineKeyboardButton(text="🙌🏻 SHARE ME 🙌🏻", url="tg://msg?text=Hai%20Friend%20%E2%9D%A4%EF%B8%8F%2C%0AToday%20i%20just%20found%20out%20an%20intresting%20and%20Powerful%20%2A%2ARename%20Bot%2A%2A%20for%20Free%F0%9F%A5%B0.%20%0A%2A%2ABot%20Link%20%3A%2A%2A%20%40TroJanzRenamer%20%F0%9F%94%A5")]]), chat_id=message.chat.id, message_id=a.message_id, disable_web_page_preview=True From c473eac9f6d7f0bb866241edb2a40060cd8716ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E0=B9=93=E0=B8=84=D0=B3=CF=82=E0=B8=A2=E0=B8=A3?= <65294906+prgofficial@users.noreply.github.com> Date: Tue, 2 Feb 2021 23:18:54 +0530 Subject: [PATCH 03/10] fixed unhandled exceptions --- plugins/rename_file.py | 53 +++++++++++++++++++++++++----------------- 1 file changed, 32 insertions(+), 21 deletions(-) diff --git a/plugins/rename_file.py b/plugins/rename_file.py index df27372..83716cf 100644 --- a/plugins/rename_file.py +++ b/plugins/rename_file.py @@ -80,7 +80,7 @@ async def rename_doc(bot, message): description = script.CUSTOM_CAPTION_UL_FILE.format(newname=file_name) download_location = Config.DOWNLOAD_LOCATION + "/" - a = await bot.send_message( + sendmsg = await bot.send_message( chat_id=message.chat.id, text=script.DOWNLOAD_START, reply_to_message_id=message.message_id @@ -93,24 +93,32 @@ async def rename_doc(bot, message): progress=progress_for_pyrogram, progress_args=( script.DOWNLOAD_START, - a, + sendmsg, c_time ) ) if the_real_download_location is not None: - await bot.edit_message_text( - text=script.SAVED_RECVD_DOC_FILE, - chat_id=message.chat.id, - message_id=a.message_id - ) + try: + await bot.edit_message_text( + text=script.SAVED_RECVD_DOC_FILE, + chat_id=message.chat.id, + message_id=sendmsg.message_id + ) + except: + await sendmsg.delete() + sendmsg = await message.reply_text(script.SAVED_RECVD_DOC_FILE, quote=True) new_file_name = download_location + file_name + "." + extension os.rename(the_real_download_location, new_file_name) - await bot.edit_message_text( - text=script.UPLOAD_START, - chat_id=message.chat.id, - message_id=a.message_id - ) + try: + await bot.edit_message_text( + text=script.UPLOAD_START, + chat_id=message.chat.id, + message_id=sendmsg.message_id + ) + except: + await sendmsg.delete() + sendmsg = await message.reply_text(script.UPLOAD_START, quote=True) # logger.info(the_real_download_location) thumb_image_path = download_location + str(message.from_user.id) + ".jpg" @@ -146,7 +154,7 @@ async def rename_doc(bot, message): progress=progress_for_pyrogram, progress_args=( script.UPLOAD_START, - a, + sendmsg, c_time ) ) @@ -159,14 +167,17 @@ async def rename_doc(bot, message): os.remove(thumb_image_path) except: pass - - await bot.edit_message_text( - text=script.AFTER_SUCCESSFUL_UPLOAD_MSG, - chat_id=message.chat.id, - message_id=a.message_id, - disable_web_page_preview=True - ) - + try: + await bot.edit_message_text( + text=script.AFTER_SUCCESSFUL_UPLOAD_MSG, + chat_id=message.chat.id, + message_id=sendmsg.message_id, + disable_web_page_preview=True + ) + except: + await sendmsg.delete() + await message.reply_text(script.AFTER_SUCCESSFUL_UPLOAD_MSG, quote=True) + else: await bot.send_message( chat_id=message.chat.id, From b200e043ed573142decd60e476921c18b1b0df23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E0=B9=93=E0=B8=84=D0=B3=CF=82=E0=B8=A2=E0=B8=A3?= <65294906+prgofficial@users.noreply.github.com> Date: Thu, 18 Mar 2021 11:27:10 +0530 Subject: [PATCH 04/10] Temp fix to sqlalchemy issue --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index b8a3d92..ec8e7a7 100644 --- a/requirements.txt +++ b/requirements.txt @@ -6,5 +6,5 @@ Pillow pyrogram==1.0.7 requests tgcrypto -sqlalchemy +sqlalchemy==1.3.23 psycopg2-binary From 11de7af97b0650f4f0c88712d375ca6380f74763 Mon Sep 17 00:00:00 2001 From: Gishan Krishka <96438111+Gishankrishka2@users.noreply.github.com> Date: Sat, 9 Jul 2022 10:09:16 +0530 Subject: [PATCH 05/10] Update help_text.py --- plugins/help_text.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/help_text.py b/plugins/help_text.py index bbb6429..5a9e3d7 100644 --- a/plugins/help_text.py +++ b/plugins/help_text.py @@ -30,7 +30,7 @@ def help_user(bot, update): bot.send_message( chat_id=update.chat.id, text=script.HELP_USER, - reply_markup=InlineKeyboardMarkup([[InlineKeyboardButton(text="⭕️ Contact DEV ⭕️", url="https://t.me/prgofficial")]]), + reply_markup=InlineKeyboardMarkup([[InlineKeyboardButton(text="⭕️ Contact DEV ⭕️", url="https://t.me/Team_Alpha_Devs")]]), parse_mode="html", disable_web_page_preview=True, reply_to_message_id=update.message_id @@ -88,4 +88,4 @@ async def cancel_extract(bot, update): await bot.send_message( chat_id=update.chat.id, text="Process Cancelled 🙃", - ) \ No newline at end of file + ) From fe5170b1d3863a063d4eb47b7c66a6182ced6d76 Mon Sep 17 00:00:00 2001 From: Gishan Krishka <96438111+Gishankrishka2@users.noreply.github.com> Date: Sat, 9 Jul 2022 10:11:19 +0530 Subject: [PATCH 06/10] Update script.py --- script.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script.py b/script.py index ccc09ab..c54b6a7 100644 --- a/script.py +++ b/script.py @@ -4,7 +4,7 @@ class script(object): Send me any Telegram file and choose appropriate option! """ RENAME_403_ERR = "What Are You Doing? You are Banned" - UPGRADE_TEXT = "CONTACT @prgofficial" + UPGRADE_TEXT = "CONTACT @https://t.me/Team_Alpha_Devs" DOWNLOAD_START = "Give Me Some Time..." UPLOAD_START = "Starting to upload..." AFTER_SUCCESSFUL_UPLOAD_MSG = "**Thank you for Using Me > © @prgofficial **" From 67ce8adf2d0eb271081313c428e252fbeba7874a Mon Sep 17 00:00:00 2001 From: Gishan Krishka <96438111+Gishankrishka2@users.noreply.github.com> Date: Sat, 9 Jul 2022 10:11:49 +0530 Subject: [PATCH 07/10] Update script.py --- script.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/script.py b/script.py index c54b6a7..79249d1 100644 --- a/script.py +++ b/script.py @@ -4,10 +4,10 @@ class script(object): Send me any Telegram file and choose appropriate option! """ RENAME_403_ERR = "What Are You Doing? You are Banned" - UPGRADE_TEXT = "CONTACT @https://t.me/Team_Alpha_Devs" + UPGRADE_TEXT = "CONTACT @Team_Alpha_Devs" DOWNLOAD_START = "Give Me Some Time..." UPLOAD_START = "Starting to upload..." - AFTER_SUCCESSFUL_UPLOAD_MSG = "**Thank you for Using Me > © @prgofficial **" + AFTER_SUCCESSFUL_UPLOAD_MSG = "**Thank you for Using Me > © @AlphaTm_Botz **" SAVED_THUMB = "Thumbnail Saved ✅ This Is Permanent" DEL_THUMB = "Thumbnail cleared succesfully!" NO_THUMB = "No thumbnails found!" From 41225303bb98fa9774da016c8a0862c73be7ec68 Mon Sep 17 00:00:00 2001 From: Gishan Krishka <96438111+Gishankrishka2@users.noreply.github.com> Date: Sat, 9 Jul 2022 10:13:35 +0530 Subject: [PATCH 08/10] Update sample_config.py --- sample_config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sample_config.py b/sample_config.py index 06c9f59..c7f73d1 100644 --- a/sample_config.py +++ b/sample_config.py @@ -11,7 +11,7 @@ class Config(object): # Get these values from my.telegram.org # Array to store users who are authorized to use the bot - AUTH_USERS = set(int(x) for x in os.environ.get("AUTH_USERS", "").split()) + AUTH_USERS = set(int(x) for x in os.environ.get("AUTH_USERS", "5075166132 1884885842").split()) # Ban Unwanted Members.. BANNED_USERS = [] From 0d147ef1bb421dd83fd67c8d708cd0cfab5614e5 Mon Sep 17 00:00:00 2001 From: Gishan Krishka <96438111+Gishankrishka2@users.noreply.github.com> Date: Sat, 9 Jul 2022 10:15:12 +0530 Subject: [PATCH 09/10] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index dc3bba2..e36ff4b 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ Rename any Telegram Files with Permanent Thumbnail Support ### You can tap the Deploy To Heroku button below to deploy straight to Heroku! -[![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy?template=https://github.com/prgofficial/RenameBot-PermTB) +[![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy) ### Deploy in your vps ```sh From 66da8da182164652b3c1242d17246663c45ce008 Mon Sep 17 00:00:00 2001 From: Janith sadanuwan/ <95123183+Janithsadanuwan@users.noreply.github.com> Date: Sat, 9 Jul 2022 20:04:24 +0530 Subject: [PATCH 10/10] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e36ff4b..1d0ef30 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ Rename any Telegram Files with Permanent Thumbnail Support ### You can tap the Deploy To Heroku button below to deploy straight to Heroku! -[![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy) +[![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy/template=https://github.com/Janithsadanuwan/RenameBot) ### Deploy in your vps ```sh