From b563af8ac49f19aff62504244e7930017cdc4055 Mon Sep 17 00:00:00 2001
From: Kannada-bot <57821193+Kannada-bot@users.noreply.github.com>
Date: Mon, 11 May 2020 22:52:04 +0530
Subject: [PATCH 01/36] Start
---
translation.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/translation.py b/translation.py
index 76a195fca..d68ac48a0 100644
--- a/translation.py
+++ b/translation.py
@@ -7,7 +7,7 @@ class Translation(object):
/help for more details..
Support Group : @InFoTelGroup
-© @SpEcHlDe , @TGBotsZ & @CWProjects"""
+"""
RENAME_403_ERR = "Sorry. You are not permitted to rename this file."
ABS_TEXT = " Please don't be selfish."
UPGRADE_TEXT = "👉 Create own Clone Bot.. /help for Details"
From 88f14b87b70962caecaa2507ee1adb24ba4f9976 Mon Sep 17 00:00:00 2001
From: Kannada-bot <57821193+Kannada-bot@users.noreply.github.com>
Date: Mon, 11 May 2020 22:54:53 +0530
Subject: [PATCH 02/36] Start
---
translation.py | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/translation.py b/translation.py
index d68ac48a0..02cb63f72 100644
--- a/translation.py
+++ b/translation.py
@@ -6,11 +6,11 @@ class Translation(object):
/help for more details..
-Support Group : @InFoTelGroup
+Support Group : @NMbotsZ
"""
RENAME_403_ERR = "Sorry. You are not permitted to rename this file."
ABS_TEXT = " Please don't be selfish."
- UPGRADE_TEXT = "👉 Create own Clone Bot.. /help for Details"
+ UPGRADE_TEXT = " /help for Details"
FORMAT_SELECTION = "Select the desired format: file size might be approximate \nIf you want to set custom thumbnail, send photo before or quickly after tapping on any of the below buttons.\nYou can use /deletethumbnail to delete the auto-generated thumbnail."
SET_CUSTOM_USERNAME_PASSWORD = """If you want to download premium videos, provide in the following format:
URL | filename | username | password"""
@@ -19,8 +19,8 @@ class Translation(object):
UPLOAD_START = "trying to upload"
RCHD_BOT_API_LIMIT = "size greater than maximum allowed size (50MB). Neverthless, trying to upload."
RCHD_TG_API_LIMIT = "Downloaded in {} seconds.\nDetected File Size: {}\nSorry. But, I cannot upload files greater than 1.5GB due to Telegram API limitations."
- AFTER_SUCCESSFUL_UPLOAD_MSG = "Please rate me if you find me useful. Join : @TGBotsZ"
- AFTER_SUCCESSFUL_UPLOAD_MSG_WITH_TS = "Downloaded in {} seconds. \nJoin : @TGBotsZ \nUploaded in {} seconds."
+ AFTER_SUCCESSFUL_UPLOAD_MSG = "Please rate me if you find me useful. Join : @NMBotsZ"
+ AFTER_SUCCESSFUL_UPLOAD_MSG_WITH_TS = "Downloaded in {} seconds. \nJoin : @NMBotsZ \nUploaded in {} seconds."
NOT_AUTH_USER_TEXT = "Please /upgrade your subscription."
NOT_AUTH_USER_TEXT_FILE_SIZE = "Detected File Size: {}. Free Users can only upload: {}\nPlease /upgrade your subscription.\nIf you think this is a bug, please contact @SpEcHlDe"
SAVED_CUSTOM_THUMB_NAIL = "Custom video / file thumbnail saved. This image will be used in the video / file."
@@ -34,7 +34,7 @@ class Translation(object):
CURENT_PLAN_DETAILS = """Current plan details
--------
Telegram ID: {}
-Plan name: Free Cloned User
+Plan Free User
Expires on: 31/12/2020"""
HELP_USER = """Hai am URL Uploader bot..
@@ -51,8 +51,8 @@ class Translation(object):
--------
Send /me to know current plan details
-Support Group : @InFoTelGroup
-© @TGBotsZ & @CWProjects"""
+Support Group : @NMBotsZ
+"""
REPLY_TO_DOC_GET_LINK = "Reply to a Telegram media to get High Speed Direct Download Link"
REPLY_TO_DOC_FOR_C2V = "Reply to a Telegram media to convert"
REPLY_TO_DOC_FOR_SCSS = "Reply to a Telegram media to get screenshots"
From 3d17966735e2cdcde34d641d342243a59fab66d3 Mon Sep 17 00:00:00 2001
From: Kannada-bot <57821193+Kannada-bot@users.noreply.github.com>
Date: Mon, 11 May 2020 22:55:51 +0530
Subject: [PATCH 03/36] START
---
translation.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/translation.py b/translation.py
index 02cb63f72..0011d37e9 100644
--- a/translation.py
+++ b/translation.py
@@ -46,7 +46,7 @@ class Translation(object):
Video - Give File as video without Screenshots
DFile - Give File without Screenshots
-👉 Create own Clone Bot : 👉 Diploy
+Join: @NMBotsZ
--------
Send /me to know current plan details
From 0f1a58f5310d90203a10ad6552aa6f51ed9eeaea Mon Sep 17 00:00:00 2001
From: Kannada-bot <57821193+Kannada-bot@users.noreply.github.com>
Date: Sat, 16 May 2020 23:51:24 +0530
Subject: [PATCH 04/36] Update youtube_dl_button.py
---
plugins/youtube_dl_button.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/plugins/youtube_dl_button.py b/plugins/youtube_dl_button.py
index 706a0615f..71b1cb805 100644
--- a/plugins/youtube_dl_button.py
+++ b/plugins/youtube_dl_button.py
@@ -322,7 +322,7 @@ async def youtube_dl_call_back(bot, update):
media_album_p = []
if images is not None:
i = 0
- caption = "© @TGBotsZ"
+ caption = "© @NMBotsZ"
if is_w_f:
caption = "/upgrade to Plan D to remove the watermark\n© @AnyDLBot"
for image in images:
From d93cebf1765c6620963b3327d17d0253bce02ea7 Mon Sep 17 00:00:00 2001
From: Kannada-bot <57821193+Kannada-bot@users.noreply.github.com>
Date: Sun, 17 May 2020 19:01:32 +0530
Subject: [PATCH 05/36] Rename_file.py
---
plugins/Rename_file.py | 150 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 150 insertions(+)
create mode 100644 plugins/Rename_file.py
diff --git a/plugins/Rename_file.py b/plugins/Rename_file.py
new file mode 100644
index 000000000..16267d62e
--- /dev/null
+++ b/plugins/Rename_file.py
@@ -0,0 +1,150 @@
+#!/usr/bin/env python3
+# -*- coding: utf-8 -*-
+# (c) Shrimadhav U K
+
+# the logging things
+import logging
+logging.basicConfig(level=logging.DEBUG,
+ format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
+logger = logging.getLogger(__name__)
+
+import os
+import time
+
+# the secret configuration specific things
+if bool(os.environ.get("WEBHOOK", False)):
+ from sample_config import Config
+else:
+ from config import Config
+
+# the Strings used for this "thing"
+from translation import Translation
+
+import pyrogram
+logging.getLogger("pyrogram").setLevel(logging.WARNING)
+from pyrogram import Client, Filters
+
+from helper_funcs.chat_base import TRChatBase
+from helper_funcs.display_progress import progress_for_pyrogram
+
+from hachoir.metadata import extractMetadata
+from hachoir.parser import createParser
+# https://stackoverflow.com/a/37631799/4723940
+from PIL import Image
+
+
+@pyrogram.Client.on_message(pyrogram.Filters.command(["rename"]))
+async def rename_doc(bot, update):
+ if update.from_user.id in Config.BANNED_USERS:
+ await bot.delete_messages(
+ chat_id=update.chat.id,
+ message_ids=update.message_id,
+ revoke=True
+ )
+ return
+ TRChatBase(update.from_user.id, update.text, "rename")
+ if (" " in update.text) and (update.reply_to_message is not None):
+ cmd, file_name = update.text.split(" ", 1)
+ if len(file_name) > 64:
+ await update.reply_text(
+ Translation.IFLONG_FILE_NAME.format(
+ alimit="64",
+ num=len(file_name)
+ )
+ )
+ return
+ description = Translation.CUSTOM_CAPTION_UL_FILE
+ download_location = Config.DOWNLOAD_LOCATION + "/"
+ a = await bot.send_message(
+ chat_id=update.chat.id,
+ text=Translation.DOWNLOAD_START,
+ reply_to_message_id=update.message_id
+ )
+ c_time = time.time()
+ the_real_download_location = await bot.download_media(
+ message=update.reply_to_message,
+ file_name=download_location,
+ progress=progress_for_pyrogram,
+ progress_args=(
+ Translation.DOWNLOAD_START,
+ a,
+ c_time
+ )
+ )
+ if the_real_download_location is not None:
+ try:
+ await bot.edit_message_text(
+ text=Translation.SAVED_RECVD_DOC_FILE,
+ chat_id=update.chat.id,
+ message_id=a.message_id
+ )
+ except:
+ pass
+ if "IndianMovie" in the_real_download_location:
+ await bot.edit_message_text(
+ text=Translation.RENAME_403_ERR,
+ chat_id=update.chat.id,
+ message_id=a.message_id
+ )
+ return
+ new_file_name = download_location + file_name
+ os.rename(the_real_download_location, new_file_name)
+ await bot.edit_message_text(
+ text=Translation.UPLOAD_START,
+ chat_id=update.chat.id,
+ message_id=a.message_id
+ )
+ logger.info(the_real_download_location)
+ thumb_image_path = Config.DOWNLOAD_LOCATION + "/" + str(update.from_user.id) + ".jpg"
+ if not os.path.exists(thumb_image_path):
+ thumb_image_path = None
+ else:
+ width = 0
+ height = 0
+ metadata = extractMetadata(createParser(thumb_image_path))
+ if metadata.has("width"):
+ width = metadata.get("width")
+ if metadata.has("height"):
+ height = metadata.get("height")
+ # resize image
+ # ref: https://t.me/PyrogramChat/44663
+ # https://stackoverflow.com/a/21669827/4723940
+ Image.open(thumb_image_path).convert("RGB").save(thumb_image_path)
+ img = Image.open(thumb_image_path)
+ # https://stackoverflow.com/a/37631799/4723940
+ # img.thumbnail((90, 90))
+ img.resize((320, height))
+ img.save(thumb_image_path, "JPEG")
+ # https://pillow.readthedocs.io/en/3.1.x/reference/Image.html#create-thumbnails
+ c_time = time.time()
+ await bot.send_document(
+ chat_id=update.chat.id,
+ document=new_file_name,
+ thumb=thumb_image_path,
+ caption=description,
+ # reply_markup=reply_markup,
+ reply_to_message_id=update.reply_to_message.message_id,
+ progress=progress_for_pyrogram,
+ progress_args=(
+ Translation.UPLOAD_START,
+ a,
+ c_time
+ )
+ )
+ try:
+ os.remove(new_file_name)
+ os.remove(thumb_image_path)
+ except:
+ pass
+ await bot.edit_message_text(
+ text=Translation.AFTER_SUCCESSFUL_UPLOAD_MSG,
+ chat_id=update.chat.id,
+ message_id=a.message_id,
+ disable_web_page_preview=True
+ )
+ else:
+ await bot.send_message(
+ chat_id=update.chat.id,
+ text=Translation.REPLY_TO_DOC_FOR_RENAME_FILE,
+ reply_to_message_id=update.message_id
+ )
From 97e35c20884b421782d193913ff2dc3254b93279 Mon Sep 17 00:00:00 2001
From: Kannada-bot <57821193+Kannada-bot@users.noreply.github.com>
Date: Sun, 17 May 2020 19:05:08 +0530
Subject: [PATCH 06/36] Start
---
translation.py | 3 +++
1 file changed, 3 insertions(+)
diff --git a/translation.py b/translation.py
index 0011d37e9..73f555425 100644
--- a/translation.py
+++ b/translation.py
@@ -2,8 +2,11 @@ class Translation(object):
START_TEXT = """Hello,
This is a Telegram URL Upload Bot!
+
Please send me any direct download URL Link, i can upload to telegram as File/Video
+And I Can Also Rename Telegram Files
+
/help for more details..
Support Group : @NMbotsZ
From acb2589d281fc46c00f3b81663360e8cc170a74d Mon Sep 17 00:00:00 2001
From: Kannada-bot <57821193+Kannada-bot@users.noreply.github.com>
Date: Sun, 17 May 2020 19:06:18 +0530
Subject: [PATCH 07/36] Start
---
translation.py | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/translation.py b/translation.py
index 73f555425..de6b2ef97 100644
--- a/translation.py
+++ b/translation.py
@@ -5,8 +5,10 @@ class Translation(object):
Please send me any direct download URL Link, i can upload to telegram as File/Video
-And I Can Also Rename Telegram Files
+And I Can Also Rename Telegram Files...
+1. Send me any Telegram File.
+2. Reply to that message to /rename new name.extension.
/help for more details..
Support Group : @NMbotsZ
From c813da3530758e95e866aee89e2195c9c5643b49 Mon Sep 17 00:00:00 2001
From: Kannada-bot <57821193+Kannada-bot@users.noreply.github.com>
Date: Mon, 18 May 2020 08:45:54 +0530
Subject: [PATCH 08/36] Create FFMpegRoBot.py
---
plugins/FFMpegRoBot.py | 264 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 264 insertions(+)
create mode 100644 plugins/FFMpegRoBot.py
diff --git a/plugins/FFMpegRoBot.py b/plugins/FFMpegRoBot.py
new file mode 100644
index 000000000..d5f8f2e77
--- /dev/null
+++ b/plugins/FFMpegRoBot.py
@@ -0,0 +1,264 @@
+#!/usr/bin/env python3
+# -*- coding: utf-8 -*-
+# (c) Shrimadhav U K
+
+# the logging things
+import logging
+logging.basicConfig(level=logging.DEBUG,
+ format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
+logger = logging.getLogger(__name__)
+
+import os
+import time
+
+# the secret configuration specific things
+if bool(os.environ.get("WEBHOOK", False)):
+ from sample_config import Config
+else:
+ from config import Config
+
+# the Strings used for this "thing"
+from translation import Translation
+
+import pyrogram
+logging.getLogger("pyrogram").setLevel(logging.WARNING)
+
+from helper_funcs.chat_base import TRChatBase
+from helper_funcs.display_progress import progress_for_pyrogram
+from helper_funcs.help_Nekmo_ffmpeg import take_screen_shot, cult_small_video
+
+from hachoir.metadata import extractMetadata
+from hachoir.parser import createParser
+
+
+@pyrogram.Client.on_message(pyrogram.Filters.command(["ffmpegrobot"]))
+async def ffmpegrobot_ad(bot, update):
+ if update.from_user.id not in Config.AUTH_USERS:
+ await bot.delete_messages(
+ chat_id=update.chat.id,
+ message_ids=update.message_id,
+ revoke=True
+ )
+ return
+ TRChatBase(update.from_user.id, update.text, "ffmpegrobot")
+ await bot.send_message(
+ chat_id=update.chat.id,
+ text=Translation.FF_MPEG_RO_BOT_AD_VER_TISE_MENT,
+ disable_web_page_preview=True,
+ reply_to_message_id=update.message_id
+ )
+
+
+@pyrogram.Client.on_message(pyrogram.Filters.command(["trim"]))
+async def trim(bot, update):
+ if update.from_user.id not in Config.AUTH_USERS:
+ await bot.delete_messages(
+ chat_id=update.chat.id,
+ message_ids=update.message_id,
+ revoke=True
+ )
+ return
+ TRChatBase(update.from_user.id, update.text, "trim")
+ saved_file_path = Config.DOWNLOAD_LOCATION + "/" + str(update.from_user.id) + ".FFMpegRoBot.mkv"
+ if os.path.exists(saved_file_path):
+ a = await bot.send_message(
+ chat_id=update.chat.id,
+ text=Translation.DOWNLOAD_START,
+ reply_to_message_id=update.message_id
+ )
+ commands = update.command
+ if len(commands) == 3:
+ # output should be video
+ cmd, start_time, end_time = commands
+ o = await cult_small_video(saved_file_path, Config.DOWNLOAD_LOCATION, start_time, end_time)
+ logger.info(o)
+ if o is not None:
+ await bot.edit_message_text(
+ chat_id=update.chat.id,
+ text=Translation.UPLOAD_START,
+ message_id=a.message_id
+ )
+ c_time = time.time()
+ await bot.send_video(
+ chat_id=update.chat.id,
+ video=o,
+ # caption=description,
+ # duration=duration,
+ # width=width,
+ # height=height,
+ supports_streaming=True,
+ # reply_markup=reply_markup,
+ # thumb=thumb_image_path,
+ reply_to_message_id=update.message_id,
+ progress=progress_for_pyrogram,
+ progress_args=(
+ Translation.UPLOAD_START,
+ a,
+ c_time
+ )
+ )
+ os.remove(o)
+ await bot.edit_message_text(
+ chat_id=update.chat.id,
+ text=Translation.AFTER_SUCCESSFUL_UPLOAD_MSG,
+ disable_web_page_preview=True,
+ message_id=a.message_id
+ )
+ elif len(commands) == 2:
+ # output should be screenshot
+ cmd, start_time = commands
+ o = await take_screen_shot(saved_file_path, Config.DOWNLOAD_LOCATION, start_time)
+ logger.info(o)
+ if o is not None:
+ await bot.edit_message_text(
+ chat_id=update.chat.id,
+ text=Translation.UPLOAD_START,
+ message_id=a.message_id
+ )
+ c_time = time.time()
+ await bot.send_document(
+ chat_id=update.chat.id,
+ document=o,
+ # thumb=thumb_image_path,
+ # caption=description,
+ # reply_markup=reply_markup,
+ reply_to_message_id=update.message_id,
+ progress=progress_for_pyrogram,
+ progress_args=(
+ Translation.UPLOAD_START,
+ a,
+ c_time
+ )
+ )
+ c_time = time.time()
+ await bot.send_photo(
+ chat_id=update.chat.id,
+ photo=o,
+ # caption=Translation.CUSTOM_CAPTION_UL_FILE,
+ reply_to_message_id=update.message_id,
+ progress=progress_for_pyrogram,
+ progress_args=(
+ Translation.UPLOAD_START,
+ a,
+ c_time
+ )
+ )
+ os.remove(o)
+ await bot.edit_message_text(
+ chat_id=update.chat.id,
+ text=Translation.AFTER_SUCCESSFUL_UPLOAD_MSG,
+ disable_web_page_preview=True,
+ message_id=a.message_id
+ )
+ else:
+ await bot.edit_message_text(
+ chat_id=update.chat.id,
+ text=Translation.FF_MPEG_RO_BOT_RE_SURRECT_ED,
+ message_id=a.message_id
+ )
+ else:
+ # reply help message
+ await bot.send_message(
+ chat_id=update.chat.id,
+ text=Translation.FF_MPEG_RO_BOT_STEP_TWO_TO_ONE,
+ reply_to_message_id=update.message_id
+ )
+
+
+@pyrogram.Client.on_message(pyrogram.Filters.command(["storageinfo"]))
+async def storage_info(bot, update):
+ if update.from_user.id not in Config.AUTH_USERS:
+ await bot.delete_messages(
+ chat_id=update.chat.id,
+ message_ids=update.message_id,
+ revoke=True
+ )
+ return
+ TRChatBase(update.from_user.id, update.text, "storageinfo")
+ saved_file_path = Config.DOWNLOAD_LOCATION + "/" + str(update.from_user.id) + ".FFMpegRoBot.mkv"
+ if os.path.exists(saved_file_path):
+ metadata = extractMetadata(createParser(saved_file_path))
+ duration = None
+ if metadata.has("duration"):
+ duration = metadata.get('duration')
+ await bot.send_message(
+ chat_id=update.chat.id,
+ text=Translation.FF_MPEG_RO_BOT_STOR_AGE_INFO.format(duration),
+ reply_to_message_id=update.message_id
+ )
+ else:
+ # reply help message
+ await bot.send_message(
+ chat_id=update.chat.id,
+ text=Translation.FF_MPEG_RO_BOT_STEP_TWO_TO_ONE,
+ reply_to_message_id=update.message_id
+ )
+
+
+@pyrogram.Client.on_message(pyrogram.Filters.command(["clearffmpegmedia"]))
+async def clear_media(bot, update):
+ if update.from_user.id not in Config.AUTH_USERS:
+ await bot.delete_messages(
+ chat_id=update.chat.id,
+ message_ids=update.message_id,
+ revoke=True
+ )
+ return
+ TRChatBase(update.from_user.id, update.text, "clearffmpegmedia")
+ saved_file_path = Config.DOWNLOAD_LOCATION + "/" + str(update.from_user.id) + ".FFMpegRoBot.mkv"
+ if os.path.exists(saved_file_path):
+ os.remove(saved_file_path)
+ await bot.send_message(
+ chat_id=update.chat.id,
+ text=Translation.FF_MPEG_DEL_ETED_CUSTOM_MEDIA,
+ reply_to_message_id=update.message_id
+ )
+
+
+@pyrogram.Client.on_message(pyrogram.Filters.command(["downloadmedia"]))
+async def download_media(bot, update):
+ if update.from_user.id not in Config.AUTH_USERS:
+ await bot.delete_messages(
+ chat_id=update.chat.id,
+ message_ids=update.message_id,
+ revoke=True
+ )
+ return
+ TRChatBase(update.from_user.id, update.text, "downloadmedia")
+ saved_file_path = Config.DOWNLOAD_LOCATION + "/" + str(update.from_user.id) + ".FFMpegRoBot.mkv"
+ if not os.path.exists(saved_file_path):
+ a = await bot.send_message(
+ chat_id=update.chat.id,
+ text=Translation.DOWNLOAD_START,
+ reply_to_message_id=update.message_id
+ )
+ try:
+ c_time = time.time()
+ await bot.download_media(
+ message=update.reply_to_message,
+ file_name=saved_file_path,
+ progress=progress_for_pyrogram,
+ progress_args=(
+ Translation.DOWNLOAD_START,
+ a,
+ c_time
+ )
+ )
+ except (ValueError) as e:
+ await bot.edit_message_text(
+ chat_id=update.chat.id,
+ text=str(e),
+ message_id=a.message_id
+ )
+ else:
+ await bot.edit_message_text(
+ chat_id=update.chat.id,
+ text=Translation.SAVED_RECVD_DOC_FILE,
+ message_id=a.message_id
+ )
+ else:
+ await bot.send_message(
+ chat_id=update.chat.id,
+ text=Translation.FF_MPEG_RO_BOT_STOR_AGE_ALREADY_EXISTS,
+ reply_to_message_id=update.message_id
+ )
From 0d1c07c4f0a4fa2fc638213910446fbacf25db26 Mon Sep 17 00:00:00 2001
From: Kannada-bot <57821193+Kannada-bot@users.noreply.github.com>
Date: Mon, 18 May 2020 08:47:23 +0530
Subject: [PATCH 09/36] Create convert_to_audio.py
---
plugins/convert_to_audio.py | 143 ++++++++++++++++++++++++++++++++++++
1 file changed, 143 insertions(+)
create mode 100644 plugins/convert_to_audio.py
diff --git a/plugins/convert_to_audio.py b/plugins/convert_to_audio.py
new file mode 100644
index 000000000..1545a5d2c
--- /dev/null
+++ b/plugins/convert_to_audio.py
@@ -0,0 +1,143 @@
+#!/usr/bin/env python3
+# -*- coding: utf-8 -*-
+# (c) Shrimadhav U K
+
+# the logging things
+import logging
+logging.basicConfig(level=logging.DEBUG,
+ format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
+logger = logging.getLogger(__name__)
+
+import os
+import time
+
+# the secret configuration specific things
+if bool(os.environ.get("WEBHOOK", False)):
+ from sample_config import Config
+else:
+ from config import Config
+
+# the Strings used for this "thing"
+from translation import Translation
+
+import pyrogram
+logging.getLogger("pyrogram").setLevel(logging.WARNING)
+
+from helper_funcs.chat_base import TRChatBase
+from helper_funcs.display_progress import progress_for_pyrogram
+
+from hachoir.metadata import extractMetadata
+from hachoir.parser import createParser
+# https://stackoverflow.com/a/37631799/4723940
+from PIL import Image
+
+
+@pyrogram.Client.on_message(pyrogram.Filters.command(["converttoaudio"]))
+async def convert_to_audio(bot, update):
+ if update.from_user.id not in Config.AUTH_USERS:
+ await bot.delete_messages(
+ chat_id=update.chat.id,
+ message_ids=update.message_id,
+ revoke=True
+ )
+ return
+ TRChatBase(update.from_user.id, update.text, "converttoaudio")
+ if (update.reply_to_message is not None) and (update.reply_to_message.media is not None) :
+ description = Translation.CUSTOM_CAPTION_UL_FILE
+ download_location = Config.DOWNLOAD_LOCATION + "/"
+ a = await bot.send_message(
+ chat_id=update.chat.id,
+ text=Translation.DOWNLOAD_START,
+ reply_to_message_id=update.message_id
+ )
+ c_time = time.time()
+ the_real_download_location = await bot.download_media(
+ message=update.reply_to_message,
+ file_name=download_location,
+ progress=progress_for_pyrogram,
+ progress_args=(
+ Translation.DOWNLOAD_START,
+ a,
+ c_time
+ )
+ )
+ if the_real_download_location is not None:
+ await bot.edit_message_text(
+ text=Translation.SAVED_RECVD_DOC_FILE,
+ chat_id=update.chat.id,
+ message_id=a.message_id
+ )
+ # don't care about the extension
+ # convert video to audio format
+ audio_file_location_path = the_real_download_location
+ await bot.edit_message_text(
+ text=Translation.UPLOAD_START,
+ chat_id=update.chat.id,
+ message_id=a.message_id
+ )
+ logger.info(the_real_download_location)
+ # get the correct width, height, and duration for videos greater than 10MB
+ # ref: message from @BotSupport
+ width = 0
+ height = 0
+ duration = 0
+ metadata = extractMetadata(createParser(the_real_download_location))
+ if metadata.has("duration"):
+ duration = metadata.get('duration').seconds
+ thumb_image_path = Config.DOWNLOAD_LOCATION + "/" + str(update.from_user.id) + ".jpg"
+ if not os.path.exists(thumb_image_path):
+ thumb_image_path = None
+ else:
+ metadata = extractMetadata(createParser(thumb_image_path))
+ if metadata.has("width"):
+ width = metadata.get("width")
+ if metadata.has("height"):
+ height = metadata.get("height")
+ # get the correct width, height, and duration for videos greater than 10MB
+ # resize image
+ # ref: https://t.me/PyrogramChat/44663
+ # https://stackoverflow.com/a/21669827/4723940
+ Image.open(thumb_image_path).convert("RGB").save(thumb_image_path)
+ img = Image.open(thumb_image_path)
+ # https://stackoverflow.com/a/37631799/4723940
+ # img.thumbnail((90, 90))
+ img.resize((90, height))
+ img.save(thumb_image_path, "JPEG")
+ # https://pillow.readthedocs.io/en/3.1.x/reference/Image.html#create-thumbnails
+ # try to upload file
+ c_time = time.time()
+ await bot.send_audio(
+ chat_id=update.chat.id,
+ audio=audio_file_location_path,
+ caption=description,
+ duration=duration,
+ # performer="",
+ # title="",
+ # reply_markup=reply_markup,
+ thumb=thumb_image_path,
+ reply_to_message_id=update.reply_to_message.message_id,
+ progress=progress_for_pyrogram,
+ progress_args=(
+ Translation.UPLOAD_START,
+ a,
+ c_time
+ )
+ )
+ try:
+ os.remove(thumb_image_path)
+ os.remove(the_real_download_location)
+ os.remove(audio_file_location_path)
+ except:
+ pass
+ await bot.edit_message_text(
+ text=Translation.AFTER_SUCCESSFUL_UPLOAD_MSG,
+ chat_id=update.chat.id,
+ message_id=a.message_id,
+ disable_web_page_preview=True
+ )
+ else:
+ await bot.send_message(
+ chat_id=update.chat.id,
+ text=Translation.REPLY_TO_DOC_FOR_C2V,
+ reply_to_message_id=update.message_id
+ )
From 6c003a577655b1ae35a9c2d5e09f89888345a5cf Mon Sep 17 00:00:00 2001
From: Kannada-bot <57821193+Kannada-bot@users.noreply.github.com>
Date: Mon, 18 May 2020 08:48:48 +0530
Subject: [PATCH 10/36] Create convert_to_video.py
---
plugins/convert_to_video.py | 151 ++++++++++++++++++++++++++++++++++++
1 file changed, 151 insertions(+)
create mode 100644 plugins/convert_to_video.py
diff --git a/plugins/convert_to_video.py b/plugins/convert_to_video.py
new file mode 100644
index 000000000..c26dbbea4
--- /dev/null
+++ b/plugins/convert_to_video.py
@@ -0,0 +1,151 @@
+#!/usr/bin/env python3
+# -*- coding: utf-8 -*-
+# (c) Shrimadhav U K
+
+# the logging things
+import logging
+logging.basicConfig(level=logging.DEBUG,
+ format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
+logger = logging.getLogger(__name__)
+
+import os
+import random
+import time
+
+# the secret configuration specific things
+if bool(os.environ.get("WEBHOOK", False)):
+ from sample_config import Config
+else:
+ from config import Config
+
+# the Strings used for this "thing"
+from translation import Translation
+
+import pyrogram
+logging.getLogger("pyrogram").setLevel(logging.WARNING)
+
+from helper_funcs.chat_base import TRChatBase
+from helper_funcs.display_progress import progress_for_pyrogram
+from helper_funcs.help_Nekmo_ffmpeg import take_screen_shot
+
+from hachoir.metadata import extractMetadata
+from hachoir.parser import createParser
+# https://stackoverflow.com/a/37631799/4723940
+from PIL import Image
+
+
+@pyrogram.Client.on_message(pyrogram.Filters.command(["converttovideo"]))
+async def convert_to_video(bot, update):
+ if update.from_user.id not in Config.AUTH_USERS:
+ await bot.delete_messages(
+ chat_id=update.chat.id,
+ message_ids=update.message_id,
+ revoke=True
+ )
+ return
+ TRChatBase(update.from_user.id, update.text, "converttovideo")
+ if update.reply_to_message is not None:
+ description = Translation.CUSTOM_CAPTION_UL_FILE
+ download_location = Config.DOWNLOAD_LOCATION + "/"
+ a = await bot.send_message(
+ chat_id=update.chat.id,
+ text=Translation.DOWNLOAD_START,
+ reply_to_message_id=update.message_id
+ )
+ c_time = time.time()
+ the_real_download_location = await bot.download_media(
+ message=update.reply_to_message,
+ file_name=download_location,
+ progress=progress_for_pyrogram,
+ progress_args=(
+ Translation.DOWNLOAD_START,
+ a,
+ c_time
+ )
+ )
+ if the_real_download_location is not None:
+ await bot.edit_message_text(
+ text=Translation.SAVED_RECVD_DOC_FILE,
+ chat_id=update.chat.id,
+ message_id=a.message_id
+ )
+ # don't care about the extension
+ await bot.edit_message_text(
+ text=Translation.UPLOAD_START,
+ chat_id=update.chat.id,
+ message_id=a.message_id
+ )
+ logger.info(the_real_download_location)
+ # get the correct width, height, and duration for videos greater than 10MB
+ # ref: message from @BotSupport
+ width = 0
+ height = 0
+ duration = 0
+ metadata = extractMetadata(createParser(the_real_download_location))
+ if metadata.has("duration"):
+ duration = metadata.get('duration').seconds
+ thumb_image_path = Config.DOWNLOAD_LOCATION + "/" + str(update.from_user.id) + ".jpg"
+ if not os.path.exists(thumb_image_path):
+ thumb_image_path = await take_screen_shot(
+ the_real_download_location,
+ os.path.dirname(the_real_download_location),
+ random.randint(
+ 0,
+ duration - 1
+ )
+ )
+ logger.info(thumb_image_path)
+ # 'thumb_image_path' will be available now
+ metadata = extractMetadata(createParser(thumb_image_path))
+ if metadata.has("width"):
+ width = metadata.get("width")
+ if metadata.has("height"):
+ height = metadata.get("height")
+ # get the correct width, height, and duration for videos greater than 10MB
+ # resize image
+ # ref: https://t.me/PyrogramChat/44663
+ # https://stackoverflow.com/a/21669827/4723940
+ Image.open(thumb_image_path).convert("RGB").save(thumb_image_path)
+ img = Image.open(thumb_image_path)
+ # https://stackoverflow.com/a/37631799/4723940
+ # img.thumbnail((90, 90))
+ img.resize((90, height))
+ img.save(thumb_image_path, "JPEG")
+ # https://pillow.readthedocs.io/en/3.1.x/reference/Image.html#create-thumbnails
+ # try to upload file
+ c_time = time.time()
+ await bot.send_video(
+ chat_id=update.chat.id,
+ video=the_real_download_location,
+ caption=description,
+ duration=duration,
+ width=width,
+ height=height,
+ supports_streaming=True,
+ # reply_markup=reply_markup,
+ thumb=thumb_image_path,
+ reply_to_message_id=update.reply_to_message.message_id,
+ progress=progress_for_pyrogram,
+ progress_args=(
+ Translation.UPLOAD_START,
+ a,
+ c_time
+ )
+ )
+ try:
+ os.remove(the_real_download_location)
+ os.remove(thumb_image_path)
+ except:
+ pass
+ await bot.edit_message_text(
+ text=Translation.AFTER_SUCCESSFUL_UPLOAD_MSG,
+ chat_id=update.chat.id,
+ message_id=a.message_id,
+ disable_web_page_preview=True
+ )
+ else:
+ await bot.send_message(
+ chat_id=update.chat.id,
+ text=Translation.REPLY_TO_DOC_FOR_C2V,
+ reply_to_message_id=update.message_id
+ )
From 0407779d4d2f057b70f5fdca6cd20313c9a2be59 Mon Sep 17 00:00:00 2001
From: Kannada-bot <57821193+Kannada-bot@users.noreply.github.com>
Date: Mon, 18 May 2020 13:03:28 +0530
Subject: [PATCH 11/36] Download_stickers.py
---
plugins/download_stickers.py | 110 +++++++++++++++++++++++++++++++++++
1 file changed, 110 insertions(+)
create mode 100644 plugins/download_stickers.py
diff --git a/plugins/download_stickers.py b/plugins/download_stickers.py
new file mode 100644
index 000000000..2288e2341
--- /dev/null
+++ b/plugins/download_stickers.py
@@ -0,0 +1,110 @@
+
+#!/usr/bin/env python3
+# -*- coding: utf-8 -*-
+# (c) Shrimadhav U K
+
+# the logging things
+import logging
+logging.basicConfig(level=logging.DEBUG,
+ format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
+logger = logging.getLogger(__name__)
+
+import os
+import time
+
+# the secret configuration specific things
+if bool(os.environ.get("WEBHOOK", False)):
+ from sample_config import Config
+else:
+ from config import Config
+
+# the Strings used for this "thing"
+from translation import Translation
+
+import pyrogram
+logging.getLogger("pyrogram").setLevel(logging.WARNING)
+
+from helper_funcs.chat_base import TRChatBase
+from helper_funcs.display_progress import progress_for_pyrogram
+
+
+@pyrogram.Client.on_message(pyrogram.Filters.sticker)
+async def DownloadStickersBot(bot, update):
+ if update.from_user.id not in Config.AUTH_USERS:
+ await bot.delete_messages(
+ chat_id=update.chat.id,
+ message_ids=update.message_id,
+ revoke=True
+ )
+ return
+ TRChatBase(update.from_user.id, update.text, "DownloadStickersBot")
+ logger.info(update.from_user)
+ download_location = Config.DOWNLOAD_LOCATION + "/" + str(update.from_user.id) + "_DownloadStickersBot_" + str(update.from_user.id) + ".png"
+ a = await bot.send_message(
+ chat_id=update.chat.id,
+ text=Translation.DOWNLOAD_START,
+ reply_to_message_id=update.message_id
+ )
+ try:
+ c_time = time.time()
+ the_real_download_location = await bot.download_media(
+ message=update,
+ file_name=download_location,
+ progress=progress_for_pyrogram,
+ progress_args=(
+ Translation.DOWNLOAD_START,
+ a,
+ c_time
+ )
+ )
+ except (ValueError) as e:
+ await bot.edit_message_text(
+ text=str(e),
+ chat_id=update.chat.id,
+ message_id=a.message_id
+ )
+ return False
+ await bot.edit_message_text(
+ text=Translation.SAVED_RECVD_DOC_FILE,
+ chat_id=update.chat.id,
+ message_id=a.message_id
+ )
+ c_time = time.time()
+ await bot.send_document(
+ chat_id=update.chat.id,
+ document=the_real_download_location,
+ # thumb=thumb_image_path,
+ # caption=description,
+ # reply_markup=reply_markup,
+ reply_to_message_id=a.message_id,
+ progress=progress_for_pyrogram,
+ progress_args=(
+ Translation.UPLOAD_START,
+ a,
+ c_time
+ )
+ )
+ try:
+ await bot.send_photo(
+ chat_id=update.chat.id,
+ photo=the_real_download_location,
+ # thumb=thumb_image_path,
+ # caption=description,
+ # reply_markup=reply_markup,
+ reply_to_message_id=a.message_id,
+ progress=progress_for_pyrogram,
+ progress_args=(
+ Translation.UPLOAD_START,
+ a,
+ c_time
+ )
+ )
+ except:
+ pass
+ os.remove(the_real_download_location)
+ await bot.edit_message_text(
+ text=Translation.AFTER_SUCCESSFUL_UPLOAD_MSG,
+ chat_id=update.chat.id,
+ message_id=a.message_id,
+ disable_web_page_preview=True
+ )
From 1f589063b0e319019b14c2f222dbb62e04cee24f Mon Sep 17 00:00:00 2001
From: Kannada-bot <57821193+Kannada-bot@users.noreply.github.com>
Date: Mon, 18 May 2020 17:20:24 +0530
Subject: [PATCH 12/36] Generate screenshot.py
---
plugins/generate_screen_shot.py | 127 ++++++++++++++++++++++++++++++++
1 file changed, 127 insertions(+)
create mode 100644 plugins/generate_screen_shot.py
diff --git a/plugins/generate_screen_shot.py b/plugins/generate_screen_shot.py
new file mode 100644
index 000000000..793240261
--- /dev/null
+++ b/plugins/generate_screen_shot.py
@@ -0,0 +1,127 @@
+#!/usr/bin/env python3
+# -*- coding: utf-8 -*-
+# (c) Shrimadhav U K
+
+# the logging things
+import logging
+logging.basicConfig(level=logging.DEBUG,
+ format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
+logger = logging.getLogger(__name__)
+
+import os
+import shutil
+import time
+
+# the secret configuration specific things
+if bool(os.environ.get("WEBHOOK", False)):
+ from sample_config import Config
+else:
+ from config import Config
+
+# the Strings used for this "thing"
+from translation import Translation
+
+import pyrogram
+logging.getLogger("pyrogram").setLevel(logging.WARNING)
+
+from helper_funcs.chat_base import TRChatBase
+from helper_funcs.help_Nekmo_ffmpeg import generate_screen_shots
+from helper_funcs.display_progress import progress_for_pyrogram
+
+
+@pyrogram.Client.on_message(pyrogram.Filters.command(["generatescss"]))
+async def generate_screen_shot(bot, update):
+ if update.from_user.id not in Config.AUTH_USERS:
+ await bot.delete_messages(
+ chat_id=update.chat.id,
+ message_ids=update.message_id,
+ revoke=True
+ )
+ return
+ TRChatBase(update.from_user.id, update.text, "generatescss")
+ if update.reply_to_message is not None:
+ download_location = Config.DOWNLOAD_LOCATION + "/"
+ a = await bot.send_message(
+ chat_id=update.chat.id,
+ text=Translation.DOWNLOAD_START,
+ reply_to_message_id=update.message_id
+ )
+ c_time = time.time()
+ the_real_download_location = await bot.download_media(
+ message=update.reply_to_message,
+ file_name=download_location,
+ progress=progress_for_pyrogram,
+ progress_args=(
+ Translation.DOWNLOAD_START,
+ a,
+ c_time
+ )
+ )
+ if the_real_download_location is not None:
+ await bot.edit_message_text(
+ text=Translation.SAVED_RECVD_DOC_FILE,
+ chat_id=update.chat.id,
+ message_id=a.message_id
+ )
+ tmp_directory_for_each_user = Config.DOWNLOAD_LOCATION + "/" + str(update.from_user.id)
+ if not os.path.isdir(tmp_directory_for_each_user):
+ os.makedirs(tmp_directory_for_each_user)
+ images = await generate_screen_shots(
+ the_real_download_location,
+ tmp_directory_for_each_user,
+ False,
+ Config.DEF_WATER_MARK_FILE,
+ 5,
+ 9
+ )
+ logger.info(images)
+ await bot.edit_message_text(
+ text=Translation.UPLOAD_START,
+ chat_id=update.chat.id,
+ message_id=a.message_id
+ )
+ media_album_p = []
+ if images is not None:
+ i = 0
+ caption = "© @AnyDLBot"
+ for image in images:
+ if os.path.exists(image):
+ if i == 0:
+ media_album_p.append(
+ pyrogram.InputMediaPhoto(
+ media=image,
+ caption=caption,
+ parse_mode="html"
+ )
+ )
+ else:
+ media_album_p.append(
+ pyrogram.InputMediaPhoto(
+ media=image
+ )
+ )
+ i = i + 1
+ await bot.send_media_group(
+ chat_id=update.chat.id,
+ disable_notification=True,
+ reply_to_message_id=a.message_id,
+ media=media_album_p
+ )
+ #
+ try:
+ shutil.rmtree(tmp_directory_for_each_user)
+ os.remove(the_real_download_location)
+ except:
+ pass
+ await bot.edit_message_text(
+ text=Translation.AFTER_SUCCESSFUL_UPLOAD_MSG,
+ chat_id=update.chat.id,
+ message_id=a.message_id,
+ disable_web_page_preview=True
+ )
+ else:
+ await bot.send_message(
+ chat_id=update.chat.id,
+ text=Translation.REPLY_TO_DOC_FOR_SCSS,
+ reply_to_message_id=update.message_id
+ )
From f27c4b9ead589aa5deedcf8a2d866f0b8d9cdbdf Mon Sep 17 00:00:00 2001
From: Kannada-bot <57821193+Kannada-bot@users.noreply.github.com>
Date: Mon, 18 May 2020 17:21:25 +0530
Subject: [PATCH 13/36] Create get_external_link.py
---
plugins/get_external_link.py | 115 +++++++++++++++++++++++++++++++++++
1 file changed, 115 insertions(+)
create mode 100644 plugins/get_external_link.py
diff --git a/plugins/get_external_link.py b/plugins/get_external_link.py
new file mode 100644
index 000000000..04c4778c8
--- /dev/null
+++ b/plugins/get_external_link.py
@@ -0,0 +1,115 @@
+#!/usr/bin/env python3
+# -*- coding: utf-8 -*-
+# (c) Shrimadhav U K
+
+# the logging things
+import logging
+logging.basicConfig(level=logging.DEBUG,
+ format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
+logger = logging.getLogger(__name__)
+
+from datetime import datetime
+import os
+import requests
+import subprocess
+import time
+
+# the secret configuration specific things
+if bool(os.environ.get("WEBHOOK", False)):
+ from sample_config import Config
+else:
+ from config import Config
+
+# the Strings used for this "thing"
+from translation import Translation
+
+import pyrogram
+logging.getLogger("pyrogram").setLevel(logging.WARNING)
+
+from helper_funcs.chat_base import TRChatBase
+from helper_funcs.display_progress import progress_for_pyrogram
+
+
+@pyrogram.Client.on_message(pyrogram.Filters.command(["getlink"]))
+async def get_link(bot, update):
+ if update.from_user.id not in Config.AUTH_USERS:
+ await bot.delete_messages(
+ chat_id=update.chat.id,
+ message_ids=update.message_id,
+ revoke=True
+ )
+ return
+ TRChatBase(update.from_user.id, update.text, "getlink")
+ logger.info(update.from_user)
+ if update.reply_to_message is not None:
+ reply_message = update.reply_to_message
+ download_location = Config.DOWNLOAD_LOCATION + "/"
+ start = datetime.now()
+ a = await bot.send_message(
+ chat_id=update.chat.id,
+ text=Translation.DOWNLOAD_START,
+ reply_to_message_id=update.message_id
+ )
+ c_time = time.time()
+ after_download_file_name = await bot.download_media(
+ message=reply_message,
+ file_name=download_location,
+ progress=progress_for_pyrogram,
+ progress_args=(
+ Translation.DOWNLOAD_START,
+ a,
+ c_time
+ )
+ )
+ download_extension = after_download_file_name.rsplit(".", 1)[-1]
+ await bot.edit_message_text(
+ text=Translation.SAVED_RECVD_DOC_FILE,
+ chat_id=update.chat.id,
+ message_id=a.message_id
+ )
+ end_one = datetime.now()
+ url = "https://transfer.sh/{}.{}".format(str(update.from_user.id), str(download_extension))
+ max_days = "5"
+ command_to_exec = [
+ "curl",
+ # "-H", 'Max-Downloads: 1',
+ "-H", 'Max-Days: 5', # + max_days + '',
+ "--upload-file", after_download_file_name,
+ url
+ ]
+ await bot.edit_message_text(
+ text=Translation.UPLOAD_START,
+ chat_id=update.chat.id,
+ message_id=a.message_id
+ )
+ try:
+ logger.info(command_to_exec)
+ t_response = subprocess.check_output(command_to_exec, stderr=subprocess.STDOUT)
+ except subprocess.CalledProcessError as exc:
+ logger.info("Status : FAIL", exc.returncode, exc.output)
+ await bot.edit_message_text(
+ chat_id=update.chat.id,
+ text=exc.output.decode("UTF-8"),
+ message_id=a.message_id
+ )
+ return False
+ else:
+ logger.info(t_response)
+ t_response_arry = t_response.decode("UTF-8").split("\n")[-1].strip()
+ await bot.edit_message_text(
+ chat_id=update.chat.id,
+ text=Translation.AFTER_GET_DL_LINK.format(t_response_arry, max_days),
+ parse_mode="html",
+ message_id=a.message_id,
+ disable_web_page_preview=True
+ )
+ try:
+ os.remove(after_download_file_name)
+ except:
+ pass
+ else:
+ await bot.send_message(
+ chat_id=update.chat.id,
+ text=Translation.REPLY_TO_DOC_GET_LINK,
+ reply_to_message_id=update.message_id
+ )
From cba411fdd709edd5fc176e8e7cac6914a79c3134 Mon Sep 17 00:00:00 2001
From: Kannada-bot <57821193+Kannada-bot@users.noreply.github.com>
Date: Mon, 18 May 2020 17:25:34 +0530
Subject: [PATCH 14/36] Start
---
translation.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/translation.py b/translation.py
index de6b2ef97..ec58f781f 100644
--- a/translation.py
+++ b/translation.py
@@ -9,6 +9,7 @@ class Translation(object):
1. Send me any Telegram File.
2. Reply to that message to /rename new name.extension.
+ I can do still many more things check commands
/help for more details..
Support Group : @NMbotsZ
@@ -41,7 +42,7 @@ class Translation(object):
Telegram ID: {}
Plan Free User
Expires on: 31/12/2020"""
- HELP_USER = """Hai am URL Uploader bot..
+ HELP_USER = """Hai am URL Uploader bot..With Many Things.
1. Send url (Link|New Name with Extension).
2. Send Custom Thumbnail (Optional).
From 0f7218b71505a078e72cec2faea57131c48dae99 Mon Sep 17 00:00:00 2001
From: Kannada-bot <57821193+Kannada-bot@users.noreply.github.com>
Date: Mon, 18 May 2020 17:38:01 +0530
Subject: [PATCH 15/36] Update generate_screen_shot.py
---
plugins/generate_screen_shot.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/plugins/generate_screen_shot.py b/plugins/generate_screen_shot.py
index 793240261..0161b61c3 100644
--- a/plugins/generate_screen_shot.py
+++ b/plugins/generate_screen_shot.py
@@ -83,7 +83,7 @@ async def generate_screen_shot(bot, update):
media_album_p = []
if images is not None:
i = 0
- caption = "© @AnyDLBot"
+ caption = "© @NMbotsZ"
for image in images:
if os.path.exists(image):
if i == 0:
From 6a78879d25dc6fe958eb9b4e7ff112477410ea32 Mon Sep 17 00:00:00 2001
From: Kannada-bot <57821193+Kannada-bot@users.noreply.github.com>
Date: Mon, 18 May 2020 17:51:15 +0530
Subject: [PATCH 16/36] translation.py
---
translation.py | 15 ++++++---------
1 file changed, 6 insertions(+), 9 deletions(-)
diff --git a/translation.py b/translation.py
index ec58f781f..7ac797e44 100644
--- a/translation.py
+++ b/translation.py
@@ -2,7 +2,6 @@ class Translation(object):
START_TEXT = """Hello,
This is a Telegram URL Upload Bot!
-
Please send me any direct download URL Link, i can upload to telegram as File/Video
And I Can Also Rename Telegram Files...
@@ -21,8 +20,8 @@ class Translation(object):
SET_CUSTOM_USERNAME_PASSWORD = """If you want to download premium videos, provide in the following format:
URL | filename | username | password"""
NOYES_URL = "@robot URL detected. Please use https://shrtz.me/PtsVnf6 and get me a fast URL so that I can upload to Telegram, without me slowing down for other users."
- DOWNLOAD_START = "trying to download"
- UPLOAD_START = "trying to upload"
+ DOWNLOAD_START = "Trying To Download"
+ UPLOAD_START = "Trying To Upload"
RCHD_BOT_API_LIMIT = "size greater than maximum allowed size (50MB). Neverthless, trying to upload."
RCHD_TG_API_LIMIT = "Downloaded in {} seconds.\nDetected File Size: {}\nSorry. But, I cannot upload files greater than 1.5GB due to Telegram API limitations."
AFTER_SUCCESSFUL_UPLOAD_MSG = "Please rate me if you find me useful. Join : @NMBotsZ"
@@ -63,7 +62,7 @@ class Translation(object):
REPLY_TO_DOC_FOR_C2V = "Reply to a Telegram media to convert"
REPLY_TO_DOC_FOR_SCSS = "Reply to a Telegram media to get screenshots"
REPLY_TO_DOC_FOR_RENAME_FILE = "Reply to a Telegram media to /rename with custom thumbnail support"
- AFTER_GET_DL_LINK = "Direct Link Generated valid for {} days.\n© @AnyDLBot"
+ AFTER_GET_DL_LINK = "Direct Link Generated valid for {} days.\n© @NMbotsZ"
FF_MPEG_RO_BOT_RE_SURRECT_ED = """Syntax: /trim HH:MM:SS [HH:MM:SS]"""
FF_MPEG_RO_BOT_STEP_TWO_TO_ONE = "First send /downloadmedia to any media so that it can be downloaded to my local. \nSend /storageinfo to know the media, that is currently downloaded."
FF_MPEG_RO_BOT_STOR_AGE_INFO = "Video Duration: {}\nSend /clearffmpegmedia to delete this media, from my storage.\nSend /trim HH:MM:SS [HH:MM:SS] to cu[l]t a small photo / video, from the above media."
@@ -74,16 +73,14 @@ class Translation(object):
ERR_ONLY_TWO_MEDIA_IN_ALBUM = "Media Album should contain only two photos. Please re-send the media album, and then try again, or send only two photos in an album."
INVALID_UPLOAD_BOT_URL_FORMAT = "URL format is incorrect. make sure your url starts with either http:// or https://. You can set custom file name using the format link | file_name.extension"
ABUSIVE_USERS = "You are not allowed to use this bot. If you think this is a mistake, please check /me to remove this restriction."
- FF_MPEG_RO_BOT_AD_VER_TISE_MENT = "https://telegram.dog/FFMpegRoBot"
+ FF_MPEG_RO_BOT_AD_VER_TISE_MENT = "https://telegram.dog/NMbotsZ"
EXTRACT_ZIP_INTRO_ONE = "Send a compressed file first, Then reply /unzip command to the file."
EXTRACT_ZIP_INTRO_THREE = "Analyzing received file. ⚠️ This might take some time. Please be patient. "
UNZIP_SUPPORTED_EXTENSIONS = ("zip", "rar")
- EXTRACT_ZIP_ERRS_OCCURED = "Sorry. Errors occurred while processing compressed file. Please check everything again twice, and if the issue persists, report this to @SpEcHlDe"
+ EXTRACT_ZIP_ERRS_OCCURED = "Sorry. Errors occurred while processing compressed file. Please check everything again twice, and if the issue persists, report this to @NMbotsZ"
EXTRACT_ZIP_STEP_TWO = """Select file_name to upload from the below options.
You can use /rename command after receiving file to rename it with custom thumbnail support."""
CANCEL_STR = "Process Cancelled"
ZIP_UPLOADED_STR = "Uploaded {} files in {} seconds"
- FREE_USER_LIMIT_Q_SZE = """Cannot Process.
-Free users only 1 request per 30 minutes.
-/upgrade or Try 1800 seconds later."""
+ FREE_USER_LIMIT_Q_SZE = """No one Gonna Help you."""
SLOW_URL_DECED = "Gosh that seems to be a very slow URL. Since you were screwing my home, I am in no mood to download this file. Meanwhile, why don't you try this:==> https://shrtz.me/PtsVnf6 and get me a fast URL so that I can upload to Telegram, without me slowing down for other users."
From 7057fdbaa1acf7f85411cdd90e0ca53fb4523b41 Mon Sep 17 00:00:00 2001
From: Kannada-bot <57821193+Kannada-bot@users.noreply.github.com>
Date: Mon, 18 May 2020 17:51:54 +0530
Subject: [PATCH 17/36] Update translation.py
---
translation.py | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/translation.py b/translation.py
index 7ac797e44..185c608fa 100644
--- a/translation.py
+++ b/translation.py
@@ -8,7 +8,9 @@ class Translation(object):
1. Send me any Telegram File.
2. Reply to that message to /rename new name.extension.
- I can do still many more things check commands
+
+ I can do still many more things check commands.
+
/help for more details..
Support Group : @NMbotsZ
From f56b959948769ca55fd7bf18935f932e347327ee Mon Sep 17 00:00:00 2001
From: Kannada-bot <57821193+Kannada-bot@users.noreply.github.com>
Date: Mon, 18 May 2020 23:38:02 +0530
Subject: [PATCH 18/36] Update translation.py
---
translation.py | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/translation.py b/translation.py
index 185c608fa..87ab53430 100644
--- a/translation.py
+++ b/translation.py
@@ -13,7 +13,7 @@ class Translation(object):
/help for more details..
-Support Group : @NMbotsZ
+Support Group : @NRbotsZ
"""
RENAME_403_ERR = "Sorry. You are not permitted to rename this file."
ABS_TEXT = " Please don't be selfish."
@@ -26,8 +26,8 @@ class Translation(object):
UPLOAD_START = "Trying To Upload"
RCHD_BOT_API_LIMIT = "size greater than maximum allowed size (50MB). Neverthless, trying to upload."
RCHD_TG_API_LIMIT = "Downloaded in {} seconds.\nDetected File Size: {}\nSorry. But, I cannot upload files greater than 1.5GB due to Telegram API limitations."
- AFTER_SUCCESSFUL_UPLOAD_MSG = "Please rate me if you find me useful. Join : @NMBotsZ"
- AFTER_SUCCESSFUL_UPLOAD_MSG_WITH_TS = "Downloaded in {} seconds. \nJoin : @NMBotsZ \nUploaded in {} seconds."
+ AFTER_SUCCESSFUL_UPLOAD_MSG = "Please rate me if you find me useful. Join : @NRBotsZ"
+ AFTER_SUCCESSFUL_UPLOAD_MSG_WITH_TS = "Downloaded in {} seconds. \nJoin : @NRBotsZ \nUploaded in {} seconds."
NOT_AUTH_USER_TEXT = "Please /upgrade your subscription."
NOT_AUTH_USER_TEXT_FILE_SIZE = "Detected File Size: {}. Free Users can only upload: {}\nPlease /upgrade your subscription.\nIf you think this is a bug, please contact @SpEcHlDe"
SAVED_CUSTOM_THUMB_NAIL = "Custom video / file thumbnail saved. This image will be used in the video / file."
@@ -64,7 +64,7 @@ class Translation(object):
REPLY_TO_DOC_FOR_C2V = "Reply to a Telegram media to convert"
REPLY_TO_DOC_FOR_SCSS = "Reply to a Telegram media to get screenshots"
REPLY_TO_DOC_FOR_RENAME_FILE = "Reply to a Telegram media to /rename with custom thumbnail support"
- AFTER_GET_DL_LINK = "Direct Link Generated valid for {} days.\n© @NMbotsZ"
+ AFTER_GET_DL_LINK = "Direct Link Generated valid for {} days.\n© @NRbotsZ"
FF_MPEG_RO_BOT_RE_SURRECT_ED = """Syntax: /trim HH:MM:SS [HH:MM:SS]"""
FF_MPEG_RO_BOT_STEP_TWO_TO_ONE = "First send /downloadmedia to any media so that it can be downloaded to my local. \nSend /storageinfo to know the media, that is currently downloaded."
FF_MPEG_RO_BOT_STOR_AGE_INFO = "Video Duration: {}\nSend /clearffmpegmedia to delete this media, from my storage.\nSend /trim HH:MM:SS [HH:MM:SS] to cu[l]t a small photo / video, from the above media."
@@ -75,11 +75,11 @@ class Translation(object):
ERR_ONLY_TWO_MEDIA_IN_ALBUM = "Media Album should contain only two photos. Please re-send the media album, and then try again, or send only two photos in an album."
INVALID_UPLOAD_BOT_URL_FORMAT = "URL format is incorrect. make sure your url starts with either http:// or https://. You can set custom file name using the format link | file_name.extension"
ABUSIVE_USERS = "You are not allowed to use this bot. If you think this is a mistake, please check /me to remove this restriction."
- FF_MPEG_RO_BOT_AD_VER_TISE_MENT = "https://telegram.dog/NMbotsZ"
+ FF_MPEG_RO_BOT_AD_VER_TISE_MENT = "https://telegram.dog/NRbotsZ"
EXTRACT_ZIP_INTRO_ONE = "Send a compressed file first, Then reply /unzip command to the file."
EXTRACT_ZIP_INTRO_THREE = "Analyzing received file. ⚠️ This might take some time. Please be patient. "
UNZIP_SUPPORTED_EXTENSIONS = ("zip", "rar")
- EXTRACT_ZIP_ERRS_OCCURED = "Sorry. Errors occurred while processing compressed file. Please check everything again twice, and if the issue persists, report this to @NMbotsZ"
+ EXTRACT_ZIP_ERRS_OCCURED = "Sorry. Errors occurred while processing compressed file. Please check everything again twice, and if the issue persists, report this to @NRbotsZ"
EXTRACT_ZIP_STEP_TWO = """Select file_name to upload from the below options.
You can use /rename command after receiving file to rename it with custom thumbnail support."""
CANCEL_STR = "Process Cancelled"
From e6c447f832dd37355edd4a39b027ec42439359bc Mon Sep 17 00:00:00 2001
From: Kannada-bot <57821193+Kannada-bot@users.noreply.github.com>
Date: Mon, 18 May 2020 23:38:53 +0530
Subject: [PATCH 19/36] Update generate_screen_shot.py
---
plugins/generate_screen_shot.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/plugins/generate_screen_shot.py b/plugins/generate_screen_shot.py
index 0161b61c3..cb9c62355 100644
--- a/plugins/generate_screen_shot.py
+++ b/plugins/generate_screen_shot.py
@@ -83,7 +83,7 @@ async def generate_screen_shot(bot, update):
media_album_p = []
if images is not None:
i = 0
- caption = "© @NMbotsZ"
+ caption = "© @NRbotsZ"
for image in images:
if os.path.exists(image):
if i == 0:
From 6b03a117906aea990b5bca5da8a6f4590acc5069 Mon Sep 17 00:00:00 2001
From: Kannada-bot <57821193+Kannada-bot@users.noreply.github.com>
Date: Mon, 18 May 2020 23:39:28 +0530
Subject: [PATCH 20/36] Update youtube_dl_button.py
---
plugins/youtube_dl_button.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/plugins/youtube_dl_button.py b/plugins/youtube_dl_button.py
index 71b1cb805..2522ae9ce 100644
--- a/plugins/youtube_dl_button.py
+++ b/plugins/youtube_dl_button.py
@@ -322,7 +322,7 @@ async def youtube_dl_call_back(bot, update):
media_album_p = []
if images is not None:
i = 0
- caption = "© @NMBotsZ"
+ caption = "© @NRBotsZ"
if is_w_f:
caption = "/upgrade to Plan D to remove the watermark\n© @AnyDLBot"
for image in images:
From b72cbab75682f85c5032d81f592cf09bf4b87ecf Mon Sep 17 00:00:00 2001
From: Kannada-bot <57821193+Kannada-bot@users.noreply.github.com>
Date: Fri, 22 May 2020 00:06:25 +0530
Subject: [PATCH 21/36] Create unzip.py
---
plugins/unzip.py | 150 +++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 150 insertions(+)
create mode 100644 plugins/unzip.py
diff --git a/plugins/unzip.py b/plugins/unzip.py
new file mode 100644
index 000000000..c3516c554
--- /dev/null
+++ b/plugins/unzip.py
@@ -0,0 +1,150 @@
+
+#!/usr/bin/env python3
+# -*- coding: utf-8 -*-
+# (c) Shrimadhav U K
+
+# the logging things
+import logging
+logging.basicConfig(level=logging.DEBUG,
+ format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
+logger = logging.getLogger(__name__)
+
+import os
+import shutil
+import subprocess
+import time
+
+# the secret configuration specific things
+if bool(os.environ.get("WEBHOOK", False)):
+ from sample_config import Config
+else:
+ from config import Config
+
+# the Strings used for this "thing"
+from translation import Translation
+
+import pyrogram
+logging.getLogger("pyrogram").setLevel(logging.WARNING)
+
+from helper_funcs.chat_base import TRChatBase
+from helper_funcs.display_progress import progress_for_pyrogram, humanbytes
+
+
+@pyrogram.Client.on_message(pyrogram.Filters.command(["unzip"]))
+async def unzip(bot, update):
+ TRChatBase(update.from_user.id, update.text, "unzip")
+ if str(update.from_user.id) not in Config.SUPER7X_DLBOT_USERS:
+ await bot.send_message(
+ chat_id=update.chat.id,
+ text=Translation.NOT_AUTH_USER_TEXT,
+ reply_to_message_id=update.message_id
+ )
+ return
+ saved_file_path = Config.DOWNLOAD_LOCATION + \
+ "/" + str(update.from_user.id) + ".unzip.zip"
+ if os.path.exists(saved_file_path):
+ os.remove(saved_file_path)
+ reply_message = update.reply_to_message
+ if ((reply_message is not None) and
+ (reply_message.document is not None) and
+ (reply_message.document.file_name.endswith(Translation.UNZIP_SUPPORTED_EXTENSIONS))):
+ a = await bot.send_message(
+ chat_id=update.chat.id,
+ text=Translation.DOWNLOAD_START,
+ reply_to_message_id=update.message_id
+ )
+ c_time = time.time()
+ try:
+ await bot.download_media(
+ message=reply_message,
+ file_name=saved_file_path,
+ progress=progress_for_pyrogram,
+ progress_args=(Translation.DOWNLOAD_START, a.message_id, update.chat.id, c_time)
+ )
+ except (ValueError) as e:
+ await bot.edit_message_text(
+ chat_id=update.chat.id,
+ text=str(e),
+ message_id=a.message_id
+ )
+ else:
+ await bot.edit_message_text(
+ chat_id=update.chat.id,
+ text=Translation.SAVED_RECVD_DOC_FILE,
+ message_id=a.message_id
+ )
+ extract_dir_path = Config.DOWNLOAD_LOCATION + \
+ "/" + str(update.from_user.id) + "zipped" + "/"
+ if not os.path.isdir(extract_dir_path):
+ os.makedirs(extract_dir_path)
+ await bot.edit_message_text(
+ chat_id=update.chat.id,
+ text=Translation.EXTRACT_ZIP_INTRO_THREE,
+ message_id=a.message_id
+ )
+ try:
+ command_to_exec = [
+ "7z",
+ "e",
+ "-o" + extract_dir_path,
+ saved_file_path
+ ]
+ # https://stackoverflow.com/a/39629367/4723940
+ logger.info(command_to_exec)
+ t_response = subprocess.check_output(
+ command_to_exec, stderr=subprocess.STDOUT)
+ # https://stackoverflow.com/a/26178369/4723940
+ except:
+ try:
+ os.remove(saved_file_path)
+ shutil.rmtree(extract_dir_path)
+ except:
+ pass
+ await bot.edit_message_text(
+ chat_id=update.chat.id,
+ text=Translation.EXTRACT_ZIP_ERRS_OCCURED,
+ disable_web_page_preview=True,
+ parse_mode="html",
+ message_id=a.message_id
+ )
+ else:
+ os.remove(saved_file_path)
+ inline_keyboard = []
+ zip_file_contents = os.listdir(extract_dir_path)
+ i = 0
+ for current_file in zip_file_contents:
+ cb_string = "ZIP:{}:ZIP".format(str(i))
+ inline_keyboard.append([
+ pyrogram.InlineKeyboardButton(
+ current_file,
+ callback_data=cb_string.encode("UTF-8")
+ )
+ ])
+ i = i + 1
+ cb_string = "ZIP:{}:ZIP".format("ALL")
+ inline_keyboard.append([
+ pyrogram.InlineKeyboardButton(
+ "Upload All Files",
+ callback_data=cb_string.encode("UTF-8")
+ )
+ ])
+ cb_string = "ZIP:{}:ZIP".format("NONE")
+ inline_keyboard.append([
+ pyrogram.InlineKeyboardButton(
+ "Cancel",
+ callback_data=cb_string.encode("UTF-8")
+ )
+ ])
+ reply_markup = pyrogram.InlineKeyboardMarkup(inline_keyboard)
+ await bot.edit_message_text(
+ chat_id=update.chat.id,
+ text=Translation.EXTRACT_ZIP_STEP_TWO,
+ message_id=a.message_id,
+ reply_markup=reply_markup,
+ )
+ else:
+ await bot.send_message(
+ chat_id=update.chat.id,
+ text=Translation.EXTRACT_ZIP_INTRO_ONE,
+ reply_to_message_id=update.message_id
+ )
From 827928f80b0d1a10c0dba4ea6b65271b94e6a422 Mon Sep 17 00:00:00 2001
From: Kannada-bot <57821193+Kannada-bot@users.noreply.github.com>
Date: Fri, 22 May 2020 00:07:28 +0530
Subject: [PATCH 22/36] Create extract_streams.py
---
plugins/extract_streams.py | 75 ++++++++++++++++++++++++++++++++++++++
1 file changed, 75 insertions(+)
create mode 100644 plugins/extract_streams.py
diff --git a/plugins/extract_streams.py b/plugins/extract_streams.py
new file mode 100644
index 000000000..ab5ca9bec
--- /dev/null
+++ b/plugins/extract_streams.py
@@ -0,0 +1,75 @@
+#!/usr/bin/env python3
+# -*- coding: utf-8 -*-
+# (c) Shrimadhav U K
+
+# the logging things
+import logging
+logging.basicConfig(level=logging.DEBUG,
+ format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
+logger = logging.getLogger(__name__)
+
+import asyncio
+import os
+import time
+
+# the secret configuration specific things
+if bool(os.environ.get("WEBHOOK", False)):
+ from sample_config import Config
+else:
+ from config import Config
+
+# the Strings used for this "thing"
+from translation import Translation
+
+import pyrogram
+logging.getLogger("pyrogram").setLevel(logging.WARNING)
+
+from helper_funcs.chat_base import TRChatBase
+from helper_funcs.display_progress import progress_for_pyrogram
+
+
+@pyrogram.Client.on_message(pyrogram.Filters.command(["extractstreams"]))
+async def extract_sub_title(bot, update):
+ TRChatBase(update.from_user.id, update.text, "extract_st_reams")
+ if str(update.from_user.id) not in Config.SUPER7X_DLBOT_USERS:
+ await bot.send_message(
+ chat_id=update.chat.id,
+ text=Translation.NOT_AUTH_USER_TEXT,
+ reply_to_message_id=update.message_id
+ )
+ return
+ if update.reply_to_message is not None:
+ download_location = Config.DOWNLOAD_LOCATION + "/"
+ a = await bot.send_message(
+ chat_id=update.chat.id,
+ text=Translation.DOWNLOAD_START,
+ reply_to_message_id=update.message_id
+ )
+ c_time = time.time()
+ the_real_download_location = await bot.download_media(
+ message=update.reply_to_message,
+ file_name=download_location,
+ progress=progress_for_pyrogram,
+ progress_args=(
+ Translation.DOWNLOAD_START, a.message_id, update.chat.id, c_time
+ )
+ )
+ if the_real_download_location is not None:
+ await bot.edit_message_text(
+ text=Translation.SAVED_RECVD_DOC_FILE,
+ chat_id=update.chat.id,
+ message_id=a.message_id
+ )
+ logger.info(the_real_download_location)
+ await bot.edit_message_text(
+ text=Translation.AFTER_SUCCESSFUL_UPLOAD_MSG,
+ chat_id=update.chat.id,
+ message_id=a.message_id,
+ disable_web_page_preview=True
+ )
+ else:
+ await bot.send_message(
+ chat_id=update.chat.id,
+ text=Translation.REPLY_TO_DOC_OR_LINK_FOR_RARX_SRT,
+ reply_to_message_id=update.message_id
+ )
From ff9ee57a5556edcfc1799dcfc5900fec6cc9873b Mon Sep 17 00:00:00 2001
From: Kannada-bot <57821193+Kannada-bot@users.noreply.github.com>
Date: Fri, 22 May 2020 00:09:57 +0530
Subject: [PATCH 23/36] Create _core.py
---
plugins/_core.py | 470 +++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 470 insertions(+)
create mode 100644 plugins/_core.py
diff --git a/plugins/_core.py b/plugins/_core.py
new file mode 100644
index 000000000..5dd4d59d0
--- /dev/null
+++ b/plugins/_core.py
@@ -0,0 +1,470 @@
+#!/usr/bin/env python3
+# -*- coding: utf-8 -*-
+# (c) Shrimadhav U K
+
+# the logging things
+import logging
+logging.basicConfig(level=logging.DEBUG,
+ format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
+logger = logging.getLogger(__name__)
+
+import json
+import math
+import os
+import requests
+import subprocess
+import time
+
+# the secret configuration specific things
+if bool(os.environ.get("WEBHOOK", False)):
+ from sample_config import Config
+else:
+ from config import Config
+
+# the Strings used for this "thing"
+from translation import Translation
+
+import pyrogram
+logging.getLogger("pyrogram").setLevel(logging.WARNING)
+
+from helper_funcs.chat_base import TRChatBase
+from helper_funcs.display_progress import progress_for_pyrogram, humanbytes
+from helper_funcs.help_uploadbot import DownLoadFile, DetectFileSize
+
+from hachoir.metadata import extractMetadata
+from hachoir.parser import createParser
+# https://stackoverflow.com/a/37631799/4723940
+from PIL import Image
+
+
+@pyrogram.Client.on_message(pyrogram.Filters.regex(pattern=".*http.*"))
+def echo(bot, update):
+ # logger.info(update)
+ TRChatBase(update.from_user.id, update.text, "/echo")
+ # bot.send_chat_action(
+ # chat_id=update.chat.id,
+ # action="typing"
+ # )
+ logger.info(update.from_user)
+ if str(update.from_user.id) in Config.BANNED_USERS:
+ bot.send_message(
+ chat_id=update.chat.id,
+ text=Translation.ABUSIVE_USERS,
+ reply_to_message_id=update.message_id,
+ disable_web_page_preview=True,
+ parse_mode="html"
+ )
+ return
+ url = update.text
+ if "http" in url:
+ if "|" in url:
+ url, file_name = url.split("|")
+ url = url.strip()
+ # https://stackoverflow.com/a/761825/4723940
+ file_name = file_name.strip()
+ logger.info(url)
+ logger.info(file_name)
+ else:
+ for entity in update.entities:
+ if entity.type == "text_link":
+ url = entity.url
+ elif entity.type == "url":
+ o = entity.offset
+ l = entity.length
+ url = url[o:o + l]
+ try:
+ if ("hotstar.com" in url) and (Config.HTTP_PROXY != ""):
+ command_to_exec = [
+ "youtube-dl",
+ "--no-warnings",
+ "--youtube-skip-dash-manifest",
+ "-j",
+ url,
+ "--proxy", Config.HTTP_PROXY
+ ]
+ else:
+ command_to_exec = [
+ "youtube-dl",
+ "--no-warnings",
+ "--youtube-skip-dash-manifest",
+ "-j",
+ url
+ ]
+ logger.info(command_to_exec)
+ t_response = subprocess.check_output(
+ command_to_exec, stderr=subprocess.STDOUT)
+ # https://github.com/rg3/youtube-dl/issues/2630#issuecomment-38635239
+ except subprocess.CalledProcessError as exc:
+ # print("Status : FAIL", exc.returncode, exc.output)
+ bot.send_message(
+ chat_id=update.chat.id,
+ text=exc.output.decode("UTF-8"),
+ reply_to_message_id=update.message_id
+ )
+ else:
+ # logger.info(t_response)
+ x_reponse = t_response.decode("UTF-8")
+ response_json = json.loads(x_reponse)
+ save_ytdl_json_path = Config.DOWNLOAD_LOCATION + \
+ "/" + str(update.from_user.id) + ".json"
+ with open(save_ytdl_json_path, "w", encoding="utf8") as outfile:
+ json.dump(response_json, outfile, ensure_ascii=False)
+ # logger.info(response_json)
+ inline_keyboard = []
+ duration = None
+ if "duration" in response_json:
+ duration = response_json["duration"]
+ if "formats" in response_json:
+ for formats in response_json["formats"]:
+ format_id = formats.get("format_id")
+ format_string = formats.get("format_note")
+ if format_string is None:
+ format_string = formats.get("format")
+ format_ext = formats.get("ext")
+ approx_file_size = ""
+ if "filesize" in formats:
+ approx_file_size = humanbytes(formats["filesize"])
+ cb_string_video = "{}|{}|{}".format(
+ "video", format_id, format_ext)
+ cb_string_file = "{}|{}|{}".format(
+ "file", format_id, format_ext)
+ if format_string is not None and not "audio only" in format_string:
+ ikeyboard = [
+ pyrogram.InlineKeyboardButton(
+ "S" + format_ext + "Video [" + format_string +
+ "] ( " +
+ approx_file_size + " )",
+ callback_data=(cb_string_video).encode("UTF-8")
+ ),
+ pyrogram.InlineKeyboardButton(
+ "D" + format_ext + "File [" + format_string +
+ "] ( " +
+ approx_file_size + " )",
+ callback_data=(cb_string_file).encode("UTF-8")
+ )
+ ]
+ if duration is not None and duration <= 30:
+ cb_string_video_message = "{}|{}|{}".format(
+ "vm", format_id, format_ext)
+ ikeyboard.append(
+ pyrogram.InlineKeyboardButton(
+ "VMessage [" + format_string +
+ "] ( " +
+ approx_file_size + " )",
+ callback_data=(
+ cb_string_video_message).encode("UTF-8")
+ )
+ )
+ else:
+ # special weird case :\
+ ikeyboard = [
+ pyrogram.InlineKeyboardButton(
+ "SVideo [" +
+ "] ( " +
+ approx_file_size + " )",
+ callback_data=(cb_string_video).encode("UTF-8")
+ ),
+ pyrogram.InlineKeyboardButton(
+ "DFile [" +
+ "] ( " +
+ approx_file_size + " )",
+ callback_data=(cb_string_file).encode("UTF-8")
+ )
+ ]
+ inline_keyboard.append(ikeyboard)
+ if duration is not None:
+ cb_string_64 = "{}|{}|{}".format("audio", "64k", "mp3")
+ cb_string_128 = "{}|{}|{}".format("audio", "128k", "mp3")
+ cb_string = "{}|{}|{}".format("audio", "320k", "mp3")
+ inline_keyboard.append([
+ pyrogram.InlineKeyboardButton(
+ "MP3 " + "(" + "64 kbps" + ")", callback_data=cb_string_64.encode("UTF-8")),
+ pyrogram.InlineKeyboardButton(
+ "MP3 " + "(" + "128 kbps" + ")", callback_data=cb_string_128.encode("UTF-8"))
+ ])
+ inline_keyboard.append([
+ pyrogram.InlineKeyboardButton(
+ "MP3 " + "(" + "320 kbps" + ")", callback_data=cb_string.encode("UTF-8"))
+ ])
+ else:
+ format_id = response_json["format_id"]
+ format_ext = response_json["ext"]
+ tg_send_type = "file"
+ if duration is not None:
+ tg_send_type = "video"
+ cb_string = "{}|{}|{}".format(
+ tg_send_type, format_id, format_ext)
+ inline_keyboard.append([
+ pyrogram.InlineKeyboardButton(
+ "unknown format", callback_data=cb_string.encode("UTF-8"))
+ ])
+ reply_markup = pyrogram.InlineKeyboardMarkup(inline_keyboard)
+ # logger.info(reply_markup)
+ thumbnail = Config.DEF_THUMB_NAIL_VID_S
+ thumbnail_image = Config.DEF_THUMB_NAIL_VID_S
+ if "thumbnail" in response_json:
+ if response_json["thumbnail"] is not None:
+ thumbnail = response_json["thumbnail"]
+ thumbnail_image = response_json["thumbnail"]
+ thumb_image_path = DownLoadFile(
+ thumbnail_image,
+ Config.DOWNLOAD_LOCATION + "/" +
+ str(update.from_user.id) + ".jpg",
+ Config.CHUNK_SIZE,
+ None, # bot,
+ Translation.DOWNLOAD_START,
+ update.message_id,
+ update.chat.id
+ )
+ bot.send_message(
+ chat_id=update.chat.id,
+ text=Translation.FORMAT_SELECTION.format(thumbnail),
+ reply_markup=reply_markup,
+ parse_mode="html",
+ reply_to_message_id=update.message_id
+ )
+ else:
+ bot.send_message(
+ chat_id=update.chat.id,
+ text=Translation.INVALID_UPLOAD_BOT_URL_FORMAT,
+ reply_to_message_id=update.message_id
+ )
+
+
+@pyrogram.Client.on_callback_query()
+def button(bot, update):
+ # logger.info(update)
+ if str(update.from_user.id) in Config.BANNED_USERS:
+ bot.edit_message_text(
+ chat_id=update.message.chat.id,
+ text=Translation.ABUSIVE_USERS,
+ message_id=update.message.message_id,
+ disable_web_page_preview=True,
+ parse_mode="html"
+ )
+ return
+ cb_data = update.data.decode("UTF-8")
+ if cb_data.find("|") == -1:
+ return ""
+ tg_send_type, youtube_dl_format, youtube_dl_ext = cb_data.split("|")
+ thumb_image_path = Config.DOWNLOAD_LOCATION + \
+ "/" + str(update.from_user.id) + ".jpg"
+ save_ytdl_json_path = Config.DOWNLOAD_LOCATION + \
+ "/" + str(update.from_user.id) + ".json"
+ try:
+ with open(save_ytdl_json_path, "r") as f:
+ response_json = json.load(f)
+ except (FileNotFoundError) as e:
+ bot.delete_messages(
+ chat_id=update.message.chat.id,
+ message_ids=update.message.message_id,
+ revoke=True
+ )
+ return False
+ youtube_dl_url = update.message.reply_to_message.text
+ custom_file_name = str(response_json.get("title")) + \
+ "_" + youtube_dl_format
+ if "|" in youtube_dl_url:
+ youtube_dl_url, custom_file_name = youtube_dl_url.split("|")
+ else:
+ for entity in update.message.reply_to_message.entities:
+ if entity.type == "text_link":
+ youtube_dl_url = entity.url
+ elif entity.type == "url":
+ o = entity.offset
+ l = entity.length
+ youtube_dl_url = youtube_dl_url[o:o + l]
+ if (str(update.from_user.id) not in Config.UTUBE_BOT_USERS) and (("hls" in youtube_dl_format) or ("hotstar.com" in youtube_dl_url)):
+ bot.edit_message_text(
+ chat_id=update.message.chat.id,
+ text=Translation.NOT_AUTH_USER_TEXT,
+ message_id=update.message.message_id
+ )
+ return
+ if "noyes.in" in youtube_dl_url:
+ bot.edit_message_text(
+ chat_id=update.message.chat.id,
+ text=Translation.NOYES_URL,
+ message_id=update.message.message_id
+ )
+ return
+ bot.edit_message_text(
+ text=Translation.DOWNLOAD_START,
+ chat_id=update.message.chat.id,
+ message_id=update.message.message_id
+ )
+ description = Translation.CUSTOM_CAPTION_UL_FILE
+ if "fulltitle" in response_json:
+ description = response_json["fulltitle"][0:1021]
+ if ("@" in custom_file_name) and (str(update.from_user.id) not in Config.UTUBE_BOT_USERS):
+ bot.edit_message_text(
+ chat_id=update.message.chat.id,
+ text=Translation.NOT_AUTH_USER_TEXT,
+ message_id=update.message.message_id
+ )
+ return
+ download_directory = Config.DOWNLOAD_LOCATION + "/" + custom_file_name + "." + youtube_dl_ext + ""
+ command_to_exec = []
+ if tg_send_type == "audio":
+ command_to_exec = [
+ "youtube-dl",
+ "-c",
+ "--prefer-ffmpeg",
+ "--extract-audio",
+ "--audio-format", youtube_dl_ext,
+ "--audio-quality", youtube_dl_format,
+ youtube_dl_url,
+ "-o", download_directory
+ ]
+ else:
+ download_directory_one = Config.DOWNLOAD_LOCATION + "/" + custom_file_name
+ # command_to_exec = ["youtube-dl", "-f", youtube_dl_format, "--hls-prefer-ffmpeg", "--recode-video", "mp4", "-k", youtube_dl_url, "-o", download_directory]
+ minus_f_format = youtube_dl_format
+ if "youtu" in youtube_dl_url:
+ minus_f_format = youtube_dl_format + "+bestaudio"
+ command_to_exec = [
+ "youtube-dl",
+ "-c",
+ "--embed-subs",
+ "-f", minus_f_format,
+ "--hls-prefer-ffmpeg", youtube_dl_url,
+ "-o", download_directory
+ ]
+ if "hotstar.com" in youtube_dl_url and Config.HTTP_PROXY != "":
+ command_to_exec.append("--proxy")
+ command_to_exec.append(Config.HTTP_PROXY)
+ logger.info(command_to_exec)
+ try:
+ t_response = subprocess.check_output(
+ command_to_exec, stderr=subprocess.STDOUT)
+ except subprocess.CalledProcessError as exc:
+ logger.info("Status : FAIL", exc.returncode, exc.output)
+ bot.edit_message_text(
+ chat_id=update.message.chat.id,
+ message_id=update.message.message_id,
+ text=exc.output.decode("UTF-8")
+ )
+ else:
+ # logger.info(t_response)
+ os.remove(save_ytdl_json_path)
+ bot.edit_message_text(
+ text=Translation.UPLOAD_START,
+ chat_id=update.message.chat.id,
+ message_id=update.message.message_id
+ )
+ file_size = Config.TG_MAX_FILE_SIZE + 1
+ try:
+ file_size = os.stat(download_directory).st_size
+ except FileNotFoundError as exc:
+ download_directory = download_directory_one + "." + "mkv"
+ file_size = os.stat(download_directory).st_size
+ if file_size > Config.TG_MAX_FILE_SIZE:
+ bot.edit_message_text(
+ chat_id=update.message.chat.id,
+ text=Translation.RCHD_TG_API_LIMIT,
+ message_id=update.message.message_id
+ )
+ else:
+ # get the correct width, height, and duration for videos greater than 10MB
+ # ref: message from @BotSupport
+ width = 0
+ height = 0
+ duration = 0
+ if tg_send_type != "file":
+ metadata = extractMetadata(createParser(download_directory))
+ if metadata.has("duration"):
+ duration = metadata.get('duration').seconds
+ # get the correct width, height, and duration for videos greater than 10MB
+ if os.path.exists(thumb_image_path):
+ width = 0
+ height = 0
+ metadata = extractMetadata(createParser(thumb_image_path))
+ if metadata.has("width"):
+ width = metadata.get("width")
+ if metadata.has("height"):
+ height = metadata.get("height")
+ # resize image
+ # ref: https://t.me/PyrogramChat/44663
+ # https://stackoverflow.com/a/21669827/4723940
+ Image.open(thumb_image_path).convert(
+ "RGB").save(thumb_image_path)
+ img = Image.open(thumb_image_path)
+ # https://stackoverflow.com/a/37631799/4723940
+ img.thumbnail((90, 90))
+ img.save(thumb_image_path, "JPEG")
+ # https://pillow.readthedocs.io/en/3.1.x/reference/Image.html#create-thumbnails
+ else:
+ thumb_image_path = None
+ # try to upload file
+ if tg_send_type == "audio":
+ starts = time.time()
+ bot.send_audio(
+ chat_id=update.message.chat.id,
+ audio=download_directory,
+ caption=description,
+ duration=duration,
+ # performer=response_json["uploader"],
+ # title=response_json["title"],
+ # reply_markup=reply_markup,
+ thumb=thumb_image_path,
+ reply_to_message_id=update.message.reply_to_message.message_id,
+ progress=progress_for_pyrogram,
+ progress_args=(
+ Translation.UPLOAD_START, update.message.message_id, update.message.chat.id, starts)
+ )
+ elif tg_send_type == "file":
+ starts = time.time()
+ bot.send_document(
+ chat_id=update.message.chat.id,
+ document=download_directory,
+ thumb=thumb_image_path,
+ caption=description,
+ # reply_markup=reply_markup,
+ reply_to_message_id=update.message.reply_to_message.message_id,
+ progress=progress_for_pyrogram,
+ progress_args=(
+ Translation.UPLOAD_START, update.message.message_id, update.message.chat.id, starts)
+ )
+ elif tg_send_type == "vm":
+ starts = time.time()
+ bot.send_video_note(
+ chat_id=update.message.chat.id,
+ video_note=download_directory,
+ duration=duration,
+ length=width,
+ thumb=thumb_image_path,
+ reply_to_message_id=update.message.reply_to_message.message_id,
+ progress=progress_for_pyrogram,
+ progress_args=(
+ Translation.UPLOAD_START, update.message.message_id, update.message.chat.id, starts)
+ )
+ elif tg_send_type == "video":
+ starts = time.time()
+ bot.send_video(
+ chat_id=update.message.chat.id,
+ video=download_directory,
+ caption=description,
+ duration=duration,
+ width=width,
+ height=height,
+ supports_streaming=True,
+ # reply_markup=reply_markup,
+ thumb=thumb_image_path,
+ reply_to_message_id=update.message.reply_to_message.message_id,
+ progress=progress_for_pyrogram,
+ progress_args=(
+ Translation.UPLOAD_START, update.message.message_id, update.message.chat.i, startsd)
+ )
+ else:
+ logger.info("Did this happen? :\\")
+ try:
+ os.remove(download_directory)
+ os.remove(thumb_image_path)
+ except:
+ pass
+ bot.edit_message_text(
+ text=Translation.AFTER_SUCCESSFUL_UPLOAD_MSG,
+ chat_id=update.message.chat.id,
+ message_id=update.message.message_id,
+ disable_web_page_preview=True
+ )
From 77b1b118a402bcb11f3af8166115d709447c9cd7 Mon Sep 17 00:00:00 2001
From: Kannada-bot <57821193+Kannada-bot@users.noreply.github.com>
Date: Fri, 22 May 2020 00:12:09 +0530
Subject: [PATCH 24/36] Update translation.py
---
translation.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/translation.py b/translation.py
index 87ab53430..14c1b8def 100644
--- a/translation.py
+++ b/translation.py
@@ -53,12 +53,12 @@ class Translation(object):
Video - Give File as video without Screenshots
DFile - Give File without Screenshots
-Join: @NMBotsZ
+Join: @NRBotsZ
--------
Send /me to know current plan details
-Support Group : @NMBotsZ
+Support Group : @NRBotsZ
"""
REPLY_TO_DOC_GET_LINK = "Reply to a Telegram media to get High Speed Direct Download Link"
REPLY_TO_DOC_FOR_C2V = "Reply to a Telegram media to convert"
From fe51c65ab3e16d9a19308c6de5609a5ee566633f Mon Sep 17 00:00:00 2001
From: Kannada-bot <57821193+Kannada-bot@users.noreply.github.com>
Date: Fri, 22 May 2020 00:13:14 +0530
Subject: [PATCH 25/36] Update translation.py
---
translation.py | 1 +
1 file changed, 1 insertion(+)
diff --git a/translation.py b/translation.py
index 14c1b8def..f0d24e819 100644
--- a/translation.py
+++ b/translation.py
@@ -8,6 +8,7 @@ class Translation(object):
1. Send me any Telegram File.
2. Reply to that message to /rename new name.extension.
+And much more things like unzip,convert to audio, convert to video,rename,url upload etc..
I can do still many more things check commands.
From be3ebaa0722e4d71ea617cafe0b03c9a0e3eb9ff Mon Sep 17 00:00:00 2001
From: Kannada-bot <57821193+Kannada-bot@users.noreply.github.com>
Date: Sat, 23 May 2020 12:34:57 +0530
Subject: [PATCH 26/36] Delete _core.py
---
plugins/_core.py | 470 -----------------------------------------------
1 file changed, 470 deletions(-)
delete mode 100644 plugins/_core.py
diff --git a/plugins/_core.py b/plugins/_core.py
deleted file mode 100644
index 5dd4d59d0..000000000
--- a/plugins/_core.py
+++ /dev/null
@@ -1,470 +0,0 @@
-#!/usr/bin/env python3
-# -*- coding: utf-8 -*-
-# (c) Shrimadhav U K
-
-# the logging things
-import logging
-logging.basicConfig(level=logging.DEBUG,
- format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
-logger = logging.getLogger(__name__)
-
-import json
-import math
-import os
-import requests
-import subprocess
-import time
-
-# the secret configuration specific things
-if bool(os.environ.get("WEBHOOK", False)):
- from sample_config import Config
-else:
- from config import Config
-
-# the Strings used for this "thing"
-from translation import Translation
-
-import pyrogram
-logging.getLogger("pyrogram").setLevel(logging.WARNING)
-
-from helper_funcs.chat_base import TRChatBase
-from helper_funcs.display_progress import progress_for_pyrogram, humanbytes
-from helper_funcs.help_uploadbot import DownLoadFile, DetectFileSize
-
-from hachoir.metadata import extractMetadata
-from hachoir.parser import createParser
-# https://stackoverflow.com/a/37631799/4723940
-from PIL import Image
-
-
-@pyrogram.Client.on_message(pyrogram.Filters.regex(pattern=".*http.*"))
-def echo(bot, update):
- # logger.info(update)
- TRChatBase(update.from_user.id, update.text, "/echo")
- # bot.send_chat_action(
- # chat_id=update.chat.id,
- # action="typing"
- # )
- logger.info(update.from_user)
- if str(update.from_user.id) in Config.BANNED_USERS:
- bot.send_message(
- chat_id=update.chat.id,
- text=Translation.ABUSIVE_USERS,
- reply_to_message_id=update.message_id,
- disable_web_page_preview=True,
- parse_mode="html"
- )
- return
- url = update.text
- if "http" in url:
- if "|" in url:
- url, file_name = url.split("|")
- url = url.strip()
- # https://stackoverflow.com/a/761825/4723940
- file_name = file_name.strip()
- logger.info(url)
- logger.info(file_name)
- else:
- for entity in update.entities:
- if entity.type == "text_link":
- url = entity.url
- elif entity.type == "url":
- o = entity.offset
- l = entity.length
- url = url[o:o + l]
- try:
- if ("hotstar.com" in url) and (Config.HTTP_PROXY != ""):
- command_to_exec = [
- "youtube-dl",
- "--no-warnings",
- "--youtube-skip-dash-manifest",
- "-j",
- url,
- "--proxy", Config.HTTP_PROXY
- ]
- else:
- command_to_exec = [
- "youtube-dl",
- "--no-warnings",
- "--youtube-skip-dash-manifest",
- "-j",
- url
- ]
- logger.info(command_to_exec)
- t_response = subprocess.check_output(
- command_to_exec, stderr=subprocess.STDOUT)
- # https://github.com/rg3/youtube-dl/issues/2630#issuecomment-38635239
- except subprocess.CalledProcessError as exc:
- # print("Status : FAIL", exc.returncode, exc.output)
- bot.send_message(
- chat_id=update.chat.id,
- text=exc.output.decode("UTF-8"),
- reply_to_message_id=update.message_id
- )
- else:
- # logger.info(t_response)
- x_reponse = t_response.decode("UTF-8")
- response_json = json.loads(x_reponse)
- save_ytdl_json_path = Config.DOWNLOAD_LOCATION + \
- "/" + str(update.from_user.id) + ".json"
- with open(save_ytdl_json_path, "w", encoding="utf8") as outfile:
- json.dump(response_json, outfile, ensure_ascii=False)
- # logger.info(response_json)
- inline_keyboard = []
- duration = None
- if "duration" in response_json:
- duration = response_json["duration"]
- if "formats" in response_json:
- for formats in response_json["formats"]:
- format_id = formats.get("format_id")
- format_string = formats.get("format_note")
- if format_string is None:
- format_string = formats.get("format")
- format_ext = formats.get("ext")
- approx_file_size = ""
- if "filesize" in formats:
- approx_file_size = humanbytes(formats["filesize"])
- cb_string_video = "{}|{}|{}".format(
- "video", format_id, format_ext)
- cb_string_file = "{}|{}|{}".format(
- "file", format_id, format_ext)
- if format_string is not None and not "audio only" in format_string:
- ikeyboard = [
- pyrogram.InlineKeyboardButton(
- "S" + format_ext + "Video [" + format_string +
- "] ( " +
- approx_file_size + " )",
- callback_data=(cb_string_video).encode("UTF-8")
- ),
- pyrogram.InlineKeyboardButton(
- "D" + format_ext + "File [" + format_string +
- "] ( " +
- approx_file_size + " )",
- callback_data=(cb_string_file).encode("UTF-8")
- )
- ]
- if duration is not None and duration <= 30:
- cb_string_video_message = "{}|{}|{}".format(
- "vm", format_id, format_ext)
- ikeyboard.append(
- pyrogram.InlineKeyboardButton(
- "VMessage [" + format_string +
- "] ( " +
- approx_file_size + " )",
- callback_data=(
- cb_string_video_message).encode("UTF-8")
- )
- )
- else:
- # special weird case :\
- ikeyboard = [
- pyrogram.InlineKeyboardButton(
- "SVideo [" +
- "] ( " +
- approx_file_size + " )",
- callback_data=(cb_string_video).encode("UTF-8")
- ),
- pyrogram.InlineKeyboardButton(
- "DFile [" +
- "] ( " +
- approx_file_size + " )",
- callback_data=(cb_string_file).encode("UTF-8")
- )
- ]
- inline_keyboard.append(ikeyboard)
- if duration is not None:
- cb_string_64 = "{}|{}|{}".format("audio", "64k", "mp3")
- cb_string_128 = "{}|{}|{}".format("audio", "128k", "mp3")
- cb_string = "{}|{}|{}".format("audio", "320k", "mp3")
- inline_keyboard.append([
- pyrogram.InlineKeyboardButton(
- "MP3 " + "(" + "64 kbps" + ")", callback_data=cb_string_64.encode("UTF-8")),
- pyrogram.InlineKeyboardButton(
- "MP3 " + "(" + "128 kbps" + ")", callback_data=cb_string_128.encode("UTF-8"))
- ])
- inline_keyboard.append([
- pyrogram.InlineKeyboardButton(
- "MP3 " + "(" + "320 kbps" + ")", callback_data=cb_string.encode("UTF-8"))
- ])
- else:
- format_id = response_json["format_id"]
- format_ext = response_json["ext"]
- tg_send_type = "file"
- if duration is not None:
- tg_send_type = "video"
- cb_string = "{}|{}|{}".format(
- tg_send_type, format_id, format_ext)
- inline_keyboard.append([
- pyrogram.InlineKeyboardButton(
- "unknown format", callback_data=cb_string.encode("UTF-8"))
- ])
- reply_markup = pyrogram.InlineKeyboardMarkup(inline_keyboard)
- # logger.info(reply_markup)
- thumbnail = Config.DEF_THUMB_NAIL_VID_S
- thumbnail_image = Config.DEF_THUMB_NAIL_VID_S
- if "thumbnail" in response_json:
- if response_json["thumbnail"] is not None:
- thumbnail = response_json["thumbnail"]
- thumbnail_image = response_json["thumbnail"]
- thumb_image_path = DownLoadFile(
- thumbnail_image,
- Config.DOWNLOAD_LOCATION + "/" +
- str(update.from_user.id) + ".jpg",
- Config.CHUNK_SIZE,
- None, # bot,
- Translation.DOWNLOAD_START,
- update.message_id,
- update.chat.id
- )
- bot.send_message(
- chat_id=update.chat.id,
- text=Translation.FORMAT_SELECTION.format(thumbnail),
- reply_markup=reply_markup,
- parse_mode="html",
- reply_to_message_id=update.message_id
- )
- else:
- bot.send_message(
- chat_id=update.chat.id,
- text=Translation.INVALID_UPLOAD_BOT_URL_FORMAT,
- reply_to_message_id=update.message_id
- )
-
-
-@pyrogram.Client.on_callback_query()
-def button(bot, update):
- # logger.info(update)
- if str(update.from_user.id) in Config.BANNED_USERS:
- bot.edit_message_text(
- chat_id=update.message.chat.id,
- text=Translation.ABUSIVE_USERS,
- message_id=update.message.message_id,
- disable_web_page_preview=True,
- parse_mode="html"
- )
- return
- cb_data = update.data.decode("UTF-8")
- if cb_data.find("|") == -1:
- return ""
- tg_send_type, youtube_dl_format, youtube_dl_ext = cb_data.split("|")
- thumb_image_path = Config.DOWNLOAD_LOCATION + \
- "/" + str(update.from_user.id) + ".jpg"
- save_ytdl_json_path = Config.DOWNLOAD_LOCATION + \
- "/" + str(update.from_user.id) + ".json"
- try:
- with open(save_ytdl_json_path, "r") as f:
- response_json = json.load(f)
- except (FileNotFoundError) as e:
- bot.delete_messages(
- chat_id=update.message.chat.id,
- message_ids=update.message.message_id,
- revoke=True
- )
- return False
- youtube_dl_url = update.message.reply_to_message.text
- custom_file_name = str(response_json.get("title")) + \
- "_" + youtube_dl_format
- if "|" in youtube_dl_url:
- youtube_dl_url, custom_file_name = youtube_dl_url.split("|")
- else:
- for entity in update.message.reply_to_message.entities:
- if entity.type == "text_link":
- youtube_dl_url = entity.url
- elif entity.type == "url":
- o = entity.offset
- l = entity.length
- youtube_dl_url = youtube_dl_url[o:o + l]
- if (str(update.from_user.id) not in Config.UTUBE_BOT_USERS) and (("hls" in youtube_dl_format) or ("hotstar.com" in youtube_dl_url)):
- bot.edit_message_text(
- chat_id=update.message.chat.id,
- text=Translation.NOT_AUTH_USER_TEXT,
- message_id=update.message.message_id
- )
- return
- if "noyes.in" in youtube_dl_url:
- bot.edit_message_text(
- chat_id=update.message.chat.id,
- text=Translation.NOYES_URL,
- message_id=update.message.message_id
- )
- return
- bot.edit_message_text(
- text=Translation.DOWNLOAD_START,
- chat_id=update.message.chat.id,
- message_id=update.message.message_id
- )
- description = Translation.CUSTOM_CAPTION_UL_FILE
- if "fulltitle" in response_json:
- description = response_json["fulltitle"][0:1021]
- if ("@" in custom_file_name) and (str(update.from_user.id) not in Config.UTUBE_BOT_USERS):
- bot.edit_message_text(
- chat_id=update.message.chat.id,
- text=Translation.NOT_AUTH_USER_TEXT,
- message_id=update.message.message_id
- )
- return
- download_directory = Config.DOWNLOAD_LOCATION + "/" + custom_file_name + "." + youtube_dl_ext + ""
- command_to_exec = []
- if tg_send_type == "audio":
- command_to_exec = [
- "youtube-dl",
- "-c",
- "--prefer-ffmpeg",
- "--extract-audio",
- "--audio-format", youtube_dl_ext,
- "--audio-quality", youtube_dl_format,
- youtube_dl_url,
- "-o", download_directory
- ]
- else:
- download_directory_one = Config.DOWNLOAD_LOCATION + "/" + custom_file_name
- # command_to_exec = ["youtube-dl", "-f", youtube_dl_format, "--hls-prefer-ffmpeg", "--recode-video", "mp4", "-k", youtube_dl_url, "-o", download_directory]
- minus_f_format = youtube_dl_format
- if "youtu" in youtube_dl_url:
- minus_f_format = youtube_dl_format + "+bestaudio"
- command_to_exec = [
- "youtube-dl",
- "-c",
- "--embed-subs",
- "-f", minus_f_format,
- "--hls-prefer-ffmpeg", youtube_dl_url,
- "-o", download_directory
- ]
- if "hotstar.com" in youtube_dl_url and Config.HTTP_PROXY != "":
- command_to_exec.append("--proxy")
- command_to_exec.append(Config.HTTP_PROXY)
- logger.info(command_to_exec)
- try:
- t_response = subprocess.check_output(
- command_to_exec, stderr=subprocess.STDOUT)
- except subprocess.CalledProcessError as exc:
- logger.info("Status : FAIL", exc.returncode, exc.output)
- bot.edit_message_text(
- chat_id=update.message.chat.id,
- message_id=update.message.message_id,
- text=exc.output.decode("UTF-8")
- )
- else:
- # logger.info(t_response)
- os.remove(save_ytdl_json_path)
- bot.edit_message_text(
- text=Translation.UPLOAD_START,
- chat_id=update.message.chat.id,
- message_id=update.message.message_id
- )
- file_size = Config.TG_MAX_FILE_SIZE + 1
- try:
- file_size = os.stat(download_directory).st_size
- except FileNotFoundError as exc:
- download_directory = download_directory_one + "." + "mkv"
- file_size = os.stat(download_directory).st_size
- if file_size > Config.TG_MAX_FILE_SIZE:
- bot.edit_message_text(
- chat_id=update.message.chat.id,
- text=Translation.RCHD_TG_API_LIMIT,
- message_id=update.message.message_id
- )
- else:
- # get the correct width, height, and duration for videos greater than 10MB
- # ref: message from @BotSupport
- width = 0
- height = 0
- duration = 0
- if tg_send_type != "file":
- metadata = extractMetadata(createParser(download_directory))
- if metadata.has("duration"):
- duration = metadata.get('duration').seconds
- # get the correct width, height, and duration for videos greater than 10MB
- if os.path.exists(thumb_image_path):
- width = 0
- height = 0
- metadata = extractMetadata(createParser(thumb_image_path))
- if metadata.has("width"):
- width = metadata.get("width")
- if metadata.has("height"):
- height = metadata.get("height")
- # resize image
- # ref: https://t.me/PyrogramChat/44663
- # https://stackoverflow.com/a/21669827/4723940
- Image.open(thumb_image_path).convert(
- "RGB").save(thumb_image_path)
- img = Image.open(thumb_image_path)
- # https://stackoverflow.com/a/37631799/4723940
- img.thumbnail((90, 90))
- img.save(thumb_image_path, "JPEG")
- # https://pillow.readthedocs.io/en/3.1.x/reference/Image.html#create-thumbnails
- else:
- thumb_image_path = None
- # try to upload file
- if tg_send_type == "audio":
- starts = time.time()
- bot.send_audio(
- chat_id=update.message.chat.id,
- audio=download_directory,
- caption=description,
- duration=duration,
- # performer=response_json["uploader"],
- # title=response_json["title"],
- # reply_markup=reply_markup,
- thumb=thumb_image_path,
- reply_to_message_id=update.message.reply_to_message.message_id,
- progress=progress_for_pyrogram,
- progress_args=(
- Translation.UPLOAD_START, update.message.message_id, update.message.chat.id, starts)
- )
- elif tg_send_type == "file":
- starts = time.time()
- bot.send_document(
- chat_id=update.message.chat.id,
- document=download_directory,
- thumb=thumb_image_path,
- caption=description,
- # reply_markup=reply_markup,
- reply_to_message_id=update.message.reply_to_message.message_id,
- progress=progress_for_pyrogram,
- progress_args=(
- Translation.UPLOAD_START, update.message.message_id, update.message.chat.id, starts)
- )
- elif tg_send_type == "vm":
- starts = time.time()
- bot.send_video_note(
- chat_id=update.message.chat.id,
- video_note=download_directory,
- duration=duration,
- length=width,
- thumb=thumb_image_path,
- reply_to_message_id=update.message.reply_to_message.message_id,
- progress=progress_for_pyrogram,
- progress_args=(
- Translation.UPLOAD_START, update.message.message_id, update.message.chat.id, starts)
- )
- elif tg_send_type == "video":
- starts = time.time()
- bot.send_video(
- chat_id=update.message.chat.id,
- video=download_directory,
- caption=description,
- duration=duration,
- width=width,
- height=height,
- supports_streaming=True,
- # reply_markup=reply_markup,
- thumb=thumb_image_path,
- reply_to_message_id=update.message.reply_to_message.message_id,
- progress=progress_for_pyrogram,
- progress_args=(
- Translation.UPLOAD_START, update.message.message_id, update.message.chat.i, startsd)
- )
- else:
- logger.info("Did this happen? :\\")
- try:
- os.remove(download_directory)
- os.remove(thumb_image_path)
- except:
- pass
- bot.edit_message_text(
- text=Translation.AFTER_SUCCESSFUL_UPLOAD_MSG,
- chat_id=update.message.chat.id,
- message_id=update.message.message_id,
- disable_web_page_preview=True
- )
From 2bc6da975585b2ad2f2963d3cc3d30bf567a54f7 Mon Sep 17 00:00:00 2001
From: Kannada-bot <57821193+Kannada-bot@users.noreply.github.com>
Date: Sat, 23 May 2020 12:35:09 +0530
Subject: [PATCH 27/36] Delete extract_streams.py
---
plugins/extract_streams.py | 75 --------------------------------------
1 file changed, 75 deletions(-)
delete mode 100644 plugins/extract_streams.py
diff --git a/plugins/extract_streams.py b/plugins/extract_streams.py
deleted file mode 100644
index ab5ca9bec..000000000
--- a/plugins/extract_streams.py
+++ /dev/null
@@ -1,75 +0,0 @@
-#!/usr/bin/env python3
-# -*- coding: utf-8 -*-
-# (c) Shrimadhav U K
-
-# the logging things
-import logging
-logging.basicConfig(level=logging.DEBUG,
- format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
-logger = logging.getLogger(__name__)
-
-import asyncio
-import os
-import time
-
-# the secret configuration specific things
-if bool(os.environ.get("WEBHOOK", False)):
- from sample_config import Config
-else:
- from config import Config
-
-# the Strings used for this "thing"
-from translation import Translation
-
-import pyrogram
-logging.getLogger("pyrogram").setLevel(logging.WARNING)
-
-from helper_funcs.chat_base import TRChatBase
-from helper_funcs.display_progress import progress_for_pyrogram
-
-
-@pyrogram.Client.on_message(pyrogram.Filters.command(["extractstreams"]))
-async def extract_sub_title(bot, update):
- TRChatBase(update.from_user.id, update.text, "extract_st_reams")
- if str(update.from_user.id) not in Config.SUPER7X_DLBOT_USERS:
- await bot.send_message(
- chat_id=update.chat.id,
- text=Translation.NOT_AUTH_USER_TEXT,
- reply_to_message_id=update.message_id
- )
- return
- if update.reply_to_message is not None:
- download_location = Config.DOWNLOAD_LOCATION + "/"
- a = await bot.send_message(
- chat_id=update.chat.id,
- text=Translation.DOWNLOAD_START,
- reply_to_message_id=update.message_id
- )
- c_time = time.time()
- the_real_download_location = await bot.download_media(
- message=update.reply_to_message,
- file_name=download_location,
- progress=progress_for_pyrogram,
- progress_args=(
- Translation.DOWNLOAD_START, a.message_id, update.chat.id, c_time
- )
- )
- if the_real_download_location is not None:
- await bot.edit_message_text(
- text=Translation.SAVED_RECVD_DOC_FILE,
- chat_id=update.chat.id,
- message_id=a.message_id
- )
- logger.info(the_real_download_location)
- await bot.edit_message_text(
- text=Translation.AFTER_SUCCESSFUL_UPLOAD_MSG,
- chat_id=update.chat.id,
- message_id=a.message_id,
- disable_web_page_preview=True
- )
- else:
- await bot.send_message(
- chat_id=update.chat.id,
- text=Translation.REPLY_TO_DOC_OR_LINK_FOR_RARX_SRT,
- reply_to_message_id=update.message_id
- )
From bdf641f46c4c08c807ce7f1f411701a564de5f3d Mon Sep 17 00:00:00 2001
From: Kannada-bot <57821193+Kannada-bot@users.noreply.github.com>
Date: Sat, 23 May 2020 12:35:21 +0530
Subject: [PATCH 28/36] Delete unzip.py
---
plugins/unzip.py | 150 -----------------------------------------------
1 file changed, 150 deletions(-)
delete mode 100644 plugins/unzip.py
diff --git a/plugins/unzip.py b/plugins/unzip.py
deleted file mode 100644
index c3516c554..000000000
--- a/plugins/unzip.py
+++ /dev/null
@@ -1,150 +0,0 @@
-
-#!/usr/bin/env python3
-# -*- coding: utf-8 -*-
-# (c) Shrimadhav U K
-
-# the logging things
-import logging
-logging.basicConfig(level=logging.DEBUG,
- format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
-logger = logging.getLogger(__name__)
-
-import os
-import shutil
-import subprocess
-import time
-
-# the secret configuration specific things
-if bool(os.environ.get("WEBHOOK", False)):
- from sample_config import Config
-else:
- from config import Config
-
-# the Strings used for this "thing"
-from translation import Translation
-
-import pyrogram
-logging.getLogger("pyrogram").setLevel(logging.WARNING)
-
-from helper_funcs.chat_base import TRChatBase
-from helper_funcs.display_progress import progress_for_pyrogram, humanbytes
-
-
-@pyrogram.Client.on_message(pyrogram.Filters.command(["unzip"]))
-async def unzip(bot, update):
- TRChatBase(update.from_user.id, update.text, "unzip")
- if str(update.from_user.id) not in Config.SUPER7X_DLBOT_USERS:
- await bot.send_message(
- chat_id=update.chat.id,
- text=Translation.NOT_AUTH_USER_TEXT,
- reply_to_message_id=update.message_id
- )
- return
- saved_file_path = Config.DOWNLOAD_LOCATION + \
- "/" + str(update.from_user.id) + ".unzip.zip"
- if os.path.exists(saved_file_path):
- os.remove(saved_file_path)
- reply_message = update.reply_to_message
- if ((reply_message is not None) and
- (reply_message.document is not None) and
- (reply_message.document.file_name.endswith(Translation.UNZIP_SUPPORTED_EXTENSIONS))):
- a = await bot.send_message(
- chat_id=update.chat.id,
- text=Translation.DOWNLOAD_START,
- reply_to_message_id=update.message_id
- )
- c_time = time.time()
- try:
- await bot.download_media(
- message=reply_message,
- file_name=saved_file_path,
- progress=progress_for_pyrogram,
- progress_args=(Translation.DOWNLOAD_START, a.message_id, update.chat.id, c_time)
- )
- except (ValueError) as e:
- await bot.edit_message_text(
- chat_id=update.chat.id,
- text=str(e),
- message_id=a.message_id
- )
- else:
- await bot.edit_message_text(
- chat_id=update.chat.id,
- text=Translation.SAVED_RECVD_DOC_FILE,
- message_id=a.message_id
- )
- extract_dir_path = Config.DOWNLOAD_LOCATION + \
- "/" + str(update.from_user.id) + "zipped" + "/"
- if not os.path.isdir(extract_dir_path):
- os.makedirs(extract_dir_path)
- await bot.edit_message_text(
- chat_id=update.chat.id,
- text=Translation.EXTRACT_ZIP_INTRO_THREE,
- message_id=a.message_id
- )
- try:
- command_to_exec = [
- "7z",
- "e",
- "-o" + extract_dir_path,
- saved_file_path
- ]
- # https://stackoverflow.com/a/39629367/4723940
- logger.info(command_to_exec)
- t_response = subprocess.check_output(
- command_to_exec, stderr=subprocess.STDOUT)
- # https://stackoverflow.com/a/26178369/4723940
- except:
- try:
- os.remove(saved_file_path)
- shutil.rmtree(extract_dir_path)
- except:
- pass
- await bot.edit_message_text(
- chat_id=update.chat.id,
- text=Translation.EXTRACT_ZIP_ERRS_OCCURED,
- disable_web_page_preview=True,
- parse_mode="html",
- message_id=a.message_id
- )
- else:
- os.remove(saved_file_path)
- inline_keyboard = []
- zip_file_contents = os.listdir(extract_dir_path)
- i = 0
- for current_file in zip_file_contents:
- cb_string = "ZIP:{}:ZIP".format(str(i))
- inline_keyboard.append([
- pyrogram.InlineKeyboardButton(
- current_file,
- callback_data=cb_string.encode("UTF-8")
- )
- ])
- i = i + 1
- cb_string = "ZIP:{}:ZIP".format("ALL")
- inline_keyboard.append([
- pyrogram.InlineKeyboardButton(
- "Upload All Files",
- callback_data=cb_string.encode("UTF-8")
- )
- ])
- cb_string = "ZIP:{}:ZIP".format("NONE")
- inline_keyboard.append([
- pyrogram.InlineKeyboardButton(
- "Cancel",
- callback_data=cb_string.encode("UTF-8")
- )
- ])
- reply_markup = pyrogram.InlineKeyboardMarkup(inline_keyboard)
- await bot.edit_message_text(
- chat_id=update.chat.id,
- text=Translation.EXTRACT_ZIP_STEP_TWO,
- message_id=a.message_id,
- reply_markup=reply_markup,
- )
- else:
- await bot.send_message(
- chat_id=update.chat.id,
- text=Translation.EXTRACT_ZIP_INTRO_ONE,
- reply_to_message_id=update.message_id
- )
From fc0dbecff9f9ea1c5ed17db2dd7e75a19082de3e Mon Sep 17 00:00:00 2001
From: Kannada-bot <57821193+Kannada-bot@users.noreply.github.com>
Date: Fri, 29 May 2020 16:32:48 +0530
Subject: [PATCH 29/36] Update translation.py
---
translation.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/translation.py b/translation.py
index f0d24e819..3dae031c9 100644
--- a/translation.py
+++ b/translation.py
@@ -8,7 +8,7 @@ class Translation(object):
1. Send me any Telegram File.
2. Reply to that message to /rename new name.extension.
-And much more things like unzip,convert to audio, convert to video,rename,url upload etc..
+And much more things like Upload YouTube link as file,convert to audio, convert to video,rename,url upload etc..
I can do still many more things check commands.
From 05715b174c6cfdec02eafa49f6f91943c7f43f57 Mon Sep 17 00:00:00 2001
From: Kannada-bot <57821193+Kannada-bot@users.noreply.github.com>
Date: Fri, 29 May 2020 16:33:35 +0530
Subject: [PATCH 30/36] Update display_progress.py
---
helper_funcs/display_progress.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/helper_funcs/display_progress.py b/helper_funcs/display_progress.py
index e2f1b32fb..e8e8fa88e 100644
--- a/helper_funcs/display_progress.py
+++ b/helper_funcs/display_progress.py
@@ -43,8 +43,8 @@ async def progress_for_pyrogram(
estimated_total_time = TimeFormatter(milliseconds=estimated_total_time)
progress = "[{0}{1}] \nP: {2}%\n".format(
- ''.join(["█" for i in range(math.floor(percentage / 5))]),
- ''.join(["░" for i in range(20 - math.floor(percentage / 5))]),
+ ''.join(["◻" for i in range(math.floor(percentage / 5))]),
+ ''.join(["▪" for i in range(20 - math.floor(percentage / 5))]),
round(percentage, 2))
tmp = progress + "{0} of {1}\nSpeed: {2}/s\nETA: {3}\n".format(
From dbe2f27e50409289630053049b3317c23929376a Mon Sep 17 00:00:00 2001
From: Kannada-bot <57821193+Kannada-bot@users.noreply.github.com>
Date: Tue, 2 Jun 2020 16:19:36 +0530
Subject: [PATCH 31/36] Update display_progress.py
---
helper_funcs/display_progress.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/helper_funcs/display_progress.py b/helper_funcs/display_progress.py
index e8e8fa88e..843f1c005 100644
--- a/helper_funcs/display_progress.py
+++ b/helper_funcs/display_progress.py
@@ -43,8 +43,8 @@ async def progress_for_pyrogram(
estimated_total_time = TimeFormatter(milliseconds=estimated_total_time)
progress = "[{0}{1}] \nP: {2}%\n".format(
- ''.join(["◻" for i in range(math.floor(percentage / 5))]),
- ''.join(["▪" for i in range(20 - math.floor(percentage / 5))]),
+ ''.join(["⭕" for i in range(math.floor(percentage / 5))]),
+ ''.join(["⛔" for i in range(20 - math.floor(percentage / 5))]),
round(percentage, 2))
tmp = progress + "{0} of {1}\nSpeed: {2}/s\nETA: {3}\n".format(
From bd1b4b2270161bdd102c505865159026291e8dca Mon Sep 17 00:00:00 2001
From: Kannada-bot <57821193+Kannada-bot@users.noreply.github.com>
Date: Tue, 2 Jun 2020 16:21:38 +0530
Subject: [PATCH 32/36] Update translation.py
---
translation.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/translation.py b/translation.py
index 3dae031c9..9b5b4f399 100644
--- a/translation.py
+++ b/translation.py
@@ -14,7 +14,8 @@ class Translation(object):
/help for more details..
-Support Group : @NRbotsZ
+Support Group :
+ @ALL_MOVIES_LIABRARY
"""
RENAME_403_ERR = "Sorry. You are not permitted to rename this file."
ABS_TEXT = " Please don't be selfish."
From 0c554551323657bd372a4ed66ab8b942186bd537 Mon Sep 17 00:00:00 2001
From: Kannada-bot <57821193+Kannada-bot@users.noreply.github.com>
Date: Thu, 11 Jun 2020 21:18:03 +0530
Subject: [PATCH 33/36] Update translation.py
---
translation.py | 24 ++++--------------------
1 file changed, 4 insertions(+), 20 deletions(-)
diff --git a/translation.py b/translation.py
index 9b5b4f399..6a8b98ec1 100644
--- a/translation.py
+++ b/translation.py
@@ -1,21 +1,11 @@
class Translation(object):
START_TEXT = """Hello,
-This is a Telegram URL Upload Bot!
-
-Please send me any direct download URL Link, i can upload to telegram as File/Video
-
-And I Can Also Rename Telegram Files...
-
-1. Send me any Telegram File.
-2. Reply to that message to /rename new name.extension.
-And much more things like Upload YouTube link as file,convert to audio, convert to video,rename,url upload etc..
-
- I can do still many more things check commands.
+This is a Telegram File To Video Converter Bot!
/help for more details..
Support Group :
- @ALL_MOVIES_LIABRARY
+ @NRBotsZ
"""
RENAME_403_ERR = "Sorry. You are not permitted to rename this file."
ABS_TEXT = " Please don't be selfish."
@@ -45,15 +35,9 @@ class Translation(object):
Telegram ID: {}
Plan Free User
Expires on: 31/12/2020"""
- HELP_USER = """Hai am URL Uploader bot..With Many Things.
+ HELP_USER = """Hai am File to video converter bot...
-1. Send url (Link|New Name with Extension).
-2. Send Custom Thumbnail (Optional).
-3. Select the button.
- SVideo - Give File as video with Screenshots
- DFile - Give File with Screenshots
- Video - Give File as video without Screenshots
- DFile - Give File without Screenshots
+1.send me a file and just reply to file as /converttovideo
Join: @NRBotsZ
From 1ca4aa025046a2e780a902157d8fd05b10675d90 Mon Sep 17 00:00:00 2001
From: Kannada-bot <57821193+Kannada-bot@users.noreply.github.com>
Date: Thu, 11 Jun 2020 21:18:58 +0530
Subject: [PATCH 34/36] Update display_progress.py
---
helper_funcs/display_progress.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/helper_funcs/display_progress.py b/helper_funcs/display_progress.py
index 843f1c005..a0a18b51d 100644
--- a/helper_funcs/display_progress.py
+++ b/helper_funcs/display_progress.py
@@ -43,8 +43,8 @@ async def progress_for_pyrogram(
estimated_total_time = TimeFormatter(milliseconds=estimated_total_time)
progress = "[{0}{1}] \nP: {2}%\n".format(
- ''.join(["⭕" for i in range(math.floor(percentage / 5))]),
- ''.join(["⛔" for i in range(20 - math.floor(percentage / 5))]),
+ ''.join(["▪" for i in range(math.floor(percentage / 5))]),
+ ''.join(["◻" for i in range(20 - math.floor(percentage / 5))]),
round(percentage, 2))
tmp = progress + "{0} of {1}\nSpeed: {2}/s\nETA: {3}\n".format(
From b391226132af8156256872dda629750defcdc226 Mon Sep 17 00:00:00 2001
From: SHER321 <66766275+SHER321@users.noreply.github.com>
Date: Fri, 12 Jun 2020 08:25:52 +0530
Subject: [PATCH 35/36] Update translation.py
---
translation.py | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/translation.py b/translation.py
index 6a8b98ec1..da896f398 100644
--- a/translation.py
+++ b/translation.py
@@ -5,7 +5,7 @@ class Translation(object):
/help for more details..
Support Group :
- @NRBotsZ
+ @ALL_MOVIES_LIABRARY
"""
RENAME_403_ERR = "Sorry. You are not permitted to rename this file."
ABS_TEXT = " Please don't be selfish."
@@ -18,10 +18,10 @@ class Translation(object):
UPLOAD_START = "Trying To Upload"
RCHD_BOT_API_LIMIT = "size greater than maximum allowed size (50MB). Neverthless, trying to upload."
RCHD_TG_API_LIMIT = "Downloaded in {} seconds.\nDetected File Size: {}\nSorry. But, I cannot upload files greater than 1.5GB due to Telegram API limitations."
- AFTER_SUCCESSFUL_UPLOAD_MSG = "Please rate me if you find me useful. Join : @NRBotsZ"
- AFTER_SUCCESSFUL_UPLOAD_MSG_WITH_TS = "Downloaded in {} seconds. \nJoin : @NRBotsZ \nUploaded in {} seconds."
+ AFTER_SUCCESSFUL_UPLOAD_MSG = "Please rate me if you find me useful. Join : @ALL_MOVIES_LIABRARY"
+ AFTER_SUCCESSFUL_UPLOAD_MSG_WITH_TS = "Downloaded in {} seconds. \nJoin : @ALL_MOVIES_LIABRARY \nUploaded in {} seconds."
NOT_AUTH_USER_TEXT = "Please /upgrade your subscription."
- NOT_AUTH_USER_TEXT_FILE_SIZE = "Detected File Size: {}. Free Users can only upload: {}\nPlease /upgrade your subscription.\nIf you think this is a bug, please contact @SpEcHlDe"
+ NOT_AUTH_USER_TEXT_FILE_SIZE = "Detected File Size: {}. Free Users can only upload: {}\nPlease /upgrade your subscription.\nIf you think this is a bug, please contact @NGYNY"
SAVED_CUSTOM_THUMB_NAIL = "Custom video / file thumbnail saved. This image will be used in the video / file."
DEL_ETED_CUSTOM_THUMB_NAIL = "✅ Custom thumbnail cleared succesfully."
FF_MPEG_DEL_ETED_CUSTOM_MEDIA = "✅ Media cleared succesfully."
@@ -39,18 +39,18 @@ class Translation(object):
1.send me a file and just reply to file as /converttovideo
-Join: @NRBotsZ
+Join: @ALL_MOVIES_LIABRARY
--------
Send /me to know current plan details
-Support Group : @NRBotsZ
+Support Group : @ALL_MOVIES_LIABRARY
"""
REPLY_TO_DOC_GET_LINK = "Reply to a Telegram media to get High Speed Direct Download Link"
REPLY_TO_DOC_FOR_C2V = "Reply to a Telegram media to convert"
REPLY_TO_DOC_FOR_SCSS = "Reply to a Telegram media to get screenshots"
REPLY_TO_DOC_FOR_RENAME_FILE = "Reply to a Telegram media to /rename with custom thumbnail support"
- AFTER_GET_DL_LINK = "Direct Link Generated valid for {} days.\n© @NRbotsZ"
+ AFTER_GET_DL_LINK = "Direct Link Generated valid for {} days.\n© @ALL_MOVIES_LIABRARY"
FF_MPEG_RO_BOT_RE_SURRECT_ED = """Syntax: /trim HH:MM:SS [HH:MM:SS]"""
FF_MPEG_RO_BOT_STEP_TWO_TO_ONE = "First send /downloadmedia to any media so that it can be downloaded to my local. \nSend /storageinfo to know the media, that is currently downloaded."
FF_MPEG_RO_BOT_STOR_AGE_INFO = "Video Duration: {}\nSend /clearffmpegmedia to delete this media, from my storage.\nSend /trim HH:MM:SS [HH:MM:SS] to cu[l]t a small photo / video, from the above media."
@@ -65,7 +65,7 @@ class Translation(object):
EXTRACT_ZIP_INTRO_ONE = "Send a compressed file first, Then reply /unzip command to the file."
EXTRACT_ZIP_INTRO_THREE = "Analyzing received file. ⚠️ This might take some time. Please be patient. "
UNZIP_SUPPORTED_EXTENSIONS = ("zip", "rar")
- EXTRACT_ZIP_ERRS_OCCURED = "Sorry. Errors occurred while processing compressed file. Please check everything again twice, and if the issue persists, report this to @NRbotsZ"
+ EXTRACT_ZIP_ERRS_OCCURED = "Sorry. Errors occurred while processing compressed file. Please check everything again twice, and if the issue persists, report this to @ALL_MOVIES_LIABRARY"
EXTRACT_ZIP_STEP_TWO = """Select file_name to upload from the below options.
You can use /rename command after receiving file to rename it with custom thumbnail support."""
CANCEL_STR = "Process Cancelled"
From 1dc1af20874a18ca49133a7651177427b3e7544a Mon Sep 17 00:00:00 2001
From: SHER321 <66766275+SHER321@users.noreply.github.com>
Date: Fri, 12 Jun 2020 08:29:30 +0530
Subject: [PATCH 36/36] Update README.md
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 3c65e7aa0..735e2eb0b 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
## [AnyDLBot](https://telegram.dog/AnyDLBot) - Clone
---
-
+https://heroku.com/deploy
An Open Source ALL-In-One Telegram RoBot, that can do lot of things.
**My Features**: