From fb6c7fb2eb4b82d1cb4071c69d6bb0629e79513d Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sat, 29 Jan 2022 12:44:25 +0530 Subject: [PATCH 001/410] Update README.md --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 0cb94eb67..496b55704 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,10 @@ A simple telegram bot to save restricted content with custom thumbmail support b

+Upcoming features: +- Save multiple content at once/Save in range +- Will add custom Forcesub + # Variables - `API_ID` From d5dcbb31cebf1175192eb6f8b85a4c98ee43da6a Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sat, 29 Jan 2022 15:29:42 +0530 Subject: [PATCH 002/410] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 496b55704..98664141a 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,7 @@ A simple telegram bot to save restricted content with custom thumbmail support b Upcoming features: - Save multiple content at once/Save in range - Will add custom Forcesub +- Caption support # Variables From 9cadc1ab138a816ae78cf37717d7a0fb69c36a3f Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sat, 29 Jan 2022 18:00:27 +0530 Subject: [PATCH 003/410] Delete display_progress.py --- main/plugins/display_progress.py | 88 -------------------------------- 1 file changed, 88 deletions(-) delete mode 100644 main/plugins/display_progress.py diff --git a/main/plugins/display_progress.py b/main/plugins/display_progress.py deleted file mode 100644 index d04bebd00..000000000 --- a/main/plugins/display_progress.py +++ /dev/null @@ -1,88 +0,0 @@ -import math -import os -import time -import json - -FINISHED_PROGRESS_STR = "█" -UN_FINISHED_PROGRESS_STR = "" -DOWNLOAD_LOCATION = "/app" - - -async def progress_for_pyrogram( - current, - total, - bot, - ud_type, - message, - start -): - now = time.time() - diff = now - start - if round(diff % 10.00) == 0 or current == total: - percentage = current * 100 / total - status = DOWNLOAD_LOCATION + "/status.json" - if os.path.exists(status): - with open(status, 'r+') as f: - statusMsg = json.load(f) - if not statusMsg["running"]: - bot.stop_transmission() - speed = current / diff - elapsed_time = round(diff) * 1000 - time_to_completion = round((total - current) / speed) * 1000 - estimated_total_time = elapsed_time + time_to_completion - - elapsed_time = TimeFormatter(milliseconds=elapsed_time) - estimated_total_time = TimeFormatter(milliseconds=estimated_total_time) - - progress = "**[{0}{1}]** `| {2}%`\n\n".format( - ''.join([FINISHED_PROGRESS_STR for i in range(math.floor(percentage / 10))]), - ''.join([UN_FINISHED_PROGRESS_STR for i in range(10 - math.floor(percentage / 10))]), - round(percentage, 2)) - - tmp = progress + "GROSSS: {0} of {1}\n\nSpeed: {2}/s\n\nETA: {3}\n".format( - humanbytes(current), - humanbytes(total), - humanbytes(speed), - estimated_total_time if estimated_total_time != '' else "0 s" - ) - try: - if not message.photo: - await message.edit_text( - text="{}\n {}".format( - ud_type, - tmp - ) - ) - else: - await message.edit_caption( - caption="{}\n {}".format( - ud_type, - tmp - ) - ) - except: - pass - - -def humanbytes(size): - if not size: - return "" - power = 2**10 - n = 0 - Dic_powerN = {0: ' ', 1: 'Ki', 2: 'Mi', 3: 'Gi', 4: 'Ti'} - while size > power: - size /= power - n += 1 - return str(round(size, 2)) + " " + Dic_powerN[n] + 'B' - - -def TimeFormatter(milliseconds: int) -> str: - seconds, milliseconds = divmod(int(milliseconds), 1000) - minutes, seconds = divmod(seconds, 60) - hours, minutes = divmod(minutes, 60) - days, hours = divmod(hours, 24) - tmp = ((str(days) + "d, ") if days else "") + \ - ((str(hours) + "h, ") if hours else "") + \ - ((str(minutes) + "m, ") if minutes else "") + \ - ((str(seconds) + "s, ") if seconds else "") - return tmp[:-2] From 9f7b8423a2ceb31bd74618b0b1f793965fa21be8 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sat, 29 Jan 2022 18:14:05 +0530 Subject: [PATCH 004/410] Update helpers.py --- main/plugins/helpers.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/main/plugins/helpers.py b/main/plugins/helpers.py index 8f03ae0fa..c237f5995 100644 --- a/main/plugins/helpers.py +++ b/main/plugins/helpers.py @@ -1,7 +1,7 @@ #Github.com/Vasusen-code -from pyrogram import Client -from pyrogram.errors import FloodWait, BadRequest +from telethon.tl.functions.messages import ImportChatInviteRequest +from telethon import errors, events import asyncio, subprocess, re, os, time @@ -9,15 +9,15 @@ async def join(client, invite_link): try: - await client.join_chat(invite_link) - return "Successfully joined the Channel" - except BadRequest: - return "Could not join. Maybe your link is expired or Invalid." - except FloodWait: - return "Too many requests, try again later." - except Exception as e: - return f"{str(e)}" - + await client(ImportChatInviteRequest(invite_link)) + return True, "Successfully joined the Channel." + except errors.UserAlreadyParticipantError: + return False, "You have already joined the Channel." + except errors.InviteHashExpiredError: + return False, "Link Expired/Wrong URL." + except FloodWaitError: + return False, "Too many requests, try again later!" + #Regex--------------------------------------------------------------------------------------------------------------- #to get the url from event From 284e4045b2ed6b45b2d515cc623f7352bf5fde91 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sat, 29 Jan 2022 18:17:58 +0530 Subject: [PATCH 005/410] Update start.py --- main/plugins/start.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/main/plugins/start.py b/main/plugins/start.py index 96d37c5b0..f30f968de 100644 --- a/main/plugins/start.py +++ b/main/plugins/start.py @@ -1,15 +1,15 @@ #Github.com/Vasusen-code import os -from .. import bot -from telethon import events, Button, TelegramClient +from .. import bot as Drone +from telethon import events, Button from pyrogram import idle -from main.plugins.main import Bot, userbot +from main.plugins.pyroplug import Bot st = "Send me Link of any message to clone it here, For private channel message, send invite link first.\n\n**SUPPORT:** @TeamDrone\n**DEV:** @MaheshChauhan" -@bot.on(events.NewMessage(incoming=True, pattern="/start")) +@Drone.on(events.NewMessage(incoming=True, pattern="/start")) async def start(event): await event.reply(f'{st}', buttons=[ @@ -18,16 +18,15 @@ async def start(event): ]) try: await Bot.start() - await userbot.start() await idle() except Exception as e: if 'Client is already connected' in str(e): pass else: - await event.client.send_message(event.chat_id, "Error while starting Client, check if your API and SESSION is right.") + await event.client.send_message(event.chat_id, "Error while starting bot using pyrogram.Client") return -@bot.on(events.callbackquery.CallbackQuery(data="sett")) +@Drone.on(events.callbackquery.CallbackQuery(data="sett")) async def sett(event): Drone = event.client button = await event.get_message() @@ -51,7 +50,7 @@ async def sett(event): os.rename(path, f'./{event.sender_id}.jpg') await t.edit("Temporary thumbnail saved!") -@bot.on(events.callbackquery.CallbackQuery(data="remt")) +@Drone.on(events.callbackquery.CallbackQuery(data="remt")) async def remt(event): Drone = event.client await event.edit('Trying.') From a8e3439b993301ec0960c6a25169c591ecdb0f8b Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sat, 29 Jan 2022 20:37:45 +0530 Subject: [PATCH 006/410] Update and rename main.py to pyroplug.py --- main/plugins/main.py | 130 --------------------------------------- main/plugins/pyroplug.py | 17 +++++ 2 files changed, 17 insertions(+), 130 deletions(-) delete mode 100644 main/plugins/main.py create mode 100644 main/plugins/pyroplug.py diff --git a/main/plugins/main.py b/main/plugins/main.py deleted file mode 100644 index be7a6fd77..000000000 --- a/main/plugins/main.py +++ /dev/null @@ -1,130 +0,0 @@ -# Github.com/Vasusen-code - -from main.plugins.helpers import get_link, join, screenshot -from main.plugins.display_progress import progress_for_pyrogram - -from decouple import config - -API_ID = config("API_ID", default=None, cast=int) -API_HASH = config("API_HASH", default=None) -BOT_TOKEN = config("BOT_TOKEN", default=None) -SESSION = config("SESSION", default=None) #pyro session - -from pyrogram.errors import FloodWait, BadRequest -from pyrogram import Client, filters -from ethon.pyfunc import video_metadata - -import re, time, asyncio, logging, os - -logging.basicConfig(format='[%(levelname) 5s/%(asctime)s] %(name)s: %(message)s', - level=logging.WARNING) - -Bot = Client( - "Simple-Pyrogram-Bot", - bot_token=BOT_TOKEN, - api_id=int(API_ID), - api_hash=API_HASH -) - -userbot = Client( - session_name=SESSION, - api_hash=API_HASH, - api_id=API_ID) - -def thumbnail(sender): - if os.path.exists(f'{sender}.jpg'): - return f'{sender}.jpg' - else: - return None - -async def get_msg(userbot, client, sender, msg_link, edit): - chat = "" - msg_id = int(msg_link.split("/")[-1]) - if 't.me/c/' in msg_link: - chat = int('-100' + str(msg_link.split("/")[-2])) - try: - msg = await userbot.get_messages(chat, msg_id) - file = await userbot.download_media( - msg, - progress=progress_for_pyrogram, - progress_args=( - userbot, - "**DOWNLOADING:**\n", - edit, - time.time() - ) - ) - await edit.edit('Trying to Upload.') - caption = "" - if msg.text is not None: - caption = msg.text - if str(file).split(".")[-1] == 'mkv' or 'mp4' or 'webm': - if str(file).split(".")[-1] == 'webm' or 'mkv': - path = str(file).split(".")[0] + ".mp4" - os.rename(file, path) - file = str(file).split(".")[0] + ".mp4" - data = video_metadata(file) - duration = data["duration"] - thumb_path = await screenshot(file, duration/2, sender) - await client.send_video( - chat_id=sender, - video=file, - caption=caption, - supports_streaming=True, - duration=duration, - thumb=thumb_path, - progress=progress_for_pyrogram, - progress_args=( - client, - '**UPLOADING:**\n', - edit, - time.time() - ) - ) - else: - thumb_path=thumbnail(sender) - await client.send_document( - sender, - file, - caption=caption, - thumb=thumb_path, - progress=progress_for_pyrogram, - progress_args=( - client, - '**UPLOADING:**\n', - edit, - time.time() - ) - ) - await edit.delete() - except Exception as e: - await edit.edit(f'ERROR: {str(e)}') - return - else: - chat = msg_link.split("/")[-2] - await client.copy_message(int(sender), chat, msg_id) - await edit.delete() - -@Bot.on_message(filters.private & filters.incoming) -async def clone(bot, event): - try: - link = get_link(event.text) - if not link: - return - except TypeError: - return - edit = await bot.send_message(event.chat.id, 'Trying to process.') - if 't.me/+' in link: - xy = await join(userbot, link) - await edit.edit(xy) - return - if 't.me' in link: - try: - await get_msg(userbot, bot, event.chat.id, link, edit) - except FloodWait: - return await edit.edit('Too many requests, try again later.') - except ValueError: - return await edit.edit('Send Only message link or Private channel invites.') - except Exception as e: - return await edit.edit(f'Error: `{str(e)}`') - diff --git a/main/plugins/pyroplug.py b/main/plugins/pyroplug.py new file mode 100644 index 000000000..c00e0787c --- /dev/null +++ b/main/plugins/pyroplug.py @@ -0,0 +1,17 @@ +# Github.com/Vasusen-code + +from .. import API_ID, API_HASH, BOT_TOKEN + +from pyrogram import Client + +Bot = Client( + "SaveRestricted", + bot_token=BOT_TOKEN, + api_id=int(API_ID), + api_hash=API_HASH +) + +async def copy_message(client, sender, msg_link): + chat = msg_link.split("/")[-2] + msg_id = msg_link.split("/")[-1] + await client.copy_message(int(sender), chat, msg_id) From 2c8d86177bb9b801bed7c91a27f8e6384c8a0969 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sat, 29 Jan 2022 21:10:58 +0530 Subject: [PATCH 007/410] Update start.py --- main/plugins/start.py | 1 + 1 file changed, 1 insertion(+) diff --git a/main/plugins/start.py b/main/plugins/start.py index f30f968de..1a4690f2e 100644 --- a/main/plugins/start.py +++ b/main/plugins/start.py @@ -60,4 +60,5 @@ async def remt(event): except Exception: await event.edit("No thumbnail saved.") + From 499fde4fcdc7bc48189229011f7ad6ae71218130 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sat, 29 Jan 2022 21:29:02 +0530 Subject: [PATCH 008/410] Create main.py --- main/plugins/main.py | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 main/plugins/main.py diff --git a/main/plugins/main.py b/main/plugins/main.py new file mode 100644 index 000000000..720c0b45f --- /dev/null +++ b/main/plugins/main.py @@ -0,0 +1,38 @@ +#Github.com/Vasusen-code + +from .. import bot as Drone +from .. import userbot + +from telethon import events + +from ethon.pyfunc import video_metadata +from ethon.telefunc import fast_upload,fast_download + +from main.plugins.pyroplug import Bot as pyrClient + +@Drone.on(events.NewMessage(incoming=True, func=lambda e: e.is_private)) +async def clone(event): + try: + link = get_link(event.text) + if not link: + return + except TypeError: + return + edit = await event.reply(event.chat.id, 'Trying to process.') + if 't.me/+' in link: + xy = await join(userbot, link) + await edit.edit(xy) + return + if 't.me' in link: + if not 't.me/c/' in link: + try: + await copy_message(pyrClient, link) + except ValueError: + await edit.edit("Send me only message link or Invite of private channel.") + except Exception: + await edit.edit("Couldn't clone message, maybe i am banned from the given chat.") + if 't.me/c/' in link: + try: + chat = int(msg_link.split("/")[-2]) + msg_id = int(msg_link.split("/")[-1]) + await event. From bbaf6f26cd03285d03b363bce3fb90e94126b5fd Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sat, 29 Jan 2022 22:14:40 +0530 Subject: [PATCH 009/410] Update main.py --- main/plugins/main.py | 36 ++++++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/main/plugins/main.py b/main/plugins/main.py index 720c0b45f..7540675a0 100644 --- a/main/plugins/main.py +++ b/main/plugins/main.py @@ -1,14 +1,18 @@ #Github.com/Vasusen-code +import time, os + from .. import bot as Drone from .. import userbot from telethon import events +from telethon.tl.types import DocumentAttributeVideo from ethon.pyfunc import video_metadata -from ethon.telefunc import fast_upload,fast_download +from ethon.telefunc import fast_upload, fast_download from main.plugins.pyroplug import Bot as pyrClient +from main.plugins.helpers import get_link, join, screenshot @Drone.on(events.NewMessage(incoming=True, func=lambda e: e.is_private)) async def clone(event): @@ -35,4 +39,32 @@ async def clone(event): try: chat = int(msg_link.split("/")[-2]) msg_id = int(msg_link.split("/")[-1]) - await event. + await edit.edit("Trying to Process.") + file = await userbot.get_messages(chat, ids=msg_id) + name = file.file.name + if not name: + if not file.file.mime_type: + await edit.edit("Couldn't fetch Name/Mime for the file.") + return + else: + if 'mp4' or 'x-matroska' in file.file.mime_type: + name = f'{chat}' + '-' + f'{msg_id}' + '.mp4' + await fast_download(name, file.document, userbot, edit, time.time(), '**DOWNLOADING:**') + await edit.edit("Preparing to upload.") + if 'mp4' in name: + metadata = video_metadata(name) + height = metadata["height"] + width = metadata["width"] + duration = metadata["duration"] + attributes = [DocumentAttributeVideo(duration=duration, w=width, h=height, supports_streaming=True)] + thumb = await screenshot(name, duration/2, event.sender_id) + caption = name + if file.text: + caption=file.text + uploader = await fast_download(name, name, time.time(), event.client, edit, '**UPLOADING:**') + await event.client.send_file(event.chat_id, uploader, caption=caption, thumb=thumb attributes=attributes, force_document=False) + + + + + From 5dffa0dd652a49138b683aac820445607757335e Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sat, 29 Jan 2022 22:30:13 +0530 Subject: [PATCH 010/410] Update main.py --- main/plugins/main.py | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/main/plugins/main.py b/main/plugins/main.py index 7540675a0..54c5a648e 100644 --- a/main/plugins/main.py +++ b/main/plugins/main.py @@ -33,14 +33,21 @@ async def clone(event): await copy_message(pyrClient, link) except ValueError: await edit.edit("Send me only message link or Invite of private channel.") - except Exception: - await edit.edit("Couldn't clone message, maybe i am banned from the given chat.") + except Exception as e: + if 'username' in str(e): + await edit.edit("Couldn't clone message, maybe i am banned from the given chat.") + else: + await edit.edit(str(e)) if 't.me/c/' in link: try: chat = int(msg_link.split("/")[-2]) msg_id = int(msg_link.split("/")[-1]) await edit.edit("Trying to Process.") file = await userbot.get_messages(chat, ids=msg_id) + if not file: + await edit.edit("Couldn't get message!") + if file and file.text and not file.media: + await edit.edit(file.text) name = file.file.name if not name: if not file.file.mime_type: @@ -63,6 +70,18 @@ async def clone(event): caption=file.text uploader = await fast_download(name, name, time.time(), event.client, edit, '**UPLOADING:**') await event.client.send_file(event.chat_id, uploader, caption=caption, thumb=thumb attributes=attributes, force_document=False) + await edit.delete() + else: + caption = name + if file.text: + caption=file.text + thumb=None + if os.path.exists(f'{event.sender}.jpg'): + thumb = f'{event.sender}.jpg' + uploader = await fast_download(name, name, time.time(), event.client, edit, '**UPLOADING:**') + await event.client.send_file(event.chat_id, uploader, caption=caption, thumb=thumb, force_document=True) + await edit.delete() + except From f39889731c16dd6ce8af66033665ee1f421dde50 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sat, 29 Jan 2022 22:50:58 +0530 Subject: [PATCH 011/410] Update main.py --- main/plugins/main.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/main/plugins/main.py b/main/plugins/main.py index 54c5a648e..485d5f106 100644 --- a/main/plugins/main.py +++ b/main/plugins/main.py @@ -81,7 +81,9 @@ async def clone(event): uploader = await fast_download(name, name, time.time(), event.client, edit, '**UPLOADING:**') await event.client.send_file(event.chat_id, uploader, caption=caption, thumb=thumb, force_document=True) await edit.delete() - except + except Exception as e: + print(e) + await edit.edit("Failed, try again!") From f460fd7aa632e68d8b7625875a4d2ccdd74b535c Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sat, 29 Jan 2022 23:07:55 +0530 Subject: [PATCH 012/410] Update __init__.py --- main/__init__.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/main/__init__.py b/main/__init__.py index 61b926b96..e275e9834 100644 --- a/main/__init__.py +++ b/main/__init__.py @@ -1,5 +1,6 @@ #ChauhanMahesh/Vasusen/DroneBots/COL +from telethon.sessions import StringSession from telethon import TelegramClient from decouple import config import logging @@ -15,3 +16,11 @@ SESSION = config("SESSION", default=None) bot = TelegramClient('bot', API_ID, API_HASH).start(bot_token=BOT_TOKEN) + +client = TelegramClient(StringSession(SESSION) , APP_ID, API_HASH) + +try: + client.start() +except BaseException: + print("Userbot Error ! Have you added a STRING_SESSION in deploying??") + sys.exit(1) From 965290f12e727c452b0f8c442486c37d1d2ae44a Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sat, 29 Jan 2022 23:08:13 +0530 Subject: [PATCH 013/410] Update __init__.py --- main/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/__init__.py b/main/__init__.py index e275e9834..923ff95a6 100644 --- a/main/__init__.py +++ b/main/__init__.py @@ -1,7 +1,7 @@ #ChauhanMahesh/Vasusen/DroneBots/COL from telethon.sessions import StringSession -from telethon import TelegramClient +from telethon.sync import TelegramClient from decouple import config import logging import time From 02f6bb0cad0087d3067e21809ec4e3a9ce685b33 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sat, 29 Jan 2022 23:12:23 +0530 Subject: [PATCH 014/410] Update __init__.py --- main/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/__init__.py b/main/__init__.py index 923ff95a6..c86dbd679 100644 --- a/main/__init__.py +++ b/main/__init__.py @@ -17,7 +17,7 @@ bot = TelegramClient('bot', API_ID, API_HASH).start(bot_token=BOT_TOKEN) -client = TelegramClient(StringSession(SESSION) , APP_ID, API_HASH) +client = TelegramClient(StringSession(SESSION) , API_ID, API_HASH) try: client.start() From ead2aaaad5985d28a6cd87e55724602f355b18bb Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sat, 29 Jan 2022 23:15:08 +0530 Subject: [PATCH 015/410] Fixed indention error --- main/plugins/main.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/main/plugins/main.py b/main/plugins/main.py index 485d5f106..e423218bf 100644 --- a/main/plugins/main.py +++ b/main/plugins/main.py @@ -66,15 +66,15 @@ async def clone(event): attributes = [DocumentAttributeVideo(duration=duration, w=width, h=height, supports_streaming=True)] thumb = await screenshot(name, duration/2, event.sender_id) caption = name - if file.text: - caption=file.text + if file.text: + caption=file.text uploader = await fast_download(name, name, time.time(), event.client, edit, '**UPLOADING:**') await event.client.send_file(event.chat_id, uploader, caption=caption, thumb=thumb attributes=attributes, force_document=False) await edit.delete() else: caption = name - if file.text: - caption=file.text + if file.text: + caption=file.text thumb=None if os.path.exists(f'{event.sender}.jpg'): thumb = f'{event.sender}.jpg' From b30c4951830e2ce621991a16b66fd41868c48893 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sat, 29 Jan 2022 23:17:42 +0530 Subject: [PATCH 016/410] Update main.py --- main/plugins/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/plugins/main.py b/main/plugins/main.py index e423218bf..0f0526cff 100644 --- a/main/plugins/main.py +++ b/main/plugins/main.py @@ -69,7 +69,7 @@ async def clone(event): if file.text: caption=file.text uploader = await fast_download(name, name, time.time(), event.client, edit, '**UPLOADING:**') - await event.client.send_file(event.chat_id, uploader, caption=caption, thumb=thumb attributes=attributes, force_document=False) + await event.client.send_file(event.chat_id, uploader, caption=caption, thumb=thumb, attributes=attributes, force_document=False) await edit.delete() else: caption = name From 9298971ea5aebb6f95ffaded4932cee9811e7a02 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sat, 29 Jan 2022 23:19:47 +0530 Subject: [PATCH 017/410] Update __init__.py --- main/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main/__init__.py b/main/__init__.py index c86dbd679..f6d596c62 100644 --- a/main/__init__.py +++ b/main/__init__.py @@ -17,10 +17,10 @@ bot = TelegramClient('bot', API_ID, API_HASH).start(bot_token=BOT_TOKEN) -client = TelegramClient(StringSession(SESSION) , API_ID, API_HASH) +userbot = TelegramClient(StringSession(SESSION) , API_ID, API_HASH) try: - client.start() + userbot.start() except BaseException: print("Userbot Error ! Have you added a STRING_SESSION in deploying??") sys.exit(1) From b7c8e878e71b1fc8b8cd224ccbd18e4fb24b0281 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sat, 29 Jan 2022 23:27:41 +0530 Subject: [PATCH 018/410] typo --- main/plugins/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/plugins/main.py b/main/plugins/main.py index 0f0526cff..d8f702289 100644 --- a/main/plugins/main.py +++ b/main/plugins/main.py @@ -22,7 +22,7 @@ async def clone(event): return except TypeError: return - edit = await event.reply(event.chat.id, 'Trying to process.') + edit = await event.reply('Trying to process.') if 't.me/+' in link: xy = await join(userbot, link) await edit.edit(xy) From 81f934e5d3be9630aa11afbafb49b29869293d95 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sat, 29 Jan 2022 23:29:03 +0530 Subject: [PATCH 019/410] Update main.py --- main/plugins/main.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/main/plugins/main.py b/main/plugins/main.py index d8f702289..baa6ae514 100644 --- a/main/plugins/main.py +++ b/main/plugins/main.py @@ -24,13 +24,14 @@ async def clone(event): return edit = await event.reply('Trying to process.') if 't.me/+' in link: - xy = await join(userbot, link) - await edit.edit(xy) + x, y = await join(userbot, link) + await edit.edit(y) return if 't.me' in link: if not 't.me/c/' in link: try: await copy_message(pyrClient, link) + await edit.edit except ValueError: await edit.edit("Send me only message link or Invite of private channel.") except Exception as e: From 433c6629c60d8c4fa7939a2b6ebff122a4eab177 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sat, 29 Jan 2022 23:30:01 +0530 Subject: [PATCH 020/410] typos --- main/plugins/main.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main/plugins/main.py b/main/plugins/main.py index baa6ae514..752076a09 100644 --- a/main/plugins/main.py +++ b/main/plugins/main.py @@ -30,8 +30,8 @@ async def clone(event): if 't.me' in link: if not 't.me/c/' in link: try: - await copy_message(pyrClient, link) - await edit.edit + await copy_message(pyrClient, event.sender_id, link) + await edit.delete() except ValueError: await edit.edit("Send me only message link or Invite of private channel.") except Exception as e: From f80bab44dfa1f10750be5e821fd21ac7b67963f9 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sat, 29 Jan 2022 23:32:15 +0530 Subject: [PATCH 021/410] Update main.py --- main/plugins/main.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main/plugins/main.py b/main/plugins/main.py index 752076a09..14572008c 100644 --- a/main/plugins/main.py +++ b/main/plugins/main.py @@ -69,7 +69,7 @@ async def clone(event): caption = name if file.text: caption=file.text - uploader = await fast_download(name, name, time.time(), event.client, edit, '**UPLOADING:**') + uploader = await fast_upload(name, name, time.time(), event.client, edit, '**UPLOADING:**') await event.client.send_file(event.chat_id, uploader, caption=caption, thumb=thumb, attributes=attributes, force_document=False) await edit.delete() else: @@ -79,7 +79,7 @@ async def clone(event): thumb=None if os.path.exists(f'{event.sender}.jpg'): thumb = f'{event.sender}.jpg' - uploader = await fast_download(name, name, time.time(), event.client, edit, '**UPLOADING:**') + uploader = await fast_upload(name, name, time.time(), event.client, edit, '**UPLOADING:**') await event.client.send_file(event.chat_id, uploader, caption=caption, thumb=thumb, force_document=True) await edit.delete() except Exception as e: From b67e63ba7dfcfaf46095532a4621a3344d2018ec Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sat, 29 Jan 2022 23:36:50 +0530 Subject: [PATCH 022/410] Update main.py --- main/plugins/main.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/main/plugins/main.py b/main/plugins/main.py index 14572008c..eb8ba9b59 100644 --- a/main/plugins/main.py +++ b/main/plugins/main.py @@ -11,6 +11,7 @@ from ethon.pyfunc import video_metadata from ethon.telefunc import fast_upload, fast_download +from main.plugins.pyroplug import copy_message from main.plugins.pyroplug import Bot as pyrClient from main.plugins.helpers import get_link, join, screenshot @@ -41,8 +42,8 @@ async def clone(event): await edit.edit(str(e)) if 't.me/c/' in link: try: - chat = int(msg_link.split("/")[-2]) - msg_id = int(msg_link.split("/")[-1]) + chat = int(link.split("/")[-2]) + msg_id = int(link.split("/")[-1]) await edit.edit("Trying to Process.") file = await userbot.get_messages(chat, ids=msg_id) if not file: From 1c4a77575e3098b92309785399507d5729940506 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sat, 29 Jan 2022 23:45:54 +0530 Subject: [PATCH 023/410] Update main.py --- main/plugins/main.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/main/plugins/main.py b/main/plugins/main.py index eb8ba9b59..9fc887d9f 100644 --- a/main/plugins/main.py +++ b/main/plugins/main.py @@ -42,9 +42,8 @@ async def clone(event): await edit.edit(str(e)) if 't.me/c/' in link: try: - chat = int(link.split("/")[-2]) + chat = int('-100' + str(link.split("/")[-2])) msg_id = int(link.split("/")[-1]) - await edit.edit("Trying to Process.") file = await userbot.get_messages(chat, ids=msg_id) if not file: await edit.edit("Couldn't get message!") From 0cd0217e2dd4d324e505c6335f7e14d199f177cb Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sun, 30 Jan 2022 00:08:23 +0530 Subject: [PATCH 024/410] Update main.py --- main/plugins/main.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/main/plugins/main.py b/main/plugins/main.py index 9fc887d9f..fdbf9a3d2 100644 --- a/main/plugins/main.py +++ b/main/plugins/main.py @@ -47,8 +47,10 @@ async def clone(event): file = await userbot.get_messages(chat, ids=msg_id) if not file: await edit.edit("Couldn't get message!") + return if file and file.text and not file.media: await edit.edit(file.text) + return name = file.file.name if not name: if not file.file.mime_type: From 0158ab6c1bc85c93d2259426ea524392b3f2ec8e Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sun, 30 Jan 2022 00:10:57 +0530 Subject: [PATCH 025/410] Update requirements.txt --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 406231484..04fd025e0 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ ethon python-decouple pyrogram -telethon +https://github.com/New-dev0/Telethon/archive/Vector.zip tgcrypto From 17ef15aeca818fa7833377d1c11f19c423ab3bfb Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sun, 30 Jan 2022 00:35:10 +0530 Subject: [PATCH 026/410] Update main.py --- main/plugins/main.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main/plugins/main.py b/main/plugins/main.py index fdbf9a3d2..6a6def7d0 100644 --- a/main/plugins/main.py +++ b/main/plugins/main.py @@ -79,8 +79,8 @@ async def clone(event): if file.text: caption=file.text thumb=None - if os.path.exists(f'{event.sender}.jpg'): - thumb = f'{event.sender}.jpg' + if os.path.exists(f'{event.sender_id}.jpg'): + thumb = f'{event.sender_id}.jpg' uploader = await fast_upload(name, name, time.time(), event.client, edit, '**UPLOADING:**') await event.client.send_file(event.chat_id, uploader, caption=caption, thumb=thumb, force_document=True) await edit.delete() From c72cb2022049d367e3d7daedf5ce086dc2519b7b Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sun, 30 Jan 2022 11:03:04 +0530 Subject: [PATCH 027/410] Update main.py --- main/plugins/main.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/main/plugins/main.py b/main/plugins/main.py index 6a6def7d0..1fe0d73e7 100644 --- a/main/plugins/main.py +++ b/main/plugins/main.py @@ -61,7 +61,7 @@ async def clone(event): name = f'{chat}' + '-' + f'{msg_id}' + '.mp4' await fast_download(name, file.document, userbot, edit, time.time(), '**DOWNLOADING:**') await edit.edit("Preparing to upload.") - if 'mp4' in name: + if 'mp4' or 'mkv' in name: metadata = video_metadata(name) height = metadata["height"] width = metadata["width"] @@ -86,6 +86,8 @@ async def clone(event): await edit.delete() except Exception as e: print(e) + if 'Peer'in str(e): + await edit.edit("Channel not found, have you joined it?") await edit.edit("Failed, try again!") From b8aeb2d6f4ab35fa5b30fab245972edbf56a020a Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sun, 30 Jan 2022 11:29:44 +0530 Subject: [PATCH 028/410] Update start.py --- main/plugins/start.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/main/plugins/start.py b/main/plugins/start.py index 1a4690f2e..aae892a32 100644 --- a/main/plugins/start.py +++ b/main/plugins/start.py @@ -7,15 +7,11 @@ from pyrogram import idle from main.plugins.pyroplug import Bot -st = "Send me Link of any message to clone it here, For private channel message, send invite link first.\n\n**SUPPORT:** @TeamDrone\n**DEV:** @MaheshChauhan" +from ethon.mystarts import start_srb @Drone.on(events.NewMessage(incoming=True, pattern="/start")) async def start(event): - await event.reply(f'{st}', - buttons=[ - [Button.inline("SET THUMB.", data="sett"), - Button.inline("REM THUMB.", data="remt")] - ]) + await start_srb(event) try: await Bot.start() await idle() From cef126977a8da56f3f37123bfee260370fa9378c Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sun, 30 Jan 2022 11:30:53 +0530 Subject: [PATCH 029/410] Update requirements.txt --- requirements.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 04fd025e0..2f18bb244 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,4 @@ ethon python-decouple pyrogram -https://github.com/New-dev0/Telethon/archive/Vector.zip tgcrypto From 5ed6931929f525a1c818e31f51fd1d395916befe Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sun, 30 Jan 2022 11:33:38 +0530 Subject: [PATCH 030/410] Update requirements.txt --- requirements.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/requirements.txt b/requirements.txt index 2f18bb244..f1c994a84 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,5 @@ ethon -python-decouple -pyrogram tgcrypto +pyrogram +python-decouple +https://github.com/New-dev0/Telethon/archive/Vector.zip From f6b608a72ab6a30aaa80a6a192923b80ddcc2b9e Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sun, 30 Jan 2022 12:01:20 +0530 Subject: [PATCH 031/410] line-91 --- main/plugins/main.py | 1 + 1 file changed, 1 insertion(+) diff --git a/main/plugins/main.py b/main/plugins/main.py index 1fe0d73e7..c4a2a3b28 100644 --- a/main/plugins/main.py +++ b/main/plugins/main.py @@ -88,6 +88,7 @@ async def clone(event): print(e) if 'Peer'in str(e): await edit.edit("Channel not found, have you joined it?") + return await edit.edit("Failed, try again!") From 6c7b530284a558403fc193f76d5b3d3cae3ec278 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sun, 30 Jan 2022 12:01:59 +0530 Subject: [PATCH 032/410] Update start.py --- main/plugins/start.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main/plugins/start.py b/main/plugins/start.py index aae892a32..15f4e2fe5 100644 --- a/main/plugins/start.py +++ b/main/plugins/start.py @@ -22,7 +22,7 @@ async def start(event): await event.client.send_message(event.chat_id, "Error while starting bot using pyrogram.Client") return -@Drone.on(events.callbackquery.CallbackQuery(data="sett")) +@Drone.on(events.callbackquery.CallbackQuery(data="set")) async def sett(event): Drone = event.client button = await event.get_message() @@ -46,7 +46,7 @@ async def sett(event): os.rename(path, f'./{event.sender_id}.jpg') await t.edit("Temporary thumbnail saved!") -@Drone.on(events.callbackquery.CallbackQuery(data="remt")) +@Drone.on(events.callbackquery.CallbackQuery(data="rem")) async def remt(event): Drone = event.client await event.edit('Trying.') From b2c67c6c1856575b6739974d4c782f9c66939b31 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sun, 30 Jan 2022 13:58:35 +0530 Subject: [PATCH 033/410] Update start.py --- main/plugins/start.py | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/main/plugins/start.py b/main/plugins/start.py index 15f4e2fe5..48443d682 100644 --- a/main/plugins/start.py +++ b/main/plugins/start.py @@ -4,24 +4,12 @@ from .. import bot as Drone from telethon import events, Button -from pyrogram import idle from main.plugins.pyroplug import Bot from ethon.mystarts import start_srb - -@Drone.on(events.NewMessage(incoming=True, pattern="/start")) -async def start(event): - await start_srb(event) - try: - await Bot.start() - await idle() - except Exception as e: - if 'Client is already connected' in str(e): - pass - else: - await event.client.send_message(event.chat_id, "Error while starting bot using pyrogram.Client") - return +S = '/' + 's' + 't' + 'a' + 'r' + 't' + @Drone.on(events.callbackquery.CallbackQuery(data="set")) async def sett(event): Drone = event.client @@ -55,6 +43,8 @@ async def remt(event): await event.edit('Removed!') except Exception: await event.edit("No thumbnail saved.") - - + +@Drone.on(events.NewMessage(incoming=True, pattern=f"{S}")) +async def start(event): + await start_srb(event) From 186b1432902d76d21598c116aec2f69e50015b29 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sun, 30 Jan 2022 14:02:14 +0530 Subject: [PATCH 034/410] loop --- main/plugins/pyroplug.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/main/plugins/pyroplug.py b/main/plugins/pyroplug.py index c00e0787c..90acd8500 100644 --- a/main/plugins/pyroplug.py +++ b/main/plugins/pyroplug.py @@ -15,3 +15,10 @@ async def copy_message(client, sender, msg_link): chat = msg_link.split("/")[-2] msg_id = msg_link.split("/")[-1] await client.copy_message(int(sender), chat, msg_id) + +async def run_bot(): + await Bot.start() + await idle() + +if __name__ == "__main__": + Bot.loop.run_until_complete(run_bot()) From 55e926c27227df0f8545badd6e13bb749f6ea814 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sun, 30 Jan 2022 14:02:47 +0530 Subject: [PATCH 035/410] Rename start.py to _x.py --- main/plugins/{start.py => _x.py} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename main/plugins/{start.py => _x.py} (100%) diff --git a/main/plugins/start.py b/main/plugins/_x.py similarity index 100% rename from main/plugins/start.py rename to main/plugins/_x.py From 679fe77ef622f2254b904aee926e212a37ae90d8 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sun, 30 Jan 2022 14:03:26 +0530 Subject: [PATCH 036/410] Rename _x.py to action.py --- main/plugins/{_x.py => action.py} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename main/plugins/{_x.py => action.py} (100%) diff --git a/main/plugins/_x.py b/main/plugins/action.py similarity index 100% rename from main/plugins/_x.py rename to main/plugins/action.py From b636e0909a42aa3c32d579ade6bb237c69a25fad Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sun, 30 Jan 2022 14:12:39 +0530 Subject: [PATCH 037/410] Update helpers.py --- main/plugins/helpers.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/main/plugins/helpers.py b/main/plugins/helpers.py index c237f5995..2a9955e87 100644 --- a/main/plugins/helpers.py +++ b/main/plugins/helpers.py @@ -9,7 +9,8 @@ async def join(client, invite_link): try: - await client(ImportChatInviteRequest(invite_link)) + hash_ = invite_link.split("+")[1] + await client(ImportChatInviteRequest(hash_)) return True, "Successfully joined the Channel." except errors.UserAlreadyParticipantError: return False, "You have already joined the Channel." From 55fa61d5ccf0ca939c8d01f6a8a207e8e309f5ca Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sun, 30 Jan 2022 14:36:02 +0530 Subject: [PATCH 038/410] loop --- main/plugins/pyroplug.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/main/plugins/pyroplug.py b/main/plugins/pyroplug.py index 90acd8500..a71733904 100644 --- a/main/plugins/pyroplug.py +++ b/main/plugins/pyroplug.py @@ -19,6 +19,5 @@ async def copy_message(client, sender, msg_link): async def run_bot(): await Bot.start() await idle() - -if __name__ == "__main__": - Bot.loop.run_until_complete(run_bot()) + +Bot.loop.run_until_complete(run_bot()) From 761a19ea9c52c609b3b17ee5d22de4bb0ebbb6a3 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sun, 30 Jan 2022 14:43:01 +0530 Subject: [PATCH 039/410] Update pyroplug.py --- main/plugins/pyroplug.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/plugins/pyroplug.py b/main/plugins/pyroplug.py index a71733904..f03923370 100644 --- a/main/plugins/pyroplug.py +++ b/main/plugins/pyroplug.py @@ -2,7 +2,7 @@ from .. import API_ID, API_HASH, BOT_TOKEN -from pyrogram import Client +from pyrogram import Client, idle Bot = Client( "SaveRestricted", From 487c1a99253ec273424510b5f73f063b046dc324 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sun, 30 Jan 2022 15:25:25 +0530 Subject: [PATCH 040/410] Update pyroplug.py --- main/plugins/pyroplug.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/plugins/pyroplug.py b/main/plugins/pyroplug.py index f03923370..afb7bd463 100644 --- a/main/plugins/pyroplug.py +++ b/main/plugins/pyroplug.py @@ -20,4 +20,4 @@ async def run_bot(): await Bot.start() await idle() -Bot.loop.run_until_complete(run_bot()) +asyncio.run(run_bot(Bot)) From 7f43d3798487e04894070547040af06677bfddac Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sun, 30 Jan 2022 15:33:57 +0530 Subject: [PATCH 041/410] Update pyroplug.py --- main/plugins/pyroplug.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/main/plugins/pyroplug.py b/main/plugins/pyroplug.py index afb7bd463..b11b3b73e 100644 --- a/main/plugins/pyroplug.py +++ b/main/plugins/pyroplug.py @@ -1,5 +1,7 @@ # Github.com/Vasusen-code +import asyncio + from .. import API_ID, API_HASH, BOT_TOKEN from pyrogram import Client, idle From 6ebf64c72c28a6df77d896eac4347b46dc771214 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sun, 30 Jan 2022 15:38:10 +0530 Subject: [PATCH 042/410] Update pyroplug.py --- main/plugins/pyroplug.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/plugins/pyroplug.py b/main/plugins/pyroplug.py index b11b3b73e..839f8d93e 100644 --- a/main/plugins/pyroplug.py +++ b/main/plugins/pyroplug.py @@ -18,7 +18,7 @@ async def copy_message(client, sender, msg_link): msg_id = msg_link.split("/")[-1] await client.copy_message(int(sender), chat, msg_id) -async def run_bot(): +async def run_bot(Bot): await Bot.start() await idle() From 7c92ed579b6893ef8de5926ffb4c5fcceacf6410 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sun, 30 Jan 2022 16:50:39 +0530 Subject: [PATCH 043/410] Update pyroplug.py --- main/plugins/pyroplug.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/main/plugins/pyroplug.py b/main/plugins/pyroplug.py index 839f8d93e..93efa0058 100644 --- a/main/plugins/pyroplug.py +++ b/main/plugins/pyroplug.py @@ -18,8 +18,3 @@ async def copy_message(client, sender, msg_link): msg_id = msg_link.split("/")[-1] await client.copy_message(int(sender), chat, msg_id) -async def run_bot(Bot): - await Bot.start() - await idle() - -asyncio.run(run_bot(Bot)) From 83cb180be649321b242286a698d020b03b40c554 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sun, 30 Jan 2022 16:57:15 +0530 Subject: [PATCH 044/410] Update main.py --- main/plugins/main.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/main/plugins/main.py b/main/plugins/main.py index c4a2a3b28..ca65177b2 100644 --- a/main/plugins/main.py +++ b/main/plugins/main.py @@ -31,7 +31,9 @@ async def clone(event): if 't.me' in link: if not 't.me/c/' in link: try: - await copy_message(pyrClient, event.sender_id, link) + chat = link.split("/")[-2] + msg_id = int(link.split("/")[-1]) + await event.client.forward_messages(event.sender_id, msg_id, chat) await edit.delete() except ValueError: await edit.edit("Send me only message link or Invite of private channel.") From 79ab0b1f495c84c7da2af326ca40bb618a7e577a Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sun, 30 Jan 2022 17:03:16 +0530 Subject: [PATCH 045/410] Update main.py --- main/plugins/main.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main/plugins/main.py b/main/plugins/main.py index ca65177b2..44bbf798e 100644 --- a/main/plugins/main.py +++ b/main/plugins/main.py @@ -29,11 +29,11 @@ async def clone(event): await edit.edit(y) return if 't.me' in link: - if not 't.me/c/' in link: + if not 't.me/c/' and not 't.me/joinchat/' in link: try: chat = link.split("/")[-2] msg_id = int(link.split("/")[-1]) - await event.client.forward_messages(event.sender_id, msg_id, chat) + await event.client.forward_messages(event.sender_id, msg_id, chat, drop_author=True) await edit.delete() except ValueError: await edit.edit("Send me only message link or Invite of private channel.") From d46fdd1a87bc27637e526335e8cea7b571904adb Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sun, 30 Jan 2022 18:37:55 +0530 Subject: [PATCH 046/410] Update main.py --- main/plugins/main.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/main/plugins/main.py b/main/plugins/main.py index 44bbf798e..3742a51c4 100644 --- a/main/plugins/main.py +++ b/main/plugins/main.py @@ -31,9 +31,7 @@ async def clone(event): if 't.me' in link: if not 't.me/c/' and not 't.me/joinchat/' in link: try: - chat = link.split("/")[-2] - msg_id = int(link.split("/")[-1]) - await event.client.forward_messages(event.sender_id, msg_id, chat, drop_author=True) + await copy_message(pyrClient, event.sender_id, link) await edit.delete() except ValueError: await edit.edit("Send me only message link or Invite of private channel.") From 88635ec376c50103e81c2e33c48922dae9c105f7 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sun, 30 Jan 2022 18:39:43 +0530 Subject: [PATCH 047/410] Update and rename action.py to _start.py --- main/plugins/{action.py => _start.py} | 1 + 1 file changed, 1 insertion(+) rename main/plugins/{action.py => _start.py} (98%) diff --git a/main/plugins/action.py b/main/plugins/_start.py similarity index 98% rename from main/plugins/action.py rename to main/plugins/_start.py index 48443d682..bd55cba76 100644 --- a/main/plugins/action.py +++ b/main/plugins/_start.py @@ -3,6 +3,7 @@ import os from .. import bot as Drone from telethon import events, Button +from pyrogram import Client, idle from main.plugins.pyroplug import Bot From cb622cb6071047ef73f71c57258a73cb03b34051 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sun, 30 Jan 2022 18:41:27 +0530 Subject: [PATCH 048/410] Update _start.py --- main/plugins/_start.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/main/plugins/_start.py b/main/plugins/_start.py index bd55cba76..31158223b 100644 --- a/main/plugins/_start.py +++ b/main/plugins/_start.py @@ -48,4 +48,13 @@ async def remt(event): @Drone.on(events.NewMessage(incoming=True, pattern=f"{S}")) async def start(event): await start_srb(event) + try: + await Bot.start() + await idle() + except Exception as e: + if 'Client is already connected' in str(e): + pass + else: + await event.client.send_message(event.chat_id, "Error while starting bot using pyrogram.Client") + return From 3255c0eb60aa621d6ba491433ad732bd37a6779e Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sun, 30 Jan 2022 18:54:53 +0530 Subject: [PATCH 049/410] Update pyroplug.py --- main/plugins/pyroplug.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/main/plugins/pyroplug.py b/main/plugins/pyroplug.py index 93efa0058..92946103e 100644 --- a/main/plugins/pyroplug.py +++ b/main/plugins/pyroplug.py @@ -18,3 +18,6 @@ async def copy_message(client, sender, msg_link): msg_id = msg_link.split("/")[-1] await client.copy_message(int(sender), chat, msg_id) +@Bot.on_message(filters.private & filters.incoming) +async def _(bot, event): + pass From 13ee62f000221a6556c3436352620af01f8fed48 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sun, 30 Jan 2022 18:57:13 +0530 Subject: [PATCH 050/410] Update pyroplug.py --- main/plugins/pyroplug.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/plugins/pyroplug.py b/main/plugins/pyroplug.py index 92946103e..d9b42e0b9 100644 --- a/main/plugins/pyroplug.py +++ b/main/plugins/pyroplug.py @@ -4,7 +4,7 @@ from .. import API_ID, API_HASH, BOT_TOKEN -from pyrogram import Client, idle +from pyrogram import Client, filters, idle Bot = Client( "SaveRestricted", From 9ac6ded67a4a188579c07cce0b4245b1f36e2ebe Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sun, 30 Jan 2022 19:12:26 +0530 Subject: [PATCH 051/410] Update pyroplug.py --- main/plugins/pyroplug.py | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/main/plugins/pyroplug.py b/main/plugins/pyroplug.py index d9b42e0b9..f76e4e698 100644 --- a/main/plugins/pyroplug.py +++ b/main/plugins/pyroplug.py @@ -13,11 +13,20 @@ api_hash=API_HASH ) -async def copy_message(client, sender, msg_link): - chat = msg_link.split("/")[-2] - msg_id = msg_link.split("/")[-1] - await client.copy_message(int(sender), chat, msg_id) - -@Bot.on_message(filters.private & filters.incoming) +@Bot.on_message(filters.private & filters.outgoing) async def _(bot, event): - pass + if (str(event.text)).lower().startswith("cloning"): + c = (event.text).split(" ")[1] + try: + chat = c.split("-")[0] + msg_id = int(c.split("-")[1]) + await Bot.copy_message(event.chat.id, chat, msg_id) + await event.delete() + except ValueError: + await event.edit("Send me only message link or Invite of private channel.") + except Exception as e: + if 'username' in str(e): + await event.edit("Couldn't clone message, maybe i am banned from the given chat.") + else: + await event.edit(str(e)) + From d35c7a92bb06597b8e7cf60e879d9772e68dfa2d Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sun, 30 Jan 2022 19:15:30 +0530 Subject: [PATCH 052/410] Update main.py --- main/plugins/main.py | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/main/plugins/main.py b/main/plugins/main.py index 3742a51c4..5ff8d5b3b 100644 --- a/main/plugins/main.py +++ b/main/plugins/main.py @@ -30,16 +30,9 @@ async def clone(event): return if 't.me' in link: if not 't.me/c/' and not 't.me/joinchat/' in link: - try: - await copy_message(pyrClient, event.sender_id, link) - await edit.delete() - except ValueError: - await edit.edit("Send me only message link or Invite of private channel.") - except Exception as e: - if 'username' in str(e): - await edit.edit("Couldn't clone message, maybe i am banned from the given chat.") - else: - await edit.edit(str(e)) + chat = link.split("/")[-2] + msg_id = link.split("/")[-1] + await edit.edit(f'cloning {chat}-{msg_id}') if 't.me/c/' in link: try: chat = int('-100' + str(link.split("/")[-2])) From 9a50541b73819bfe43bc033308f474e52c640434 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sun, 30 Jan 2022 19:20:35 +0530 Subject: [PATCH 053/410] Update main.py --- main/plugins/main.py | 1 - 1 file changed, 1 deletion(-) diff --git a/main/plugins/main.py b/main/plugins/main.py index 5ff8d5b3b..30791f364 100644 --- a/main/plugins/main.py +++ b/main/plugins/main.py @@ -11,7 +11,6 @@ from ethon.pyfunc import video_metadata from ethon.telefunc import fast_upload, fast_download -from main.plugins.pyroplug import copy_message from main.plugins.pyroplug import Bot as pyrClient from main.plugins.helpers import get_link, join, screenshot From 2c34420aa5259a67747aea346791771fd7e9064a Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sun, 30 Jan 2022 19:25:33 +0530 Subject: [PATCH 054/410] Update main.py --- main/plugins/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/plugins/main.py b/main/plugins/main.py index 30791f364..c0caedd4a 100644 --- a/main/plugins/main.py +++ b/main/plugins/main.py @@ -28,7 +28,7 @@ async def clone(event): await edit.edit(y) return if 't.me' in link: - if not 't.me/c/' and not 't.me/joinchat/' in link: + if not 't.me/c/' in link: chat = link.split("/")[-2] msg_id = link.split("/")[-1] await edit.edit(f'cloning {chat}-{msg_id}') From f2e8dc5747a38872b08491b2199b834dc0de566f Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sun, 30 Jan 2022 20:13:36 +0530 Subject: [PATCH 055/410] Update main.py --- main/plugins/main.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/main/plugins/main.py b/main/plugins/main.py index c0caedd4a..b5255da4c 100644 --- a/main/plugins/main.py +++ b/main/plugins/main.py @@ -3,19 +3,22 @@ import time, os from .. import bot as Drone -from .. import userbot +from .. import userbot, FORCESUB from telethon import events from telethon.tl.types import DocumentAttributeVideo from ethon.pyfunc import video_metadata -from ethon.telefunc import fast_upload, fast_download +from ethon.telefunc import fast_upload, fast_download, force_sub from main.plugins.pyroplug import Bot as pyrClient from main.plugins.helpers import get_link, join, screenshot @Drone.on(events.NewMessage(incoming=True, func=lambda e: e.is_private)) async def clone(event): + s, r = await force_sub(event.client, int(FORCESUB), event.sender_id) + if s == True: + await event.reply(r) try: link = get_link(event.text) if not link: From 0c44f00c0f76e52dd367ebabf421a1465430122e Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sun, 30 Jan 2022 20:31:41 +0530 Subject: [PATCH 056/410] Update main.py --- main/plugins/main.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/main/plugins/main.py b/main/plugins/main.py index b5255da4c..43dad158e 100644 --- a/main/plugins/main.py +++ b/main/plugins/main.py @@ -3,7 +3,8 @@ import time, os from .. import bot as Drone -from .. import userbot, FORCESUB +from .. import userbot +from .. import FORCESUB as fs from telethon import events from telethon.tl.types import DocumentAttributeVideo @@ -16,6 +17,9 @@ @Drone.on(events.NewMessage(incoming=True, func=lambda e: e.is_private)) async def clone(event): + FORCESUB = fs + if not str(fs).startswith("-100"): + FORCESUB = int("-100" + str(fs)) s, r = await force_sub(event.client, int(FORCESUB), event.sender_id) if s == True: await event.reply(r) From ec90d3e9270af774c0efa252aa305e654aac9dfe Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sun, 30 Jan 2022 20:32:55 +0530 Subject: [PATCH 057/410] Update __init__.py --- main/__init__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/main/__init__.py b/main/__init__.py index f6d596c62..a41d7e0bc 100644 --- a/main/__init__.py +++ b/main/__init__.py @@ -14,6 +14,7 @@ API_HASH = config("API_HASH", default=None) BOT_TOKEN = config("BOT_TOKEN", default=None) SESSION = config("SESSION", default=None) +FORCESUB = config("FORCESUB", default=None, cast=int) bot = TelegramClient('bot', API_ID, API_HASH).start(bot_token=BOT_TOKEN) From 1ca892f15419bb827157ef6572675e09a1dbe1a0 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sun, 30 Jan 2022 20:36:37 +0530 Subject: [PATCH 058/410] Update app.json --- app.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app.json b/app.json index 922637044..4cafd0800 100644 --- a/app.json +++ b/app.json @@ -27,6 +27,10 @@ "SESSION": { "description": "pyrogram string session.", "value": "" + }, + "FORCESUB": { + "description": "Public Channel id to forcesub.", + "value": "" } }, "buildpacks": [ From 7d616a380383a2fc32ec8e4109d82d83c345bf0a Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sun, 30 Jan 2022 20:37:19 +0530 Subject: [PATCH 059/410] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 98664141a..449464713 100644 --- a/README.md +++ b/README.md @@ -13,8 +13,8 @@ Upcoming features: - `API_ID` - `API_HASH` -- `SESSION` - Pyrogram string session -Get pyrogram string session from [BOT](https://t.me/SessionStringGeneratorZBot) or [Replit](https://replit.com/@dashezup/generate-pyrogram-session-string). +- `SESSION` - Telethon string session +Get Telethon string session from [BOT](https://t.me/SessionStringGeneratorZBot) - `BOT TOKEN` # Builpacks From 64450e13f3dc0a22ab951410a0b1bca9ee6add4a Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sun, 30 Jan 2022 20:38:19 +0530 Subject: [PATCH 060/410] Update README.md --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index 449464713..b56321476 100644 --- a/README.md +++ b/README.md @@ -6,8 +6,6 @@ A simple telegram bot to save restricted content with custom thumbmail support b Upcoming features: - Save multiple content at once/Save in range -- Will add custom Forcesub -- Caption support # Variables From 49b7bb3f47869e02707aecb3f8cb1b62dad7b59f Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sun, 30 Jan 2022 20:38:46 +0530 Subject: [PATCH 061/410] Update app.json --- app.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app.json b/app.json index 4cafd0800..4e7884309 100644 --- a/app.json +++ b/app.json @@ -25,7 +25,7 @@ "value": "" }, "SESSION": { - "description": "pyrogram string session.", + "description": "Telethon string session.", "value": "" }, "FORCESUB": { From 56f59c54ebdbedd492ee4169871454825b54f5c2 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sun, 30 Jan 2022 20:47:37 +0530 Subject: [PATCH 062/410] Update requirements.txt --- requirements.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/requirements.txt b/requirements.txt index f1c994a84..912e7e906 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,5 @@ +#Github.com-Vasusen-code + ethon tgcrypto pyrogram From 7f49d830de80fd375fd828f23aef9eabf9360c26 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sun, 30 Jan 2022 20:48:12 +0530 Subject: [PATCH 063/410] Update requirements.txt --- requirements.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/requirements.txt b/requirements.txt index 912e7e906..8930438c2 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,7 +1,9 @@ #Github.com-Vasusen-code ethon +cryptg tgcrypto pyrogram python-decouple +telethon-tgcrypto https://github.com/New-dev0/Telethon/archive/Vector.zip From 1fa45c52145e8c02c9d33a907dff1ed7cc5725a0 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sun, 30 Jan 2022 21:01:59 +0530 Subject: [PATCH 064/410] Update requirements.txt --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 8930438c2..d7757680c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -#Github.com-Vasusen-code +# Github.com-Vasusen-code ethon cryptg From eeb92eacc5ec24f96d87ef9e3afc1c15859637e0 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sun, 30 Jan 2022 21:13:23 +0530 Subject: [PATCH 065/410] Update main.py --- main/plugins/main.py | 1 + 1 file changed, 1 insertion(+) diff --git a/main/plugins/main.py b/main/plugins/main.py index 43dad158e..cdc8b5ed9 100644 --- a/main/plugins/main.py +++ b/main/plugins/main.py @@ -23,6 +23,7 @@ async def clone(event): s, r = await force_sub(event.client, int(FORCESUB), event.sender_id) if s == True: await event.reply(r) + return try: link = get_link(event.text) if not link: From 5c389d660df7782cc23f3a2aacd70be8e04bb69c Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sun, 30 Jan 2022 21:32:07 +0530 Subject: [PATCH 066/410] Update main.py --- main/plugins/main.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/main/plugins/main.py b/main/plugins/main.py index cdc8b5ed9..82fd64708 100644 --- a/main/plugins/main.py +++ b/main/plugins/main.py @@ -17,10 +17,7 @@ @Drone.on(events.NewMessage(incoming=True, func=lambda e: e.is_private)) async def clone(event): - FORCESUB = fs - if not str(fs).startswith("-100"): - FORCESUB = int("-100" + str(fs)) - s, r = await force_sub(event.client, int(FORCESUB), event.sender_id) + s, r = await force_sub(event.client, fs, event.sender_id) if s == True: await event.reply(r) return From 45a175a4be4ec4ef6ef82dc2fa0ca6c82c5481d0 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sun, 30 Jan 2022 21:33:03 +0530 Subject: [PATCH 067/410] Update main.py --- main/plugins/main.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/main/plugins/main.py b/main/plugins/main.py index 82fd64708..3a1604842 100644 --- a/main/plugins/main.py +++ b/main/plugins/main.py @@ -17,16 +17,16 @@ @Drone.on(events.NewMessage(incoming=True, func=lambda e: e.is_private)) async def clone(event): - s, r = await force_sub(event.client, fs, event.sender_id) - if s == True: - await event.reply(r) - return try: link = get_link(event.text) if not link: return except TypeError: return + s, r = await force_sub(event.client, fs, event.sender_id) + if s == True: + await event.reply(r) + return edit = await event.reply('Trying to process.') if 't.me/+' in link: x, y = await join(userbot, link) From 3d6e21a90771e729f84a804822f63ae4e30439fd Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sun, 30 Jan 2022 21:36:23 +0530 Subject: [PATCH 068/410] Update __init__.py --- main/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/__init__.py b/main/__init__.py index a41d7e0bc..f10555645 100644 --- a/main/__init__.py +++ b/main/__init__.py @@ -14,7 +14,7 @@ API_HASH = config("API_HASH", default=None) BOT_TOKEN = config("BOT_TOKEN", default=None) SESSION = config("SESSION", default=None) -FORCESUB = config("FORCESUB", default=None, cast=int) +FORCESUB = config("FORCESUB", default=None) bot = TelegramClient('bot', API_ID, API_HASH).start(bot_token=BOT_TOKEN) From f35162bbc4689927cf8e45be10491cb837855e5d Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sun, 30 Jan 2022 21:37:19 +0530 Subject: [PATCH 069/410] Update requirements.txt --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index d7757680c..8930438c2 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -# Github.com-Vasusen-code +#Github.com-Vasusen-code ethon cryptg From 2371f28b9fccf990807510e9a9934613d7a99342 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sun, 30 Jan 2022 22:09:11 +0530 Subject: [PATCH 070/410] Update requirements.txt --- requirements.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 8930438c2..b8ab0094d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,9 +1,10 @@ #Github.com-Vasusen-code + ethon cryptg tgcrypto pyrogram python-decouple telethon-tgcrypto -https://github.com/New-dev0/Telethon/archive/Vector.zip +https://github.com/New-dev0/Telethon/archive/Vector.zip #Until telethon update From 38d65deaded8f1d76cc94146bbd6deab97518297 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sun, 30 Jan 2022 22:15:14 +0530 Subject: [PATCH 071/410] Update __init__.py --- main/__init__.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/main/__init__.py b/main/__init__.py index f10555645..fd5f29ceb 100644 --- a/main/__init__.py +++ b/main/__init__.py @@ -3,8 +3,7 @@ from telethon.sessions import StringSession from telethon.sync import TelegramClient from decouple import config -import logging -import time +import logging, time, sys logging.basicConfig(format='[%(levelname) 5s/%(asctime)s] %(name)s: %(message)s', level=logging.WARNING) From 9cceaad04594c980a56ccae66096701d739ca67c Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sun, 30 Jan 2022 22:16:37 +0530 Subject: [PATCH 072/410] Delete .gitignore --- .gitignore | 129 ----------------------------------------------------- 1 file changed, 129 deletions(-) delete mode 100644 .gitignore diff --git a/.gitignore b/.gitignore deleted file mode 100644 index b6e47617d..000000000 --- a/.gitignore +++ /dev/null @@ -1,129 +0,0 @@ -# Byte-compiled / optimized / DLL files -__pycache__/ -*.py[cod] -*$py.class - -# C extensions -*.so - -# Distribution / packaging -.Python -build/ -develop-eggs/ -dist/ -downloads/ -eggs/ -.eggs/ -lib/ -lib64/ -parts/ -sdist/ -var/ -wheels/ -pip-wheel-metadata/ -share/python-wheels/ -*.egg-info/ -.installed.cfg -*.egg -MANIFEST - -# PyInstaller -# Usually these files are written by a python script from a template -# before PyInstaller builds the exe, so as to inject date/other infos into it. -*.manifest -*.spec - -# Installer logs -pip-log.txt -pip-delete-this-directory.txt - -# Unit test / coverage reports -htmlcov/ -.tox/ -.nox/ -.coverage -.coverage.* -.cache -nosetests.xml -coverage.xml -*.cover -*.py,cover -.hypothesis/ -.pytest_cache/ - -# Translations -*.mo -*.pot - -# Django stuff: -*.log -local_settings.py -db.sqlite3 -db.sqlite3-journal - -# Flask stuff: -instance/ -.webassets-cache - -# Scrapy stuff: -.scrapy - -# Sphinx documentation -docs/_build/ - -# PyBuilder -target/ - -# Jupyter Notebook -.ipynb_checkpoints - -# IPython -profile_default/ -ipython_config.py - -# pyenv -.python-version - -# pipenv -# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. -# However, in case of collaboration, if having platform-specific dependencies or dependencies -# having no cross-platform support, pipenv may install dependencies that don't work, or not -# install all needed dependencies. -#Pipfile.lock - -# PEP 582; used by e.g. github.com/David-OConnor/pyflow -__pypackages__/ - -# Celery stuff -celerybeat-schedule -celerybeat.pid - -# SageMath parsed files -*.sage.py - -# Environments -.env -.venv -env/ -venv/ -ENV/ -env.bak/ -venv.bak/ - -# Spyder project settings -.spyderproject -.spyproject - -# Rope project settings -.ropeproject - -# mkdocs documentation -/site - -# mypy -.mypy_cache/ -.dmypy.json -dmypy.json - -# Pyre type checker -.pyre/ From 1ae77f83b4bc946f58a0bedaff0b920c06b3d8bd Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sun, 30 Jan 2022 22:27:54 +0530 Subject: [PATCH 073/410] Update main.py --- main/plugins/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/plugins/main.py b/main/plugins/main.py index 3a1604842..33cfa089d 100644 --- a/main/plugins/main.py +++ b/main/plugins/main.py @@ -58,7 +58,7 @@ async def clone(event): name = f'{chat}' + '-' + f'{msg_id}' + '.mp4' await fast_download(name, file.document, userbot, edit, time.time(), '**DOWNLOADING:**') await edit.edit("Preparing to upload.") - if 'mp4' or 'mkv' in name: + if '.mp4' or '.mkv' in name: metadata = video_metadata(name) height = metadata["height"] width = metadata["width"] From 34a6162db188b43e7f30386073a573e5d3a237d9 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sun, 30 Jan 2022 22:28:16 +0530 Subject: [PATCH 074/410] Update app.json --- app.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app.json b/app.json index 4e7884309..02866fad9 100644 --- a/app.json +++ b/app.json @@ -29,7 +29,7 @@ "value": "" }, "FORCESUB": { - "description": "Public Channel id to forcesub.", + "description": "Public Channel username to forcesub.", "value": "" } }, From d860d3a84f15b6596e6fb2dd6e112a2d24efb20c Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sun, 30 Jan 2022 22:29:00 +0530 Subject: [PATCH 075/410] Update README.md --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index b56321476..eba9f5f79 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,8 @@ Upcoming features: - `SESSION` - Telethon string session Get Telethon string session from [BOT](https://t.me/SessionStringGeneratorZBot) - `BOT TOKEN` - +- FORCESUB - Public channel username without '@' + # Builpacks - `heroku/python` From 7a1b3365977d76baf03d9c2764328f34c7e80107 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sun, 30 Jan 2022 22:29:44 +0530 Subject: [PATCH 076/410] Update app.json --- app.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app.json b/app.json index 02866fad9..8b2eba6fc 100644 --- a/app.json +++ b/app.json @@ -29,7 +29,7 @@ "value": "" }, "FORCESUB": { - "description": "Public Channel username to forcesub.", + "description": "Public Channel username without using '@' to forcesub.", "value": "" } }, From 625367c3a315a8519fb19ac616a426b584d82faf Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sun, 30 Jan 2022 22:30:59 +0530 Subject: [PATCH 077/410] Update README.md --- README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index eba9f5f79..b75bc8af3 100644 --- a/README.md +++ b/README.md @@ -14,13 +14,8 @@ Upcoming features: - `SESSION` - Telethon string session Get Telethon string session from [BOT](https://t.me/SessionStringGeneratorZBot) - `BOT TOKEN` -- FORCESUB - Public channel username without '@' +- `FORCESUB` - Public channel username without '@' -# Builpacks - -- `heroku/python` -- `https://github.com/jonathanong/heroku-buildpack-ffmpeg-latest.git` - # Issues - if you see any message like `ERROR R12` in heroku logs, just restart. - `CHANNEL INVALID` if channel not joined. @@ -30,3 +25,8 @@ Get Telethon string session from [BOT](https://t.me/SessionStringGeneratorZBot)

if deploy button doesn't work, then deploy `manually.` + +Buildpacks for manual : + +- `heroku/python` +- `https://github.com/jonathanong/heroku-buildpack-ffmpeg-latest.git` From 3e6d9ddb50a7bc0d8a4b8a72a35859216c57d7aa Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sun, 30 Jan 2022 23:49:37 +0530 Subject: [PATCH 078/410] more accuracy to detect videos --- main/plugins/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/plugins/main.py b/main/plugins/main.py index 33cfa089d..b0f180674 100644 --- a/main/plugins/main.py +++ b/main/plugins/main.py @@ -58,7 +58,7 @@ async def clone(event): name = f'{chat}' + '-' + f'{msg_id}' + '.mp4' await fast_download(name, file.document, userbot, edit, time.time(), '**DOWNLOADING:**') await edit.edit("Preparing to upload.") - if '.mp4' or '.mkv' in name: + if name.split(".")[-1] == 'mkv' or 'mp4': metadata = video_metadata(name) height = metadata["height"] width = metadata["width"] From 69e3ed95b74ca1359a23f6a268dd386ba792f1ac Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sun, 30 Jan 2022 23:58:01 +0530 Subject: [PATCH 079/410] Update main.py --- main/plugins/main.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/main/plugins/main.py b/main/plugins/main.py index b0f180674..2d2dd27a5 100644 --- a/main/plugins/main.py +++ b/main/plugins/main.py @@ -9,6 +9,7 @@ from telethon import events from telethon.tl.types import DocumentAttributeVideo +from ethon.pyutils import file_extension from ethon.pyfunc import video_metadata from ethon.telefunc import fast_upload, fast_download, force_sub @@ -58,7 +59,7 @@ async def clone(event): name = f'{chat}' + '-' + f'{msg_id}' + '.mp4' await fast_download(name, file.document, userbot, edit, time.time(), '**DOWNLOADING:**') await edit.edit("Preparing to upload.") - if name.split(".")[-1] == 'mkv' or 'mp4': + if file_extension(name) == 'mkv' or 'mp4': metadata = video_metadata(name) height = metadata["height"] width = metadata["width"] From 7d40a3289be9835b4c74e2e3350b5439199bddc1 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Mon, 31 Jan 2022 00:06:33 +0530 Subject: [PATCH 080/410] Update main.py --- main/plugins/main.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/main/plugins/main.py b/main/plugins/main.py index 2d2dd27a5..9be119c34 100644 --- a/main/plugins/main.py +++ b/main/plugins/main.py @@ -9,7 +9,6 @@ from telethon import events from telethon.tl.types import DocumentAttributeVideo -from ethon.pyutils import file_extension from ethon.pyfunc import video_metadata from ethon.telefunc import fast_upload, fast_download, force_sub @@ -59,7 +58,20 @@ async def clone(event): name = f'{chat}' + '-' + f'{msg_id}' + '.mp4' await fast_download(name, file.document, userbot, edit, time.time(), '**DOWNLOADING:**') await edit.edit("Preparing to upload.") - if file_extension(name) == 'mkv' or 'mp4': + if 'mp4' in file.file.mime_type: + metadata = video_metadata(name) + height = metadata["height"] + width = metadata["width"] + duration = metadata["duration"] + attributes = [DocumentAttributeVideo(duration=duration, w=width, h=height, supports_streaming=True)] + thumb = await screenshot(name, duration/2, event.sender_id) + caption = name + if file.text: + caption=file.text + uploader = await fast_upload(name, name, time.time(), event.client, edit, '**UPLOADING:**') + await event.client.send_file(event.chat_id, uploader, caption=caption, thumb=thumb, attributes=attributes, force_document=False) + await edit.delete() + elif 'x-matroska' in file.file.mime_type: metadata = video_metadata(name) height = metadata["height"] width = metadata["width"] From 4d50bed3d1a3a99988e1da15f8a282359280343c Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Mon, 31 Jan 2022 00:58:25 +0530 Subject: [PATCH 081/410] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index b75bc8af3..0eec26c10 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,8 @@ A simple telegram bot to save restricted content with custom thumbmail support b

+

+ Upcoming features: - Save multiple content at once/Save in range From fffd6ec5f5e47c9dc032c420037e40a7cb0325a9 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Mon, 31 Jan 2022 00:59:26 +0530 Subject: [PATCH 082/410] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0eec26c10..b8b90da2a 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ Get Telethon string session from [BOT](https://t.me/SessionStringGeneratorZBot) - if you face `ERROR: Client has not been started yet` then just send `/start`. # Deploy -

+

if deploy button doesn't work, then deploy `manually.` From ec95f693f04aba0fe762ef660c1c4b6395670e99 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Mon, 31 Jan 2022 01:00:02 +0530 Subject: [PATCH 083/410] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b8b90da2a..f2914d289 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ Get Telethon string session from [BOT](https://t.me/SessionStringGeneratorZBot) - if you face `ERROR: Client has not been started yet` then just send `/start`. # Deploy -

+

if deploy button doesn't work, then deploy `manually.` From 4f1e8eb03140cf30134a6b3127e7835f605b3e45 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Mon, 31 Jan 2022 01:01:12 +0530 Subject: [PATCH 084/410] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f2914d289..6d7f2978f 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ Get Telethon string session from [BOT](https://t.me/SessionStringGeneratorZBot) - if you face `ERROR: Client has not been started yet` then just send `/start`. # Deploy -

+

if deploy button doesn't work, then deploy `manually.` From 2d19ea1640930522ddbf61903bbef4b1624b42c5 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Mon, 31 Jan 2022 14:02:49 +0530 Subject: [PATCH 085/410] Update main.py --- main/plugins/main.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/main/plugins/main.py b/main/plugins/main.py index 9be119c34..cbfc3cf3f 100644 --- a/main/plugins/main.py +++ b/main/plugins/main.py @@ -71,6 +71,7 @@ async def clone(event): uploader = await fast_upload(name, name, time.time(), event.client, edit, '**UPLOADING:**') await event.client.send_file(event.chat_id, uploader, caption=caption, thumb=thumb, attributes=attributes, force_document=False) await edit.delete() + os.remove(name) elif 'x-matroska' in file.file.mime_type: metadata = video_metadata(name) height = metadata["height"] @@ -84,6 +85,7 @@ async def clone(event): uploader = await fast_upload(name, name, time.time(), event.client, edit, '**UPLOADING:**') await event.client.send_file(event.chat_id, uploader, caption=caption, thumb=thumb, attributes=attributes, force_document=False) await edit.delete() + os.remove(name) else: caption = name if file.text: @@ -94,6 +96,7 @@ async def clone(event): uploader = await fast_upload(name, name, time.time(), event.client, edit, '**UPLOADING:**') await event.client.send_file(event.chat_id, uploader, caption=caption, thumb=thumb, force_document=True) await edit.delete() + os.remove(name) except Exception as e: print(e) if 'Peer'in str(e): From 2ee2553e3e25279d2f9615ff28bfb7036887a266 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Mon, 31 Jan 2022 15:28:44 +0530 Subject: [PATCH 086/410] Update main.py --- main/plugins/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/plugins/main.py b/main/plugins/main.py index cbfc3cf3f..5a2544601 100644 --- a/main/plugins/main.py +++ b/main/plugins/main.py @@ -45,7 +45,7 @@ async def clone(event): if not file: await edit.edit("Couldn't get message!") return - if file and file.text and not file.media: + if file and file.text and not file.file.name: await edit.edit(file.text) return name = file.file.name From 6f11270142c7fbe3a5c78a642d7dbf6ebeed97b4 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Mon, 31 Jan 2022 16:40:34 +0530 Subject: [PATCH 087/410] Update main.py --- main/plugins/main.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/main/plugins/main.py b/main/plugins/main.py index 5a2544601..7f18bb462 100644 --- a/main/plugins/main.py +++ b/main/plugins/main.py @@ -45,9 +45,18 @@ async def clone(event): if not file: await edit.edit("Couldn't get message!") return - if file and file.text and not file.file.name: - await edit.edit(file.text) - return + if file and file.text: + try: + if not file.media: + await edit.edit(file.text) + return + if not file.file.name: + await edit.edit(file.text) + return + except: + if file.media.webpage: + await edit.edit(file.text) + return name = file.file.name if not name: if not file.file.mime_type: From 3a27ae5a0e7d1c984ad7425f5de0c132753ae7ed Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Tue, 1 Feb 2022 01:18:37 +0530 Subject: [PATCH 088/410] Update _start.py --- main/plugins/_start.py | 9 --------- 1 file changed, 9 deletions(-) diff --git a/main/plugins/_start.py b/main/plugins/_start.py index 31158223b..bd55cba76 100644 --- a/main/plugins/_start.py +++ b/main/plugins/_start.py @@ -48,13 +48,4 @@ async def remt(event): @Drone.on(events.NewMessage(incoming=True, pattern=f"{S}")) async def start(event): await start_srb(event) - try: - await Bot.start() - await idle() - except Exception as e: - if 'Client is already connected' in str(e): - pass - else: - await event.client.send_message(event.chat_id, "Error while starting bot using pyrogram.Client") - return From ff83e85d81a3b48c6d2b57db500abaf3b12c2fba Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Tue, 1 Feb 2022 01:19:39 +0530 Subject: [PATCH 089/410] Update _start.py --- main/plugins/_start.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/main/plugins/_start.py b/main/plugins/_start.py index bd55cba76..31158223b 100644 --- a/main/plugins/_start.py +++ b/main/plugins/_start.py @@ -48,4 +48,13 @@ async def remt(event): @Drone.on(events.NewMessage(incoming=True, pattern=f"{S}")) async def start(event): await start_srb(event) + try: + await Bot.start() + await idle() + except Exception as e: + if 'Client is already connected' in str(e): + pass + else: + await event.client.send_message(event.chat_id, "Error while starting bot using pyrogram.Client") + return From eee3408bc0650409edce3dd8e45106c0f9a09ac7 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Tue, 1 Feb 2022 01:20:00 +0530 Subject: [PATCH 090/410] Update _start.py --- main/plugins/_start.py | 9 --------- 1 file changed, 9 deletions(-) diff --git a/main/plugins/_start.py b/main/plugins/_start.py index 31158223b..bd55cba76 100644 --- a/main/plugins/_start.py +++ b/main/plugins/_start.py @@ -48,13 +48,4 @@ async def remt(event): @Drone.on(events.NewMessage(incoming=True, pattern=f"{S}")) async def start(event): await start_srb(event) - try: - await Bot.start() - await idle() - except Exception as e: - if 'Client is already connected' in str(e): - pass - else: - await event.client.send_message(event.chat_id, "Error while starting bot using pyrogram.Client") - return From 369459ce6c8665df9cdb33d1d4f9ae563082f5b2 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Tue, 1 Feb 2022 01:21:32 +0530 Subject: [PATCH 091/410] Update pyroplug.py --- main/plugins/pyroplug.py | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/main/plugins/pyroplug.py b/main/plugins/pyroplug.py index f76e4e698..e254cb161 100644 --- a/main/plugins/pyroplug.py +++ b/main/plugins/pyroplug.py @@ -2,16 +2,9 @@ import asyncio -from .. import API_ID, API_HASH, BOT_TOKEN - -from pyrogram import Client, filters, idle +from .. import Bot -Bot = Client( - "SaveRestricted", - bot_token=BOT_TOKEN, - api_id=int(API_ID), - api_hash=API_HASH -) +from pyrogram import Client, filters @Bot.on_message(filters.private & filters.outgoing) async def _(bot, event): From c6ce458004bac0bc6f9808275a10a70a0ef2fe81 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Tue, 1 Feb 2022 01:24:11 +0530 Subject: [PATCH 092/410] Update __init__.py --- main/__init__.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/main/__init__.py b/main/__init__.py index fd5f29ceb..81584ba07 100644 --- a/main/__init__.py +++ b/main/__init__.py @@ -1,7 +1,10 @@ #ChauhanMahesh/Vasusen/DroneBots/COL +from pyrogram import Client, filters + from telethon.sessions import StringSession from telethon.sync import TelegramClient + from decouple import config import logging, time, sys @@ -24,3 +27,17 @@ except BaseException: print("Userbot Error ! Have you added a STRING_SESSION in deploying??") sys.exit(1) + +Bot = Client( + "SaveRestricted", + bot_token=BOT_TOKEN, + api_id=int(API_ID), + api_hash=API_HASH +) + +try: + Bot.start() + idle() +except Exception as e: + print(e) + sys.exit(1) From 2d16f5d48d8ce581b03a1ef8dab1e1169ac91070 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Tue, 1 Feb 2022 01:24:56 +0530 Subject: [PATCH 093/410] Update main.py --- main/plugins/main.py | 1 - 1 file changed, 1 deletion(-) diff --git a/main/plugins/main.py b/main/plugins/main.py index 7f18bb462..bd6a0933e 100644 --- a/main/plugins/main.py +++ b/main/plugins/main.py @@ -12,7 +12,6 @@ from ethon.pyfunc import video_metadata from ethon.telefunc import fast_upload, fast_download, force_sub -from main.plugins.pyroplug import Bot as pyrClient from main.plugins.helpers import get_link, join, screenshot @Drone.on(events.NewMessage(incoming=True, func=lambda e: e.is_private)) From f39b6eafca8a494aaf1c7317e394b21d7ca91cce Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Tue, 1 Feb 2022 01:25:42 +0530 Subject: [PATCH 094/410] Update _start.py --- main/plugins/_start.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/main/plugins/_start.py b/main/plugins/_start.py index bd55cba76..0af9eb834 100644 --- a/main/plugins/_start.py +++ b/main/plugins/_start.py @@ -3,9 +3,6 @@ import os from .. import bot as Drone from telethon import events, Button -from pyrogram import Client, idle - -from main.plugins.pyroplug import Bot from ethon.mystarts import start_srb From d540130f029f7d95d71f90fb96e2db7798e812ac Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Tue, 1 Feb 2022 01:28:41 +0530 Subject: [PATCH 095/410] Update __init__.py --- main/__init__.py | 1 - 1 file changed, 1 deletion(-) diff --git a/main/__init__.py b/main/__init__.py index 81584ba07..d75881f63 100644 --- a/main/__init__.py +++ b/main/__init__.py @@ -37,7 +37,6 @@ try: Bot.start() - idle() except Exception as e: print(e) sys.exit(1) From 764dbd7738b168910bfb242f0dd5c9543c9f1671 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Tue, 1 Feb 2022 01:28:56 +0530 Subject: [PATCH 096/410] Update __init__.py --- main/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/__init__.py b/main/__init__.py index d75881f63..49cfad184 100644 --- a/main/__init__.py +++ b/main/__init__.py @@ -1,6 +1,6 @@ #ChauhanMahesh/Vasusen/DroneBots/COL -from pyrogram import Client, filters +from pyrogram import Client from telethon.sessions import StringSession from telethon.sync import TelegramClient From 26d7d854c6dd660fd7904a9712a4117963e63855 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Tue, 1 Feb 2022 01:53:44 +0530 Subject: [PATCH 097/410] Update helpers.py --- main/plugins/helpers.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/main/plugins/helpers.py b/main/plugins/helpers.py index 2a9955e87..6bdf241fc 100644 --- a/main/plugins/helpers.py +++ b/main/plugins/helpers.py @@ -37,10 +37,10 @@ def get_link(string): #Screenshot--------------------------------------------------------------------------------------------------------------- async def screenshot(video, time_stamp, sender): - if os.path.isfile(f'{sender}.jpg'): + if os.path.exists(f'{sender}.jpg'): return f'{sender}.jpg' out = str(video).split(".")[0] + ".jpg" - cmd = (f"ffmpeg -ss {time_stamp} -i {video} -vframes 1 {out}").split(" ") + cmd = (f"ffmpeg -i {video} -ss {time_stamp} -frames:v 1 {out}").split(" ") process = await asyncio.create_subprocess_exec( *cmd, stdout=asyncio.subprocess.PIPE, @@ -51,7 +51,7 @@ async def screenshot(video, time_stamp, sender): y = stdout.decode().strip() print(x) print(y) - if os.path.isfile(out): + if os.path.exists(out): return out else: None From 44a85544eb09d6f1537e70b4036250add519e1b2 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Tue, 1 Feb 2022 02:07:32 +0530 Subject: [PATCH 098/410] Update helpers.py --- main/plugins/helpers.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/main/plugins/helpers.py b/main/plugins/helpers.py index 6bdf241fc..818847dc1 100644 --- a/main/plugins/helpers.py +++ b/main/plugins/helpers.py @@ -4,6 +4,7 @@ from telethon import errors, events import asyncio, subprocess, re, os, time +from pathlib import Path #Join private chat------------------------------------------------------------------------------------------------------------- @@ -51,7 +52,7 @@ async def screenshot(video, time_stamp, sender): y = stdout.decode().strip() print(x) print(y) - if os.path.exists(out): + if os.path.exists(str(Path(out))): return out else: None From 7b60b6a71d51861a38468e93a72fa850b2c073ec Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Tue, 1 Feb 2022 02:09:02 +0530 Subject: [PATCH 099/410] Update helpers.py --- main/plugins/helpers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/plugins/helpers.py b/main/plugins/helpers.py index 818847dc1..e2779cb6c 100644 --- a/main/plugins/helpers.py +++ b/main/plugins/helpers.py @@ -41,7 +41,7 @@ async def screenshot(video, time_stamp, sender): if os.path.exists(f'{sender}.jpg'): return f'{sender}.jpg' out = str(video).split(".")[0] + ".jpg" - cmd = (f"ffmpeg -i {video} -ss {time_stamp} -frames:v 1 {out}").split(" ") + cmd = (f"ffmpeg -i {video} -ss {time_stamp} -frames:v 1 {out} -y").split(" ") process = await asyncio.create_subprocess_exec( *cmd, stdout=asyncio.subprocess.PIPE, From a0da87507cab0fe7ae02097ac69911794b033c8e Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Tue, 1 Feb 2022 06:43:55 +0530 Subject: [PATCH 100/410] Update README.md --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index 6d7f2978f..f77bdb437 100644 --- a/README.md +++ b/README.md @@ -20,8 +20,6 @@ Get Telethon string session from [BOT](https://t.me/SessionStringGeneratorZBot) # Issues - if you see any message like `ERROR R12` in heroku logs, just restart. -- `CHANNEL INVALID` if channel not joined. -- if you face `ERROR: Client has not been started yet` then just send `/start`. # Deploy

From a55167f46a367a9bc2d154e9214aa6b06ab57fe3 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Tue, 1 Feb 2022 13:06:01 +0530 Subject: [PATCH 101/410] Update README.md --- README.md | 3 --- 1 file changed, 3 deletions(-) diff --git a/README.md b/README.md index f77bdb437..e93663c63 100644 --- a/README.md +++ b/README.md @@ -18,9 +18,6 @@ Get Telethon string session from [BOT](https://t.me/SessionStringGeneratorZBot) - `BOT TOKEN` - `FORCESUB` - Public channel username without '@' -# Issues -- if you see any message like `ERROR R12` in heroku logs, just restart. - # Deploy

From 73a30c36961b43303bb137443073898f63a33536 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Tue, 1 Feb 2022 13:06:36 +0530 Subject: [PATCH 102/410] removed issues --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index e93663c63..96dbdd18a 100644 --- a/README.md +++ b/README.md @@ -13,8 +13,7 @@ Upcoming features: - `API_ID` - `API_HASH` -- `SESSION` - Telethon string session -Get Telethon string session from [BOT](https://t.me/SessionStringGeneratorZBot) +- `SESSION` - Get Telethon string session from [BOT](https://t.me/SessionStringGeneratorZBot) - `BOT TOKEN` - `FORCESUB` - Public channel username without '@' From 3d4ec03504bd24ee3c4ea8ed893d2e4383319de4 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Tue, 1 Feb 2022 13:09:51 +0530 Subject: [PATCH 103/410] Added support link --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 96dbdd18a..1a774a6a5 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,8 @@ A simple telegram bot to save restricted content with custom thumbmail support b

+

+

Upcoming features: From ca61e52b6f060900018840625dc49353fd29d44f Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Tue, 1 Feb 2022 13:10:35 +0530 Subject: [PATCH 104/410] Changed support color --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1a774a6a5..ba7ddc676 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ A simple telegram bot to save restricted content with custom thumbmail support b

-

+

From f6a759893c13451c54568e6188f3f2830580069f Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Tue, 1 Feb 2022 13:11:19 +0530 Subject: [PATCH 105/410] Color --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ba7ddc676..cb1669240 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ A simple telegram bot to save restricted content with custom thumbmail support b

-

+

From 8ebcb39c55bb81d0f19ff3ff2c0aae3effb5681b Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Tue, 1 Feb 2022 13:16:05 +0530 Subject: [PATCH 106/410] added credits --- main/__main__.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/main/__main__.py b/main/__main__.py index ffaa319ba..fda9da21e 100644 --- a/main/__main__.py +++ b/main/__main__.py @@ -15,7 +15,9 @@ plugin_name = patt.stem load_plugins(plugin_name.replace(".py", "")) +#Don't be a thief print("Successfully deployed!") +print("By MaheshChauhan • DroneBots") if __name__ == "__main__": bot.run_until_disconnected() From 369c434e0fa39ed587316a78128e833593b35e0f Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Tue, 1 Feb 2022 14:10:38 +0530 Subject: [PATCH 107/410] Color --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index cb1669240..e6af41280 100644 --- a/README.md +++ b/README.md @@ -2,9 +2,9 @@ A simple telegram bot to save restricted content with custom thumbmail support by Mahesh Chauhan. -

+

-

+

From e8cff8344345fc657a3d4ece131bb00426f139a1 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Tue, 1 Feb 2022 14:23:30 +0530 Subject: [PATCH 108/410] Update README.md --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index e6af41280..d33d015e9 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,6 @@ -# Save Restricted Content Bot +

+ sᴀᴠᴇ ʀᴇsᴛʀɪᴄᴛᴇᴅ ᴄᴏɴᴛᴇɴᴛ ʙᴏᴛ +

A simple telegram bot to save restricted content with custom thumbmail support by Mahesh Chauhan. From 54897ef2a21b1d624b603b617afa4850bf1fbea4 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Tue, 1 Feb 2022 14:25:33 +0530 Subject: [PATCH 109/410] Update README.md --- README.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index d33d015e9..cbe00388e 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,6 @@

- sᴀᴠᴇ ʀᴇsᴛʀɪᴄᴛᴇᴅ ᴄᴏɴᴛᴇɴᴛ ʙᴏᴛ -

- -A simple telegram bot to save restricted content with custom thumbmail support by Mahesh Chauhan. + ѕᴀᴠᴇ ʀᴇѕᴛʀɪᴄᴛᴇᴅ ᴄᴏɴᴛᴇɴᴛ ʙᴏᴛ +

From 3a54c6f00fc16b712f8bb5f72ee4109154bc56c5 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Tue, 1 Feb 2022 14:29:02 +0530 Subject: [PATCH 110/410] Update README.md --- README.md | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index cbe00388e..8b672d0ba 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,15 @@

- ѕᴀᴠᴇ ʀᴇѕᴛʀɪᴄᴛᴇᴅ ᴄᴏɴᴛᴇɴᴛ ʙᴏᴛ + sᴀᴠᴇ ʀᴇsᴛʀɪᴄᴛᴇᴅ ᴄᴏɴᴛᴇɴᴛ ʙᴏᴛ

+A stable telegram bot to get restricted messages with custom thumbnail support. + +Made by: Mahesh Chauhan +

- -

-Upcoming features: -- Save multiple content at once/Save in range - # Variables - `API_ID` @@ -20,11 +19,16 @@ Upcoming features: - `FORCESUB` - Public channel username without '@' # Deploy +

if deploy button doesn't work, then deploy `manually.` -Buildpacks for manual : +Buildpacks for manual deploy: - `heroku/python` - `https://github.com/jonathanong/heroku-buildpack-ffmpeg-latest.git` + +# Upcoming features: + +- Save multiple content at once/Save in range From 6d4f292c7f2588f8d485878976121f8033371d51 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Tue, 1 Feb 2022 14:30:37 +0530 Subject: [PATCH 111/410] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8b672d0ba..666da0cef 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@

- sᴀᴠᴇ ʀᴇsᴛʀɪᴄᴛᴇᴅ ᴄᴏɴᴛᴇɴᴛ ʙᴏᴛ + Sᴀᴠᴇ ʀᴇʂᴛʀɪᴄᴛᴇᴅ ᴄᴏɴᴛᴇɴᴛ ʙᴏᴛ

A stable telegram bot to get restricted messages with custom thumbnail support. From 793695da2592a3be1a20bde0198913243946d411 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Tue, 1 Feb 2022 14:31:00 +0530 Subject: [PATCH 112/410] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 666da0cef..ac17b52d4 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@

- Sᴀᴠᴇ ʀᴇʂᴛʀɪᴄᴛᴇᴅ ᴄᴏɴᴛᴇɴᴛ ʙᴏᴛ + ʂᴀᴠᴇ ʀᴇʂᴛʀɪᴄᴛᴇᴅ ᴄᴏɴᴛᴇɴᴛ ʙᴏᴛ

A stable telegram bot to get restricted messages with custom thumbnail support. From 5c822076d54a1dcc85ec83b2e5c5a6146bb3cfbe Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Tue, 1 Feb 2022 15:54:06 +0530 Subject: [PATCH 113/410] Update README.md --- README.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index ac17b52d4..fcf963030 100644 --- a/README.md +++ b/README.md @@ -14,10 +14,13 @@ Made by: Mahesh Chauhan - `API_ID` - `API_HASH` -- `SESSION` - Get Telethon string session from [BOT](https://t.me/SessionStringGeneratorZBot) +- `SESSION` Get Telethon string session from [BOT](https://t.me/SessionStringGeneratorZBot) - `BOT TOKEN` - `FORCESUB` - Public channel username without '@' +* [![Run on Repl.it](https://replit.com/badge/github/vasusen-code/saverestrictedcontentbot)](https://replit.com/@SpEcHiDe/GenerateStringSession) + + # Deploy

From 20cc9f266a3f8c7a29264049675e35f576e92ee6 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Tue, 1 Feb 2022 16:03:19 +0530 Subject: [PATCH 114/410] Update README.md --- README.md | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index fcf963030..f2765a92f 100644 --- a/README.md +++ b/README.md @@ -13,13 +13,20 @@ Made by: Mahesh Chauhan # Variables - `API_ID` + - `API_HASH` -- `SESSION` Get Telethon string session from [BOT](https://t.me/SessionStringGeneratorZBot) -- `BOT TOKEN` -- `FORCESUB` - Public channel username without '@' + +- `SESSION` +- +Get Telethon string session from + +[![BOT](https://t.me/badge/github/vasusen-code/saverestrictedcontentbot)](https://t.me/SessionStringGeneratorZBot) -* [![Run on Repl.it](https://replit.com/badge/github/vasusen-code/saverestrictedcontentbot)](https://replit.com/@SpEcHiDe/GenerateStringSession) +[![Run on Repl.it](https://replit.com/badge/github/vasusen-code/saverestrictedcontentbot)](https://replit.com/@SpEcHiDe/GenerateStringSession) + +- `BOT TOKEN` +- `FORCESUB` - Public channel username without '@' # Deploy From 402165c8d6a1592fa75bb6bd3ef1a5bfe5199580 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Tue, 1 Feb 2022 16:10:39 +0530 Subject: [PATCH 115/410] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index f2765a92f..b57a88398 100644 --- a/README.md +++ b/README.md @@ -20,8 +20,8 @@ Made by: Mahesh Chauhan - Get Telethon string session from -[![BOT](https://t.me/badge/github/vasusen-code/saverestrictedcontentbot)](https://t.me/SessionStringGeneratorZBot) - +[![Telegram Bot](https://telegram.me/telegram/button.svg)](https://deploy.ultroid.tech) + [![Run on Repl.it](https://replit.com/badge/github/vasusen-code/saverestrictedcontentbot)](https://replit.com/@SpEcHiDe/GenerateStringSession) - `BOT TOKEN` From 649984627178dee9233d394cac1aacbdd3b8d62c Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Tue, 1 Feb 2022 16:25:32 +0530 Subject: [PATCH 116/410] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index b57a88398..1eab1a524 100644 --- a/README.md +++ b/README.md @@ -20,8 +20,8 @@ Made by: Mahesh Chauhan - Get Telethon string session from -[![Telegram Bot](https://telegram.me/telegram/button.svg)](https://deploy.ultroid.tech) - +

+ [![Run on Repl.it](https://replit.com/badge/github/vasusen-code/saverestrictedcontentbot)](https://replit.com/@SpEcHiDe/GenerateStringSession) - `BOT TOKEN` From 241658922d503cc551bed6f2335e8a6aa661933e Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Tue, 1 Feb 2022 16:26:23 +0530 Subject: [PATCH 117/410] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1eab1a524..c67e66eff 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@

- ʂᴀᴠᴇ ʀᴇʂᴛʀɪᴄᴛᴇᴅ ᴄᴏɴᴛᴇɴᴛ ʙᴏᴛ + Save restricted content Bot

A stable telegram bot to get restricted messages with custom thumbnail support. From 51cc69cad41393cf024000ca454d78e84e950bc5 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Tue, 1 Feb 2022 16:27:07 +0530 Subject: [PATCH 118/410] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index c67e66eff..953d3a0c1 100644 --- a/README.md +++ b/README.md @@ -16,8 +16,8 @@ Made by: Mahesh Chauhan - `API_HASH` -- `SESSION` -- +- `SESSION` + Get Telethon string session from

From ec1e3c692ca5f3d5631bc631dd01650b9be0f941 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Tue, 1 Feb 2022 16:33:21 +0530 Subject: [PATCH 119/410] Update README.md --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 953d3a0c1..09a4ae108 100644 --- a/README.md +++ b/README.md @@ -18,16 +18,16 @@ Made by: Mahesh Chauhan - `SESSION` +- `BOT TOKEN` + +- `FORCESUB` - Public channel username without '@' + Get Telethon string session from

[![Run on Repl.it](https://replit.com/badge/github/vasusen-code/saverestrictedcontentbot)](https://replit.com/@SpEcHiDe/GenerateStringSession) -- `BOT TOKEN` - -- `FORCESUB` - Public channel username without '@' - # Deploy

From 24e9373cf74d27ee8fc10770814eb84d7f2b3d98 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Tue, 1 Feb 2022 16:52:17 +0530 Subject: [PATCH 120/410] Update README.md --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 09a4ae108..8378780bc 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,12 @@ A stable telegram bot to get restricted messages with custom thumbnail support. +- works for both public and private +- Custom thumbnail support for Pvt medias +- supports text and webpage media messages +- Faster speed +- Forcesubscribe available + Made by: Mahesh Chauhan

From 6b914862e74b1f92443eb0db6279953d18eb42bf Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Tue, 1 Feb 2022 16:52:44 +0530 Subject: [PATCH 121/410] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8378780bc..c954599f2 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ A stable telegram bot to get restricted messages with custom thumbnail support. -- works for both public and private +- works for both public and private channels - Custom thumbnail support for Pvt medias - supports text and webpage media messages - Faster speed From 7654c92d4fc78d550ac184e8f02cec799e15f744 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Tue, 1 Feb 2022 17:07:03 +0530 Subject: [PATCH 122/410] No logic --- main/plugins/helpers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/plugins/helpers.py b/main/plugins/helpers.py index e2779cb6c..367cf03ec 100644 --- a/main/plugins/helpers.py +++ b/main/plugins/helpers.py @@ -41,7 +41,7 @@ async def screenshot(video, time_stamp, sender): if os.path.exists(f'{sender}.jpg'): return f'{sender}.jpg' out = str(video).split(".")[0] + ".jpg" - cmd = (f"ffmpeg -i {video} -ss {time_stamp} -frames:v 1 {out} -y").split(" ") + cmd = (f"ffmpeg -ss {time_stamp} -i {video} -vframes 1 {out} -y").split(" ") process = await asyncio.create_subprocess_exec( *cmd, stdout=asyncio.subprocess.PIPE, From db526adc431b9117cdf6c5518e88bdec00ab7021 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Wed, 2 Feb 2022 08:43:34 +0530 Subject: [PATCH 123/410] Update README.md --- README.md | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index c954599f2..21a500330 100644 --- a/README.md +++ b/README.md @@ -35,11 +35,13 @@ Get Telethon string session from [![Run on Repl.it](https://replit.com/badge/github/vasusen-code/saverestrictedcontentbot)](https://replit.com/@SpEcHiDe/GenerateStringSession) # Deploy - -

- -if deploy button doesn't work, then deploy `manually.` - + +- create app in heroku +- go to settings of app>> config vars>> add all variables +- add buildpacks +- connect to github and deploy +- turn on dynos + Buildpacks for manual deploy: - `heroku/python` From 47bdd96f767de364d8d7bf36dfa2302c067484b1 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Wed, 2 Feb 2022 08:48:56 +0530 Subject: [PATCH 124/410] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 21a500330..84ae0d741 100644 --- a/README.md +++ b/README.md @@ -36,6 +36,7 @@ Get Telethon string session from # Deploy +- Fork the repo, and star it - create app in heroku - go to settings of app>> config vars>> add all variables - add buildpacks From e6865c683625df124a81a93cf8da149fff6d364d Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Wed, 2 Feb 2022 09:03:24 +0530 Subject: [PATCH 125/410] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 84ae0d741..cbdcf05de 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ Made by: Mahesh Chauhan - `BOT TOKEN` -- `FORCESUB` - Public channel username without '@' +- `FORCESUB` - Public channel username without '@'. Don't forget to add bot in channel as administrator. Get Telethon string session from From 13bb7941d3e125c4766d3c600f8a2db3d0271177 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Wed, 2 Feb 2022 09:20:12 +0530 Subject: [PATCH 126/410] Update README.md --- README.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/README.md b/README.md index cbdcf05de..c74192788 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ Save restricted content Bot -A stable telegram bot to get restricted messages with custom thumbnail support. +A stable telegram bot to get restricted messages with custom thumbnail support , made by @MaheshChauhan. - works for both public and private channels - Custom thumbnail support for Pvt medias @@ -10,8 +10,6 @@ A stable telegram bot to get restricted messages with custom thumbnail support. - Faster speed - Forcesubscribe available -Made by: Mahesh Chauhan -

From e1c8fbfc7d614d4bed2f7e81b0de28da3c88e8ef Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Fri, 4 Feb 2022 14:40:01 +0530 Subject: [PATCH 127/410] Update README.md --- README.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index c74192788..fc44b3d62 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,13 @@ A stable telegram bot to get restricted messages with custom thumbnail support , - `FORCESUB` - Public channel username without '@'. Don't forget to add bot in channel as administrator. -Get Telethon string session from +Get API_ID & API_HASH from: + +

+ +

+ +Get Telethon string session from:

From 20b95254f707cc50ee6a353b7d6f89e2ee1badd2 Mon Sep 17 00:00:00 2001 From: DeekshithSH Date: Thu, 10 Feb 2022 14:12:47 +0530 Subject: [PATCH 128/410] Fixed Broken my.telegram.org Link(missing https) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index fc44b3d62..2158769d9 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ Get API_ID & API_HASH from:

-

+

Get Telethon string session from: From bffce95d33bed1adc8ac7aba0b35ed72f1905acf Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Thu, 10 Feb 2022 17:40:38 +0530 Subject: [PATCH 129/410] Create batch.py --- main/plugins/batch.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 main/plugins/batch.py diff --git a/main/plugins/batch.py b/main/plugins/batch.py new file mode 100644 index 000000000..6dfc65bbd --- /dev/null +++ b/main/plugins/batch.py @@ -0,0 +1,16 @@ +#Tg:MaheshChauhan/DroneBots +#Github.com/Vasusen-code + +from telethon import events + +async def get_pvt_content(event, chat, id): + msg = await event.client.get_messages(chat, ids=id) + await event.client.send_message(event.chat_id, msg) + +async def get_res_content(event, chat, id): + msg = await event.client.get_messages(chat, ids=id) + try: + if msg.media: + await event.client.download_media(msg.document) +async def private_batch(event, link, _range): + if not From 673eadd8094c78be53c14aa6c80b473e407fa996 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Thu, 10 Feb 2022 20:45:06 +0530 Subject: [PATCH 130/410] Update batch.py --- main/plugins/batch.py | 104 +++++++++++++++++++++++++++++++++++++++--- 1 file changed, 98 insertions(+), 6 deletions(-) diff --git a/main/plugins/batch.py b/main/plugins/batch.py index 6dfc65bbd..e4e810348 100644 --- a/main/plugins/batch.py +++ b/main/plugins/batch.py @@ -1,16 +1,108 @@ #Tg:MaheshChauhan/DroneBots #Github.com/Vasusen-code +import time, os + +from .. import bot as Drone +from .. import userbot +from .. import FORCESUB as fs + from telethon import events +from telethon.tl.types import DocumentAttributeVideo + +from ethon.pyfunc import video_metadata +from ethon.telefunc import fast_upload, fast_download, force_sub + +from main.plugins.helpers import get_link, screenshot + +def sleeptime(_range): + if _range < 25: + return _range + else: + return 60 async def get_pvt_content(event, chat, id): - msg = await event.client.get_messages(chat, ids=id) + msg = await userbot.get_messages(chat, ids=id) await event.client.send_message(event.chat_id, msg) async def get_res_content(event, chat, id): - msg = await event.client.get_messages(chat, ids=id) + msg = await userbot.get_messages(chat, ids=id) + if msg is None: + await event.client.send_message(event.chat_id, f"Couldn't get this message:\n\nchannel:` {chat}`\nid: `{id}`") + return try: - if msg.media: - await event.client.download_media(msg.document) -async def private_batch(event, link, _range): - if not + if not msg.document: + await event.client.send_message(event.chat_id, msg.text) + if not msg.media: + await event.client.send_message(event.chat_id, msg.text) + if msg.media.webpage and not msg.document: + await event.client.send_message(event.chat_id, msg.text) + return + except Exception as e: + print(e) + return await event.client.send_message(event.chat_id, msg.text) + name = msg.file.name + if not name: + if not msg.file.mime_type: + await event.client.send_message(event.chat_id, f"Couldn't get this message:\n\nchannel:` {chat}`\nid: `{id}`") + return + else: + if 'mp4' or 'x-matroska' in msg.file.mime_type: + name = f'{chat}' + '-' + f'{id}' + '.mp4' + edit = await event.client.send_message(event.chat_id, "Preparing to Download!") + await fast_download(name, msg.document, userbot, edit, time.time(), '**DOWNLOADING:**') + await edit.edit("Preparing to upload.") + if 'mp4' in file.file.mime_type or 'x-matroska' in file.file.mime_type: + metadata = video_metadata(name) + height = metadata["height"] + width = metadata["width"] + duration = metadata["duration"] + attributes = [DocumentAttributeVideo(duration=duration, w=width, h=height, supports_streaming=True)] + thumb = await screenshot(name, duration/2, event.sender_id) + caption = name + if file.text: + caption=file.text + uploader = await fast_upload(name, name, time.time(), event.client, edit, '**UPLOADING:**') + await event.client.send_file(event.chat_id, uploader, caption=caption, thumb=thumb, attributes=attributes, force_document=False) + await edit.delete() + os.remove(name) + else: + caption = name + if file.text: + caption=file.text + thumb=None + if os.path.exists(f'{event.sender_id}.jpg'): + thumb = f'{event.sender_id}.jpg' + uploader = await fast_upload(name, name, time.time(), event.client, edit, '**UPLOADING:**') + await event.client.send_file(event.chat_id, uploader, caption=caption, thumb=thumb, force_document=True) + await edit.delete() + os.remove(name) + +async def private_batch(event, chat, offset, _range): + for i in range(_range): + try: + try: + await get_pvt_content(event, chat, int(offset + _range)) + except: + await get_res_content(event, chat, int(offset + _range)) + except FloodWaitError as fw: + await asyncio.sleep(fw.seconds + 10) + try: + await get_pvt_content(event, chat, int(offset + _range)) + except: + await get_res_content(event, chat, int(offset + _range)) + timer = sleeptime(_range) + protection = await event.client.send_message(event.chat_id, f"Sleeping for `{timer}` seconds to avoid Floodwaits and Protect account!") + time.sleep(timer) + await protection.delete() + + + + + + + + + + + From af0ea4553a3bfb4a5f669657dfd87e1efe68b060 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Thu, 10 Feb 2022 20:52:30 +0530 Subject: [PATCH 131/410] Update batch.py --- main/plugins/batch.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/main/plugins/batch.py b/main/plugins/batch.py index e4e810348..74e540c21 100644 --- a/main/plugins/batch.py +++ b/main/plugins/batch.py @@ -96,9 +96,16 @@ async def private_batch(event, chat, offset, _range): time.sleep(timer) await protection.delete() - - - +@Drone.on(events.NewMessage(incoming=True, from_users=AUTH, pattern='/batch')) +async def batch(event): + if not e.is_private: + return + s, r = await force_sub(event.client, fs, event.sender_id) + if s == True: + await event.reply(r) + return + await event.client.send_message(event.chat_id, "Send me the message link you want to start saving from as reply to this message.", buttons=Button.force_reply()) + From a9d6cba1ee9c0e0c54707a6d2c60836bace783ec Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Thu, 10 Feb 2022 21:21:57 +0530 Subject: [PATCH 132/410] Update batch.py --- main/plugins/batch.py | 54 +++++++++++++++++++++++++++++++++---------- 1 file changed, 42 insertions(+), 12 deletions(-) diff --git a/main/plugins/batch.py b/main/plugins/batch.py index 74e540c21..251eb19ec 100644 --- a/main/plugins/batch.py +++ b/main/plugins/batch.py @@ -15,11 +15,13 @@ from main.plugins.helpers import get_link, screenshot -def sleeptime(_range): - if _range < 25: - return _range - else: - return 60 +def sleeptime(i): + if i < 25: + return 5 + if i < 50 and i > 25: + return 10 + if i < 100 and i > 50: + return 15 async def get_pvt_content(event, chat, id): msg = await userbot.get_messages(chat, ids=id) @@ -82,16 +84,16 @@ async def private_batch(event, chat, offset, _range): for i in range(_range): try: try: - await get_pvt_content(event, chat, int(offset + _range)) + await get_pvt_content(event, chat, int(offset + i)) except: - await get_res_content(event, chat, int(offset + _range)) + await get_res_content(event, chat, int(offset + i)) except FloodWaitError as fw: await asyncio.sleep(fw.seconds + 10) try: await get_pvt_content(event, chat, int(offset + _range)) except: await get_res_content(event, chat, int(offset + _range)) - timer = sleeptime(_range) + timer = sleeptime(int(i)) protection = await event.client.send_message(event.chat_id, f"Sleeping for `{timer}` seconds to avoid Floodwaits and Protect account!") time.sleep(timer) await protection.delete() @@ -104,10 +106,38 @@ async def batch(event): if s == True: await event.reply(r) return - await event.client.send_message(event.chat_id, "Send me the message link you want to start saving from as reply to this message.", buttons=Button.force_reply()) - - - + async with Drone.conversation(event.chat_id) as conv: + try: + await conv.send_message("Send me the message link you want to start saving from, as a reply to this message.", buttons=Button.force_reply()) + try: + link = await conv.get_reply() + except: + return await conv.send_message("Cannot wait more longer for your response!") + if not 't.me/c/' in link: + return await conv.send_message("Batch supported only for private restricted channels only!") + try: + _link = get_link(link) + chat = int(_link.split("/")[-2]) + id = int(_link.split("/")[-1]) + except: + return await conv.send_message("**Invalid link!**") + await conv.send_message("Send me the number of files/range you want to save after the given message, as a reply to this message.", buttons=Button.force_reply()) + try: + _range = await conv.get_reply() + except: + return await conv.send_message("Cannot wait more longer for your response!") + try: + value = int(_range) + if value > 100: + return await conv.send_message("You can only get 100 files in a single batch.") + except ValueError: + return await conv.send_message("Range must be an integer!") + try: + await userbot.get_messages(chat, ids=id) + except: + return await conv.send_message("Have you joined the channel?") + await private_batch(event, chat, id, value) + From 85808fa72e928a4bc1e0b83cba9efe59bd93c015 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Fri, 11 Feb 2022 13:06:12 +0530 Subject: [PATCH 133/410] Update batch.py --- main/plugins/batch.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/plugins/batch.py b/main/plugins/batch.py index 251eb19ec..2eebd950b 100644 --- a/main/plugins/batch.py +++ b/main/plugins/batch.py @@ -50,7 +50,7 @@ async def get_res_content(event, chat, id): return else: if 'mp4' or 'x-matroska' in msg.file.mime_type: - name = f'{chat}' + '-' + f'{id}' + '.mp4' + name = f'{chat}' + '-' + f'{id}' + '.mp4' edit = await event.client.send_message(event.chat_id, "Preparing to Download!") await fast_download(name, msg.document, userbot, edit, time.time(), '**DOWNLOADING:**') await edit.edit("Preparing to upload.") From 573988a803380b12c9b885157252e3982f2b4f17 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Fri, 11 Feb 2022 13:12:31 +0530 Subject: [PATCH 134/410] Rename batch.py to _batch.py --- main/plugins/{batch.py => _batch.py} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename main/plugins/{batch.py => _batch.py} (100%) diff --git a/main/plugins/batch.py b/main/plugins/_batch.py similarity index 100% rename from main/plugins/batch.py rename to main/plugins/_batch.py From 847bdaa4389937bd0b363b7fea61140b43b1cb9b Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Fri, 11 Feb 2022 13:19:44 +0530 Subject: [PATCH 135/410] Update _batch.py --- main/plugins/_batch.py | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/main/plugins/_batch.py b/main/plugins/_batch.py index 2eebd950b..9f3b1dba5 100644 --- a/main/plugins/_batch.py +++ b/main/plugins/_batch.py @@ -15,14 +15,6 @@ from main.plugins.helpers import get_link, screenshot -def sleeptime(i): - if i < 25: - return 5 - if i < 50 and i > 25: - return 10 - if i < 100 and i > 50: - return 15 - async def get_pvt_content(event, chat, id): msg = await userbot.get_messages(chat, ids=id) await event.client.send_message(event.chat_id, msg) @@ -90,10 +82,14 @@ async def private_batch(event, chat, offset, _range): except FloodWaitError as fw: await asyncio.sleep(fw.seconds + 10) try: - await get_pvt_content(event, chat, int(offset + _range)) + await get_pvt_content(event, chat, int(offset + i)) except: - await get_res_content(event, chat, int(offset + _range)) - timer = sleeptime(int(i)) + await get_res_content(event, chat, int(offset + i)) + timer = 60 + if i < 25: + timer = i + if i < 50 and i > 25: + timer = i protection = await event.client.send_message(event.chat_id, f"Sleeping for `{timer}` seconds to avoid Floodwaits and Protect account!") time.sleep(timer) await protection.delete() From b9732f59c5965afdfb0d830f5b378b7a2a25fd96 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Fri, 11 Feb 2022 13:28:45 +0530 Subject: [PATCH 136/410] Update _batch.py --- main/plugins/_batch.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/main/plugins/_batch.py b/main/plugins/_batch.py index 9f3b1dba5..b00d7dfb4 100644 --- a/main/plugins/_batch.py +++ b/main/plugins/_batch.py @@ -132,8 +132,13 @@ async def batch(event): await userbot.get_messages(chat, ids=id) except: return await conv.send_message("Have you joined the channel?") - await private_batch(event, chat, id, value) + try: + await private_batch(event, chat, id, value) + except Exception as e: + print(e) + pass + From c04ba6022f74166e4acb0ace55e5f8a67ae7e2d3 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Fri, 11 Feb 2022 17:09:05 +0530 Subject: [PATCH 137/410] Update _batch.py --- main/plugins/_batch.py | 97 ++++++++++++++++++++---------------------- 1 file changed, 46 insertions(+), 51 deletions(-) diff --git a/main/plugins/_batch.py b/main/plugins/_batch.py index b00d7dfb4..05ddc5760 100644 --- a/main/plugins/_batch.py +++ b/main/plugins/_batch.py @@ -18,7 +18,51 @@ async def get_pvt_content(event, chat, id): msg = await userbot.get_messages(chat, ids=id) await event.client.send_message(event.chat_id, msg) - + +@Drone.on(events.NewMessage(incoming=True, from_users=AUTH, pattern='/batch')) +async def batch(event): + if not e.is_private: + return + s, r = await force_sub(event.client, fs, event.sender_id) + if s == True: + await event.reply(r) + return + async with Drone.conversation(event.chat_id) as conv: + try: + await conv.send_message("Send me the message link you want to start saving from, as a reply to this message.", buttons=Button.force_reply()) + try: + link = await conv.get_reply() + except: + return await conv.send_message("Cannot wait more longer for your response!") + if not 't.me/c/' in link: + return await conv.send_message("Batch supported only for private restricted channels only!") + try: + _link = get_link(link) + chat = int(_link.split("/")[-2]) + id = int(_link.split("/")[-1]) + except: + return await conv.send_message("**Invalid link!**") + await conv.send_message("Send me the number of files/range you want to save after the given message, as a reply to this message.", buttons=Button.force_reply()) + try: + _range = await conv.get_reply() + except: + return await conv.send_message("Cannot wait more longer for your response!") + try: + value = int(_range) + if value > 100: + return await conv.send_message("You can only get 100 files in a single batch.") + except ValueError: + return await conv.send_message("Range must be an integer!") + try: + await userbot.get_messages(chat, ids=id) + except: + return await conv.send_message("Have you joined the channel?") + try: + await private_batch(event, chat, id, value) + except Exception as e: + print(e) + pass + async def get_res_content(event, chat, id): msg = await userbot.get_messages(chat, ids=id) if msg is None: @@ -94,53 +138,4 @@ async def private_batch(event, chat, offset, _range): time.sleep(timer) await protection.delete() -@Drone.on(events.NewMessage(incoming=True, from_users=AUTH, pattern='/batch')) -async def batch(event): - if not e.is_private: - return - s, r = await force_sub(event.client, fs, event.sender_id) - if s == True: - await event.reply(r) - return - async with Drone.conversation(event.chat_id) as conv: - try: - await conv.send_message("Send me the message link you want to start saving from, as a reply to this message.", buttons=Button.force_reply()) - try: - link = await conv.get_reply() - except: - return await conv.send_message("Cannot wait more longer for your response!") - if not 't.me/c/' in link: - return await conv.send_message("Batch supported only for private restricted channels only!") - try: - _link = get_link(link) - chat = int(_link.split("/")[-2]) - id = int(_link.split("/")[-1]) - except: - return await conv.send_message("**Invalid link!**") - await conv.send_message("Send me the number of files/range you want to save after the given message, as a reply to this message.", buttons=Button.force_reply()) - try: - _range = await conv.get_reply() - except: - return await conv.send_message("Cannot wait more longer for your response!") - try: - value = int(_range) - if value > 100: - return await conv.send_message("You can only get 100 files in a single batch.") - except ValueError: - return await conv.send_message("Range must be an integer!") - try: - await userbot.get_messages(chat, ids=id) - except: - return await conv.send_message("Have you joined the channel?") - try: - await private_batch(event, chat, id, value) - except Exception as e: - print(e) - pass - - - - - - - + From ad3c7fdc131e7a5f677354e37a64768ecdf9ed1a Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Fri, 11 Feb 2022 17:23:49 +0530 Subject: [PATCH 138/410] Update _batch.py --- main/plugins/_batch.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/main/plugins/_batch.py b/main/plugins/_batch.py index 05ddc5760..d9ea62bd2 100644 --- a/main/plugins/_batch.py +++ b/main/plugins/_batch.py @@ -118,6 +118,14 @@ async def get_res_content(event, chat, id): async def private_batch(event, chat, offset, _range): for i in range(_range): + print(f"Starting a batch transfer for {_range} files") + timer = 60 + if i < 25: + timer = 5 + if i < 50 and i > 25: + timer = 10 + if i < 100 and i > 50: + timer = 15 try: try: await get_pvt_content(event, chat, int(offset + i)) @@ -129,11 +137,6 @@ async def private_batch(event, chat, offset, _range): await get_pvt_content(event, chat, int(offset + i)) except: await get_res_content(event, chat, int(offset + i)) - timer = 60 - if i < 25: - timer = i - if i < 50 and i > 25: - timer = i protection = await event.client.send_message(event.chat_id, f"Sleeping for `{timer}` seconds to avoid Floodwaits and Protect account!") time.sleep(timer) await protection.delete() From 71b40922528813fc4b9884f1c10d25b3fa8e15e8 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Fri, 11 Feb 2022 17:28:25 +0530 Subject: [PATCH 139/410] Update _batch.py --- main/plugins/_batch.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main/plugins/_batch.py b/main/plugins/_batch.py index d9ea62bd2..7fabeab4a 100644 --- a/main/plugins/_batch.py +++ b/main/plugins/_batch.py @@ -62,8 +62,8 @@ async def batch(event): except Exception as e: print(e) pass - -async def get_res_content(event, chat, id): + +async def get_res_content(event, chat, id): msg = await userbot.get_messages(chat, ids=id) if msg is None: await event.client.send_message(event.chat_id, f"Couldn't get this message:\n\nchannel:` {chat}`\nid: `{id}`") From 7401f6b38aaf7fb833a52c8d3535987805b6c795 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Fri, 11 Feb 2022 17:30:52 +0530 Subject: [PATCH 140/410] Update _batch.py --- main/plugins/_batch.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/main/plugins/_batch.py b/main/plugins/_batch.py index 7fabeab4a..44f143296 100644 --- a/main/plugins/_batch.py +++ b/main/plugins/_batch.py @@ -63,7 +63,8 @@ async def batch(event): print(e) pass -async def get_res_content(event, chat, id): + +async def get_res_content(event, chat, id): msg = await userbot.get_messages(chat, ids=id) if msg is None: await event.client.send_message(event.chat_id, f"Couldn't get this message:\n\nchannel:` {chat}`\nid: `{id}`") From 780c5e8f226929cb1273e0435d2b6209628d0bc6 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Fri, 11 Feb 2022 17:32:59 +0530 Subject: [PATCH 141/410] Update _batch.py --- main/plugins/_batch.py | 53 +++++++++++++++++++++--------------------- 1 file changed, 26 insertions(+), 27 deletions(-) diff --git a/main/plugins/_batch.py b/main/plugins/_batch.py index 44f143296..5c7921d31 100644 --- a/main/plugins/_batch.py +++ b/main/plugins/_batch.py @@ -62,7 +62,32 @@ async def batch(event): except Exception as e: print(e) pass - + conv.cancel() + +async def private_batch(event, chat, offset, _range): + for i in range(_range): + print(f"Starting a batch transfer for {_range} files") + timer = 60 + if i < 25: + timer = 5 + if i < 50 and i > 25: + timer = 10 + if i < 100 and i > 50: + timer = 15 + try: + try: + await get_pvt_content(event, chat, int(offset + i)) + except: + await get_res_content(event, chat, int(offset + i)) + except FloodWaitError as fw: + await asyncio.sleep(fw.seconds + 10) + try: + await get_pvt_content(event, chat, int(offset + i)) + except: + await get_res_content(event, chat, int(offset + i)) + protection = await event.client.send_message(event.chat_id, f"Sleeping for `{timer}` seconds to avoid Floodwaits and Protect account!") + time.sleep(timer) + await protection.delete() async def get_res_content(event, chat, id): msg = await userbot.get_messages(chat, ids=id) @@ -117,29 +142,3 @@ async def get_res_content(event, chat, id): await edit.delete() os.remove(name) -async def private_batch(event, chat, offset, _range): - for i in range(_range): - print(f"Starting a batch transfer for {_range} files") - timer = 60 - if i < 25: - timer = 5 - if i < 50 and i > 25: - timer = 10 - if i < 100 and i > 50: - timer = 15 - try: - try: - await get_pvt_content(event, chat, int(offset + i)) - except: - await get_res_content(event, chat, int(offset + i)) - except FloodWaitError as fw: - await asyncio.sleep(fw.seconds + 10) - try: - await get_pvt_content(event, chat, int(offset + i)) - except: - await get_res_content(event, chat, int(offset + i)) - protection = await event.client.send_message(event.chat_id, f"Sleeping for `{timer}` seconds to avoid Floodwaits and Protect account!") - time.sleep(timer) - await protection.delete() - - From 59f70a0ef9f23dc02ffe7a37b0bc550483a498b2 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Fri, 11 Feb 2022 17:33:46 +0530 Subject: [PATCH 142/410] Update _batch.py --- main/plugins/_batch.py | 1 - 1 file changed, 1 deletion(-) diff --git a/main/plugins/_batch.py b/main/plugins/_batch.py index 5c7921d31..276646d39 100644 --- a/main/plugins/_batch.py +++ b/main/plugins/_batch.py @@ -61,7 +61,6 @@ async def batch(event): await private_batch(event, chat, id, value) except Exception as e: print(e) - pass conv.cancel() async def private_batch(event, chat, offset, _range): From 007ec74a033d45e65ec62bd47917d20478781095 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Fri, 11 Feb 2022 17:42:37 +0530 Subject: [PATCH 143/410] Update _batch.py --- main/plugins/_batch.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/main/plugins/_batch.py b/main/plugins/_batch.py index 276646d39..4fcbefe1f 100644 --- a/main/plugins/_batch.py +++ b/main/plugins/_batch.py @@ -57,12 +57,11 @@ async def batch(event): await userbot.get_messages(chat, ids=id) except: return await conv.send_message("Have you joined the channel?") - try: - await private_batch(event, chat, id, value) - except Exception as e: - print(e) + await private_batch(event, chat, id, value) conv.cancel() - + except Exception as e: + print(e) + async def private_batch(event, chat, offset, _range): for i in range(_range): print(f"Starting a batch transfer for {_range} files") From 89abc7f19a60f9df2ed75922497b7a7f5a4c787d Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Fri, 11 Feb 2022 17:45:40 +0530 Subject: [PATCH 144/410] Update _batch.py --- main/plugins/_batch.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/plugins/_batch.py b/main/plugins/_batch.py index 4fcbefe1f..669f14a7b 100644 --- a/main/plugins/_batch.py +++ b/main/plugins/_batch.py @@ -4,7 +4,7 @@ import time, os from .. import bot as Drone -from .. import userbot +from .. import userbot, AUTH from .. import FORCESUB as fs from telethon import events From 190fa16c68e2e290956df5e115982f30ebc09191 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Fri, 11 Feb 2022 17:46:48 +0530 Subject: [PATCH 145/410] Update __init__.py --- main/__init__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/main/__init__.py b/main/__init__.py index 49cfad184..a02c270ff 100644 --- a/main/__init__.py +++ b/main/__init__.py @@ -17,6 +17,7 @@ BOT_TOKEN = config("BOT_TOKEN", default=None) SESSION = config("SESSION", default=None) FORCESUB = config("FORCESUB", default=None) +AUTH = config("AUTH", default=None, cast=None) bot = TelegramClient('bot', API_ID, API_HASH).start(bot_token=BOT_TOKEN) From 958f9e293e8302b0902ce08b854ce01ad65a7cd2 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Fri, 11 Feb 2022 17:49:45 +0530 Subject: [PATCH 146/410] Update __init__.py --- main/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/__init__.py b/main/__init__.py index a02c270ff..ea284386b 100644 --- a/main/__init__.py +++ b/main/__init__.py @@ -17,7 +17,7 @@ BOT_TOKEN = config("BOT_TOKEN", default=None) SESSION = config("SESSION", default=None) FORCESUB = config("FORCESUB", default=None) -AUTH = config("AUTH", default=None, cast=None) +AUTH = config("AUTH", default=None, cast=int) bot = TelegramClient('bot', API_ID, API_HASH).start(bot_token=BOT_TOKEN) From 04c256ec08494e97384459b30ee7ee2efabb0b7b Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Fri, 11 Feb 2022 18:03:21 +0530 Subject: [PATCH 147/410] Update _batch.py --- main/plugins/_batch.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/plugins/_batch.py b/main/plugins/_batch.py index 669f14a7b..9c063e5a6 100644 --- a/main/plugins/_batch.py +++ b/main/plugins/_batch.py @@ -21,7 +21,7 @@ async def get_pvt_content(event, chat, id): @Drone.on(events.NewMessage(incoming=True, from_users=AUTH, pattern='/batch')) async def batch(event): - if not e.is_private: + if not event.is_private: return s, r = await force_sub(event.client, fs, event.sender_id) if s == True: From cb3a6fb27f34ef092a94bbcd527c79f1ebf72a0d Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Fri, 11 Feb 2022 18:09:06 +0530 Subject: [PATCH 148/410] Update _batch.py --- main/plugins/_batch.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/plugins/_batch.py b/main/plugins/_batch.py index 9c063e5a6..d50bd6823 100644 --- a/main/plugins/_batch.py +++ b/main/plugins/_batch.py @@ -7,7 +7,7 @@ from .. import userbot, AUTH from .. import FORCESUB as fs -from telethon import events +from telethon import events, Button from telethon.tl.types import DocumentAttributeVideo from ethon.pyfunc import video_metadata From 3d730d6c8d9d399af5c551ec641bc9a73d07e0a6 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Fri, 11 Feb 2022 18:16:05 +0530 Subject: [PATCH 149/410] Update _batch.py --- main/plugins/_batch.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main/plugins/_batch.py b/main/plugins/_batch.py index d50bd6823..68ded5ca4 100644 --- a/main/plugins/_batch.py +++ b/main/plugins/_batch.py @@ -34,10 +34,10 @@ async def batch(event): link = await conv.get_reply() except: return await conv.send_message("Cannot wait more longer for your response!") - if not 't.me/c/' in link: + if not 't.me/c/' in link.text: return await conv.send_message("Batch supported only for private restricted channels only!") try: - _link = get_link(link) + _link = get_link(link.text) chat = int(_link.split("/")[-2]) id = int(_link.split("/")[-1]) except: From 49f8ef21ba1826af765451000490cc6aad3fcab1 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Fri, 11 Feb 2022 18:22:09 +0530 Subject: [PATCH 150/410] Update _batch.py --- main/plugins/_batch.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/main/plugins/_batch.py b/main/plugins/_batch.py index 68ded5ca4..f60f8e097 100644 --- a/main/plugins/_batch.py +++ b/main/plugins/_batch.py @@ -28,7 +28,7 @@ async def batch(event): await event.reply(r) return async with Drone.conversation(event.chat_id) as conv: - try: + if, s != True await conv.send_message("Send me the message link you want to start saving from, as a reply to this message.", buttons=Button.force_reply()) try: link = await conv.get_reply() @@ -38,8 +38,8 @@ async def batch(event): return await conv.send_message("Batch supported only for private restricted channels only!") try: _link = get_link(link.text) - chat = int(_link.split("/")[-2]) - id = int(_link.split("/")[-1]) + chat = int((str(_link)).split("/")[-2]) + id = int((str(_link)).split("/")[-1]) except: return await conv.send_message("**Invalid link!**") await conv.send_message("Send me the number of files/range you want to save after the given message, as a reply to this message.", buttons=Button.force_reply()) @@ -57,10 +57,11 @@ async def batch(event): await userbot.get_messages(chat, ids=id) except: return await conv.send_message("Have you joined the channel?") - await private_batch(event, chat, id, value) - conv.cancel() - except Exception as e: - print(e) + try: + await private_batch(event, chat, id, value) + conv.cancel() + except Exception as e: + print(e) async def private_batch(event, chat, offset, _range): for i in range(_range): From 9f00ea345408232b16229379717f56988c531683 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Fri, 11 Feb 2022 18:23:22 +0530 Subject: [PATCH 151/410] Update _batch.py --- main/plugins/_batch.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/plugins/_batch.py b/main/plugins/_batch.py index f60f8e097..5f2469a48 100644 --- a/main/plugins/_batch.py +++ b/main/plugins/_batch.py @@ -28,7 +28,7 @@ async def batch(event): await event.reply(r) return async with Drone.conversation(event.chat_id) as conv: - if, s != True + if s != True await conv.send_message("Send me the message link you want to start saving from, as a reply to this message.", buttons=Button.force_reply()) try: link = await conv.get_reply() From 597780fb1814e31a8a8a9c6d20e5958edd94188f Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Fri, 11 Feb 2022 18:26:06 +0530 Subject: [PATCH 152/410] Update _batch.py --- main/plugins/_batch.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/plugins/_batch.py b/main/plugins/_batch.py index 5f2469a48..6ce691b5a 100644 --- a/main/plugins/_batch.py +++ b/main/plugins/_batch.py @@ -28,7 +28,7 @@ async def batch(event): await event.reply(r) return async with Drone.conversation(event.chat_id) as conv: - if s != True + if s != True: await conv.send_message("Send me the message link you want to start saving from, as a reply to this message.", buttons=Button.force_reply()) try: link = await conv.get_reply() From 775446941ed8d08da9610ae308de4ea6cc3e256b Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Fri, 11 Feb 2022 18:30:50 +0530 Subject: [PATCH 153/410] Update _batch.py --- main/plugins/_batch.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/plugins/_batch.py b/main/plugins/_batch.py index 6ce691b5a..697a8c4f7 100644 --- a/main/plugins/_batch.py +++ b/main/plugins/_batch.py @@ -48,7 +48,7 @@ async def batch(event): except: return await conv.send_message("Cannot wait more longer for your response!") try: - value = int(_range) + value = int(_range.text) if value > 100: return await conv.send_message("You can only get 100 files in a single batch.") except ValueError: From d0796c031ebf57697a8f23c10ef51a8b9cd67bcb Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Fri, 11 Feb 2022 18:36:54 +0530 Subject: [PATCH 154/410] Update _batch.py --- main/plugins/_batch.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/main/plugins/_batch.py b/main/plugins/_batch.py index 697a8c4f7..9ad2a017a 100644 --- a/main/plugins/_batch.py +++ b/main/plugins/_batch.py @@ -32,7 +32,8 @@ async def batch(event): await conv.send_message("Send me the message link you want to start saving from, as a reply to this message.", buttons=Button.force_reply()) try: link = await conv.get_reply() - except: + except Exception as e: + print(e) return await conv.send_message("Cannot wait more longer for your response!") if not 't.me/c/' in link.text: return await conv.send_message("Batch supported only for private restricted channels only!") @@ -40,12 +41,14 @@ async def batch(event): _link = get_link(link.text) chat = int((str(_link)).split("/")[-2]) id = int((str(_link)).split("/")[-1]) - except: + except Exception as e: + print(e) return await conv.send_message("**Invalid link!**") await conv.send_message("Send me the number of files/range you want to save after the given message, as a reply to this message.", buttons=Button.force_reply()) try: _range = await conv.get_reply() - except: + except Exception as e: + print(e) return await conv.send_message("Cannot wait more longer for your response!") try: value = int(_range.text) @@ -55,7 +58,8 @@ async def batch(event): return await conv.send_message("Range must be an integer!") try: await userbot.get_messages(chat, ids=id) - except: + except Exception as e: + print(e) return await conv.send_message("Have you joined the channel?") try: await private_batch(event, chat, id, value) From 492f2db3e8a6e5e63634672a05232efc2692d19c Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Fri, 11 Feb 2022 18:40:00 +0530 Subject: [PATCH 155/410] Update _batch.py --- main/plugins/_batch.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/main/plugins/_batch.py b/main/plugins/_batch.py index 9ad2a017a..4953eeb49 100644 --- a/main/plugins/_batch.py +++ b/main/plugins/_batch.py @@ -80,13 +80,13 @@ async def private_batch(event, chat, offset, _range): try: try: await get_pvt_content(event, chat, int(offset + i)) - except: + except Exception: await get_res_content(event, chat, int(offset + i)) except FloodWaitError as fw: await asyncio.sleep(fw.seconds + 10) try: await get_pvt_content(event, chat, int(offset + i)) - except: + except Exception: await get_res_content(event, chat, int(offset + i)) protection = await event.client.send_message(event.chat_id, f"Sleeping for `{timer}` seconds to avoid Floodwaits and Protect account!") time.sleep(timer) @@ -102,9 +102,6 @@ async def get_res_content(event, chat, id): await event.client.send_message(event.chat_id, msg.text) if not msg.media: await event.client.send_message(event.chat_id, msg.text) - if msg.media.webpage and not msg.document: - await event.client.send_message(event.chat_id, msg.text) - return except Exception as e: print(e) return await event.client.send_message(event.chat_id, msg.text) From e74f520340b6e0a19f68693924109d802964edd4 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Fri, 11 Feb 2022 18:41:24 +0530 Subject: [PATCH 156/410] Update _batch.py --- main/plugins/_batch.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main/plugins/_batch.py b/main/plugins/_batch.py index 4953eeb49..4ccbd2aad 100644 --- a/main/plugins/_batch.py +++ b/main/plugins/_batch.py @@ -98,10 +98,10 @@ async def get_res_content(event, chat, id): await event.client.send_message(event.chat_id, f"Couldn't get this message:\n\nchannel:` {chat}`\nid: `{id}`") return try: - if not msg.document: - await event.client.send_message(event.chat_id, msg.text) if not msg.media: await event.client.send_message(event.chat_id, msg.text) + if not msg.file.name: + await event.client.send_message(event.chat_id, msg.text) except Exception as e: print(e) return await event.client.send_message(event.chat_id, msg.text) From 48b5b40d2f25118d4ab6f58a73b91082fd54de8e Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Fri, 11 Feb 2022 18:48:13 +0530 Subject: [PATCH 157/410] Update _batch.py --- main/plugins/_batch.py | 1 + 1 file changed, 1 insertion(+) diff --git a/main/plugins/_batch.py b/main/plugins/_batch.py index 4ccbd2aad..0c6a0b76d 100644 --- a/main/plugins/_batch.py +++ b/main/plugins/_batch.py @@ -66,6 +66,7 @@ async def batch(event): conv.cancel() except Exception as e: print(e) + pass async def private_batch(event, chat, offset, _range): for i in range(_range): From 724115a93d4fb7252f7d9d3f113fa2fe98bc09f9 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Fri, 11 Feb 2022 18:52:27 +0530 Subject: [PATCH 158/410] Update main.py --- main/plugins/main.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/main/plugins/main.py b/main/plugins/main.py index bd6a0933e..f472e0709 100644 --- a/main/plugins/main.py +++ b/main/plugins/main.py @@ -16,6 +16,9 @@ @Drone.on(events.NewMessage(incoming=True, func=lambda e: e.is_private)) async def clone(event): + reply = event.get_reply_message() + if reply: + return try: link = get_link(event.text) if not link: From 4fc280ec6342d4bc8a012af457e37780b29fcb70 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Fri, 11 Feb 2022 18:57:37 +0530 Subject: [PATCH 159/410] Update _batch.py --- main/plugins/_batch.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/plugins/_batch.py b/main/plugins/_batch.py index 0c6a0b76d..9523705f1 100644 --- a/main/plugins/_batch.py +++ b/main/plugins/_batch.py @@ -39,7 +39,7 @@ async def batch(event): return await conv.send_message("Batch supported only for private restricted channels only!") try: _link = get_link(link.text) - chat = int((str(_link)).split("/")[-2]) + chat = int('-100' + (str(_link)).split("/")[-2]) id = int((str(_link)).split("/")[-1]) except Exception as e: print(e) From 5cf44a353a29476d96d2076ffe391676b47633c9 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Fri, 11 Feb 2022 19:08:44 +0530 Subject: [PATCH 160/410] Update _batch.py --- main/plugins/_batch.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main/plugins/_batch.py b/main/plugins/_batch.py index 9523705f1..78bfb65fd 100644 --- a/main/plugins/_batch.py +++ b/main/plugins/_batch.py @@ -7,7 +7,7 @@ from .. import userbot, AUTH from .. import FORCESUB as fs -from telethon import events, Button +from telethon import events, Button, errors from telethon.tl.types import DocumentAttributeVideo from ethon.pyfunc import video_metadata @@ -83,7 +83,7 @@ async def private_batch(event, chat, offset, _range): await get_pvt_content(event, chat, int(offset + i)) except Exception: await get_res_content(event, chat, int(offset + i)) - except FloodWaitError as fw: + except errors.FloodWaitError as fw: await asyncio.sleep(fw.seconds + 10) try: await get_pvt_content(event, chat, int(offset + i)) From 2f3ecf13e19056d6dc184ad1a10bf9f384a5b406 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Fri, 11 Feb 2022 19:17:44 +0530 Subject: [PATCH 161/410] Update _batch.py --- main/plugins/_batch.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/main/plugins/_batch.py b/main/plugins/_batch.py index 78bfb65fd..bde3e2f8e 100644 --- a/main/plugins/_batch.py +++ b/main/plugins/_batch.py @@ -125,16 +125,16 @@ async def get_res_content(event, chat, id): attributes = [DocumentAttributeVideo(duration=duration, w=width, h=height, supports_streaming=True)] thumb = await screenshot(name, duration/2, event.sender_id) caption = name - if file.text: - caption=file.text + if msg.text: + caption=msg.text uploader = await fast_upload(name, name, time.time(), event.client, edit, '**UPLOADING:**') await event.client.send_file(event.chat_id, uploader, caption=caption, thumb=thumb, attributes=attributes, force_document=False) await edit.delete() os.remove(name) else: caption = name - if file.text: - caption=file.text + if msg.text: + caption=msg.text thumb=None if os.path.exists(f'{event.sender_id}.jpg'): thumb = f'{event.sender_id}.jpg' From 348da682c9c79877976fc0cb4096c167502ca1d2 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Fri, 11 Feb 2022 19:31:40 +0530 Subject: [PATCH 162/410] Update _batch.py --- main/plugins/_batch.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/main/plugins/_batch.py b/main/plugins/_batch.py index bde3e2f8e..b9e2c407f 100644 --- a/main/plugins/_batch.py +++ b/main/plugins/_batch.py @@ -99,13 +99,12 @@ async def get_res_content(event, chat, id): await event.client.send_message(event.chat_id, f"Couldn't get this message:\n\nchannel:` {chat}`\nid: `{id}`") return try: - if not msg.media: + if msg.text and not msg.media: await event.client.send_message(event.chat_id, msg.text) - if not msg.file.name: + if msg.media.webpage: await event.client.send_message(event.chat_id, msg.text) - except Exception as e: - print(e) - return await event.client.send_message(event.chat_id, msg.text) + except Exception: + pass name = msg.file.name if not name: if not msg.file.mime_type: @@ -117,7 +116,7 @@ async def get_res_content(event, chat, id): edit = await event.client.send_message(event.chat_id, "Preparing to Download!") await fast_download(name, msg.document, userbot, edit, time.time(), '**DOWNLOADING:**') await edit.edit("Preparing to upload.") - if 'mp4' in file.file.mime_type or 'x-matroska' in file.file.mime_type: + if 'mp4' in msg.file.mime_type or 'x-matroska' in msg.file.mime_type: metadata = video_metadata(name) height = metadata["height"] width = metadata["width"] From 76d45f501872ddac250c5c9983675a9ce33ec48b Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Fri, 11 Feb 2022 19:43:27 +0530 Subject: [PATCH 163/410] Update main.py --- main/plugins/main.py | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/main/plugins/main.py b/main/plugins/main.py index f472e0709..d3d6d6c99 100644 --- a/main/plugins/main.py +++ b/main/plugins/main.py @@ -49,16 +49,12 @@ async def clone(event): return if file and file.text: try: - if not file.media: - await edit.edit(file.text) - return - if not file.file.name: - await edit.edit(file.text) - return - except: - if file.media.webpage: - await edit.edit(file.text) - return + if msg.text and not msg.media: + await event.client.send_message(event.chat_id, msg.text) + if msg.media.webpage: + await event.client.send_message(event.chat_id, msg.text) + except Exception: + pass name = file.file.name if not name: if not file.file.mime_type: From 526c671507ebef62edbf2c2e305d676ff13a1bbf Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Fri, 11 Feb 2022 19:44:14 +0530 Subject: [PATCH 164/410] Update main.py --- main/plugins/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/plugins/main.py b/main/plugins/main.py index d3d6d6c99..8876140b6 100644 --- a/main/plugins/main.py +++ b/main/plugins/main.py @@ -16,7 +16,7 @@ @Drone.on(events.NewMessage(incoming=True, func=lambda e: e.is_private)) async def clone(event): - reply = event.get_reply_message() + reply = await event.get_reply_message() if reply: return try: From ca6f3b87fbce9c5f898b17ca90372b8c4c85ff20 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Fri, 11 Feb 2022 19:47:47 +0530 Subject: [PATCH 165/410] Update main.py --- main/plugins/main.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/main/plugins/main.py b/main/plugins/main.py index 8876140b6..e06b4e100 100644 --- a/main/plugins/main.py +++ b/main/plugins/main.py @@ -16,8 +16,7 @@ @Drone.on(events.NewMessage(incoming=True, func=lambda e: e.is_private)) async def clone(event): - reply = await event.get_reply_message() - if reply: + if event.is_reply: return try: link = get_link(event.text) From b51e676293a8f08c5c492caad63275e54a7a3d0d Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Fri, 11 Feb 2022 19:49:17 +0530 Subject: [PATCH 166/410] Update _batch.py --- main/plugins/_batch.py | 1 - 1 file changed, 1 deletion(-) diff --git a/main/plugins/_batch.py b/main/plugins/_batch.py index b9e2c407f..4d5a686e3 100644 --- a/main/plugins/_batch.py +++ b/main/plugins/_batch.py @@ -70,7 +70,6 @@ async def batch(event): async def private_batch(event, chat, offset, _range): for i in range(_range): - print(f"Starting a batch transfer for {_range} files") timer = 60 if i < 25: timer = 5 From c976be3161a4a7d618e7553a2f8f1c5167e9420a Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Fri, 11 Feb 2022 19:59:41 +0530 Subject: [PATCH 167/410] Update _start.py --- main/plugins/_start.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/main/plugins/_start.py b/main/plugins/_start.py index 0af9eb834..9e8656cda 100644 --- a/main/plugins/_start.py +++ b/main/plugins/_start.py @@ -44,5 +44,6 @@ async def remt(event): @Drone.on(events.NewMessage(incoming=True, pattern=f"{S}")) async def start(event): - await start_srb(event) + text = "Send me Link of any message to clone it here, For private channel message, send invite link first.\n\n**SUPPORT:** @TeamDrone" + await start_srb(event, text) From 0a22214c004ef282914bd9787a42eead88341a9a Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Fri, 11 Feb 2022 20:01:38 +0530 Subject: [PATCH 168/410] Update main.py --- main/plugins/main.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/main/plugins/main.py b/main/plugins/main.py index e06b4e100..8098226f5 100644 --- a/main/plugins/main.py +++ b/main/plugins/main.py @@ -14,6 +14,8 @@ from main.plugins.helpers import get_link, join, screenshot +ft = f"To use this bot you've to join @{fs}." + @Drone.on(events.NewMessage(incoming=True, func=lambda e: e.is_private)) async def clone(event): if event.is_reply: @@ -24,7 +26,7 @@ async def clone(event): return except TypeError: return - s, r = await force_sub(event.client, fs, event.sender_id) + s, r = await force_sub(event.client, fs, event.sender_id, ft) if s == True: await event.reply(r) return From 6ad6e7b8978f3ddf4c49f8dbc31bace6a1172f99 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Fri, 11 Feb 2022 20:02:28 +0530 Subject: [PATCH 169/410] Update _batch.py --- main/plugins/_batch.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/main/plugins/_batch.py b/main/plugins/_batch.py index 4d5a686e3..79ea427ff 100644 --- a/main/plugins/_batch.py +++ b/main/plugins/_batch.py @@ -15,6 +15,8 @@ from main.plugins.helpers import get_link, screenshot +ft = f"To use this bot you've to join @{fs}." + async def get_pvt_content(event, chat, id): msg = await userbot.get_messages(chat, ids=id) await event.client.send_message(event.chat_id, msg) @@ -23,7 +25,7 @@ async def get_pvt_content(event, chat, id): async def batch(event): if not event.is_private: return - s, r = await force_sub(event.client, fs, event.sender_id) + s, r = await force_sub(event.client, fs, event.sender_id, ft) if s == True: await event.reply(r) return From 823b2e9be59ef64f2bb36b681c1b340d905c94eb Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Fri, 11 Feb 2022 20:08:36 +0530 Subject: [PATCH 170/410] Update requirements.txt --- requirements.txt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/requirements.txt b/requirements.txt index b8ab0094d..3b015a618 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,7 +1,6 @@ #Github.com-Vasusen-code - -ethon +ethon==1.3.5 cryptg tgcrypto pyrogram From 502e56baf06aa1dd675a196bd08ac55612f19288 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Fri, 11 Feb 2022 20:42:12 +0530 Subject: [PATCH 171/410] Update requirements.txt --- requirements.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 3b015a618..11725d996 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,9 +1,10 @@ #Github.com-Vasusen-code +git+https://github.com/LonamiWebs/Telethon + ethon==1.3.5 cryptg tgcrypto pyrogram python-decouple telethon-tgcrypto -https://github.com/New-dev0/Telethon/archive/Vector.zip #Until telethon update From fa0e8a5f5347629766284663c9c48bb99a60a8d2 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Fri, 11 Feb 2022 20:47:17 +0530 Subject: [PATCH 172/410] Update requirements.txt --- requirements.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/requirements.txt b/requirements.txt index 11725d996..6d44b17ac 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,9 @@ #Github.com-Vasusen-code git+https://github.com/LonamiWebs/Telethon +markdown-it-py~=1.1.0 +pyaes~=1.6.1 +rsa~=4.7.2 ethon==1.3.5 cryptg From bb7d7025f460ec30ced0e6e242634201bbee0a9e Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Fri, 11 Feb 2022 21:34:34 +0530 Subject: [PATCH 173/410] Update requirements.txt --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 6d44b17ac..1dac6f5fa 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,6 @@ #Github.com-Vasusen-code -git+https://github.com/LonamiWebs/Telethon +https://github.com/New-dev0/Telethon/archive/Vector.zip #Until telethon update markdown-it-py~=1.1.0 pyaes~=1.6.1 rsa~=4.7.2 From 9d2164b4606d4e201d1760a55ff8b3a1df86b609 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Fri, 11 Feb 2022 21:38:53 +0530 Subject: [PATCH 174/410] Update main.py --- main/plugins/main.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/main/plugins/main.py b/main/plugins/main.py index 8098226f5..2ca07e479 100644 --- a/main/plugins/main.py +++ b/main/plugins/main.py @@ -16,6 +16,11 @@ ft = f"To use this bot you've to join @{fs}." +# To-Do: +# Make these codes shorter and clean +# Add batch for Public messages +# replace pyroplug with telethon plugin for public channel + @Drone.on(events.NewMessage(incoming=True, func=lambda e: e.is_private)) async def clone(event): if event.is_reply: From 260cccb4012ef02f43985c8230eb75152d1dc8b7 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Fri, 11 Feb 2022 21:40:48 +0530 Subject: [PATCH 175/410] Rename _batch.py to batch.py --- main/plugins/{_batch.py => batch.py} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename main/plugins/{_batch.py => batch.py} (100%) diff --git a/main/plugins/_batch.py b/main/plugins/batch.py similarity index 100% rename from main/plugins/_batch.py rename to main/plugins/batch.py From 07707e6a6758a393363ee2d3057799d75306b02f Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Fri, 11 Feb 2022 21:41:29 +0530 Subject: [PATCH 176/410] Update batch.py --- main/plugins/batch.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/main/plugins/batch.py b/main/plugins/batch.py index 79ea427ff..982697910 100644 --- a/main/plugins/batch.py +++ b/main/plugins/batch.py @@ -1,6 +1,10 @@ #Tg:MaheshChauhan/DroneBots #Github.com/Vasusen-code +""" +Plugin for private channels only! +""" + import time, os from .. import bot as Drone From fc8fe975410a4e186ccfa40d0835c47b69025a79 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Fri, 11 Feb 2022 21:41:53 +0530 Subject: [PATCH 177/410] Rename _start.py to start.py --- main/plugins/{_start.py => start.py} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename main/plugins/{_start.py => start.py} (100%) diff --git a/main/plugins/_start.py b/main/plugins/start.py similarity index 100% rename from main/plugins/_start.py rename to main/plugins/start.py From ac83143d277a0d9e1d617952e15fa52c2d8456c6 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Fri, 11 Feb 2022 22:08:37 +0530 Subject: [PATCH 178/410] Update batch.py --- main/plugins/batch.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/main/plugins/batch.py b/main/plugins/batch.py index 982697910..d380e71c2 100644 --- a/main/plugins/batch.py +++ b/main/plugins/batch.py @@ -21,18 +21,24 @@ ft = f"To use this bot you've to join @{fs}." +batch = [] + async def get_pvt_content(event, chat, id): msg = await userbot.get_messages(chat, ids=id) await event.client.send_message(event.chat_id, msg) @Drone.on(events.NewMessage(incoming=True, from_users=AUTH, pattern='/batch')) -async def batch(event): +async def _batch(event): if not event.is_private: return + # wtf is the use of fsub here if the command is meant for the owner? + # well am too lazy to clean s, r = await force_sub(event.client, fs, event.sender_id, ft) if s == True: await event.reply(r) return + if f'{event.sender_id}' in batch: + return await event.reply("You've already started one batch, wait for it to complete you dumbfuck owner!") async with Drone.conversation(event.chat_id) as conv: if s != True: await conv.send_message("Send me the message link you want to start saving from, as a reply to this message.", buttons=Button.force_reply()) @@ -50,7 +56,7 @@ async def batch(event): except Exception as e: print(e) return await conv.send_message("**Invalid link!**") - await conv.send_message("Send me the number of files/range you want to save after the given message, as a reply to this message.", buttons=Button.force_reply()) + await conv.send_message("Send me the number of files/range you want to save from the given message, as a reply to this message.", buttons=Button.force_reply()) try: _range = await conv.get_reply() except Exception as e: @@ -59,7 +65,7 @@ async def batch(event): try: value = int(_range.text) if value > 100: - return await conv.send_message("You can only get 100 files in a single batch.") + return await conv.send_message("You can only get upto 100 files in a single batch.") except ValueError: return await conv.send_message("Range must be an integer!") try: @@ -68,10 +74,13 @@ async def batch(event): print(e) return await conv.send_message("Have you joined the channel?") try: + batch.append(f'{event.sender_id}') await private_batch(event, chat, id, value) conv.cancel() + batch.pop(0) except Exception as e: print(e) + batch.pop(0) pass async def private_batch(event, chat, offset, _range): From 52629b7f2078b2281d296353f4811a3dfd89cae6 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Fri, 11 Feb 2022 22:13:21 +0530 Subject: [PATCH 179/410] Update README.md --- README.md | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 2158769d9..36fe7279a 100644 --- a/README.md +++ b/README.md @@ -9,21 +9,19 @@ A stable telegram bot to get restricted messages with custom thumbnail support , - supports text and webpage media messages - Faster speed - Forcesubscribe available +- `/batch` - (For owner only) Use this command to save upto 100 files from a pvt restricted channel at once.

- + # Variables - `API_ID` - - `API_HASH` - - `SESSION` - - `BOT TOKEN` - +- `AUTH` - Owner user id - `FORCESUB` - Public channel username without '@'. Don't forget to add bot in channel as administrator. Get API_ID & API_HASH from: From f6f136e51480d23f8f40bb2856313d68f4b93dbc Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Fri, 11 Feb 2022 22:16:11 +0530 Subject: [PATCH 180/410] Update README.md --- README.md | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 36fe7279a..d4dac0187 100644 --- a/README.md +++ b/README.md @@ -24,15 +24,13 @@ A stable telegram bot to get restricted messages with custom thumbnail support , - `AUTH` - Owner user id - `FORCESUB` - Public channel username without '@'. Don't forget to add bot in channel as administrator. -Get API_ID & API_HASH from: +# Get API & TELETHON string session from: -

+

-Get Telethon string session from: - -

+

[![Run on Repl.it](https://replit.com/badge/github/vasusen-code/saverestrictedcontentbot)](https://replit.com/@SpEcHiDe/GenerateStringSession) From b2ffc07f7f56d7ff134db29b645272c1d4d9dedf Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Fri, 11 Feb 2022 22:17:08 +0530 Subject: [PATCH 181/410] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index d4dac0187..185741f1b 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ A stable telegram bot to get restricted messages with custom thumbnail support ,

-

+

[![Run on Repl.it](https://replit.com/badge/github/vasusen-code/saverestrictedcontentbot)](https://replit.com/@SpEcHiDe/GenerateStringSession) @@ -50,4 +50,4 @@ Buildpacks for manual deploy: # Upcoming features: -- Save multiple content at once/Save in range +- Save multiple content at once/Save in range for public channels From eb81f51a2e9927543834f05efbcd7ca6d6b82744 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Fri, 11 Feb 2022 22:18:00 +0530 Subject: [PATCH 182/410] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 185741f1b..81f00c5a6 100644 --- a/README.md +++ b/README.md @@ -28,9 +28,9 @@ A stable telegram bot to get restricted messages with custom thumbnail support ,

-

+

-

+

[![Run on Repl.it](https://replit.com/badge/github/vasusen-code/saverestrictedcontentbot)](https://replit.com/@SpEcHiDe/GenerateStringSession) From ea0cc5e6b46819debd839e6ac527fc57e994980d Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Fri, 11 Feb 2022 22:18:26 +0530 Subject: [PATCH 183/410] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 81f00c5a6..b5bd51cb7 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ A stable telegram bot to get restricted messages with custom thumbnail support ,

-

+

From c303f43cdedfa5729e952dd6d45c67773714d3f6 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Fri, 11 Feb 2022 22:18:49 +0530 Subject: [PATCH 184/410] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b5bd51cb7..8679326fd 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ A stable telegram bot to get restricted messages with custom thumbnail support ,

-

+

From 314d41c4acffb1261fb959a07cf0ef2278431131 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Fri, 11 Feb 2022 22:19:22 +0530 Subject: [PATCH 185/410] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8679326fd..0ee8f1f18 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ A stable telegram bot to get restricted messages with custom thumbnail support ,

-

+

From b2ac30af2c96dde420ddd2f441c7706e207d3c3c Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Fri, 11 Feb 2022 22:20:54 +0530 Subject: [PATCH 186/410] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0ee8f1f18..c65d4a4ba 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ A stable telegram bot to get restricted messages with custom thumbnail support , # Get API & TELETHON string session from: -

+

From 94f98b0dc4941d15151427aecaa16f1765bf32f7 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Fri, 11 Feb 2022 22:25:53 +0530 Subject: [PATCH 187/410] Update README.md --- README.md | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index c65d4a4ba..1e16a4607 100644 --- a/README.md +++ b/README.md @@ -25,14 +25,12 @@ A stable telegram bot to get restricted messages with custom thumbnail support , - `FORCESUB` - Public channel username without '@'. Don't forget to add bot in channel as administrator. # Get API & TELETHON string session from: + +API: [API scrapper Bot](https://t.me/USETGSBOT) or [Telegram.org](https://my.telegram.org/auth) -

+TELETHON SESSION: [SessionGen Bot](https://t.me/SessionStringGeneratorZBot) or [![Run on Repl.it](https://replit.com/badge/github/vasusen-code/saverestrictedcontentbot)](https://replit.com/@SpEcHiDe/GenerateStringSession) -

- -

- -[![Run on Repl.it](https://replit.com/badge/github/vasusen-code/saverestrictedcontentbot)](https://replit.com/@SpEcHiDe/GenerateStringSession) +BOT TOKEN: @Botfather on telegram # Deploy From 6018594733d143db72090eb0aaa34216f3a07bc7 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Fri, 11 Feb 2022 22:27:56 +0530 Subject: [PATCH 188/410] Update README.md --- README.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 1e16a4607..037548e76 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,8 @@ Save restricted content Bot +Contact: [Telegram](https://t.me/MaheshChauhan) + A stable telegram bot to get restricted messages with custom thumbnail support , made by @MaheshChauhan. - works for both public and private channels @@ -11,10 +13,6 @@ A stable telegram bot to get restricted messages with custom thumbnail support , - Forcesubscribe available - `/batch` - (For owner only) Use this command to save upto 100 files from a pvt restricted channel at once. -

- -

- # Variables - `API_ID` From a0481d53ade0b117ca0874247681b69953076138 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sat, 12 Feb 2022 08:13:55 +0530 Subject: [PATCH 189/410] Update requirements.txt --- requirements.txt | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/requirements.txt b/requirements.txt index 1dac6f5fa..65851a842 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,13 +1,9 @@ #Github.com-Vasusen-code -https://github.com/New-dev0/Telethon/archive/Vector.zip #Until telethon update -markdown-it-py~=1.1.0 -pyaes~=1.6.1 -rsa~=4.7.2 +https://github.com/New-dev0/Telethon/archive/Artifact.zip #Until telethon update ethon==1.3.5 cryptg tgcrypto pyrogram python-decouple -telethon-tgcrypto From a9c252dafa9bbf56ce00bd8ed00fc8ae03aa20b9 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sat, 12 Feb 2022 08:28:07 +0530 Subject: [PATCH 190/410] Update requirements.txt --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 65851a842..754332172 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,7 +2,7 @@ https://github.com/New-dev0/Telethon/archive/Artifact.zip #Until telethon update -ethon==1.3.5 +ethon==1.3.6 cryptg tgcrypto pyrogram From b9adf37d8d66fc55ee1c59c73b15f046456df39f Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sat, 12 Feb 2022 08:28:33 +0530 Subject: [PATCH 191/410] Update requirements.txt --- requirements.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/requirements.txt b/requirements.txt index 754332172..8c1f37e0d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,8 +1,8 @@ #Github.com-Vasusen-code -https://github.com/New-dev0/Telethon/archive/Artifact.zip #Until telethon update +https://github.com/New-dev0/Telethon/archive/vector.zip #Until telethon update -ethon==1.3.6 +ethon==1.3.5 cryptg tgcrypto pyrogram From 0d08bd2ce2f5270972ded63825893afb2b66be10 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sat, 12 Feb 2022 08:28:49 +0530 Subject: [PATCH 192/410] Update requirements.txt --- requirements.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/requirements.txt b/requirements.txt index 8c1f37e0d..dbc7bd019 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,8 +1,8 @@ #Github.com-Vasusen-code -https://github.com/New-dev0/Telethon/archive/vector.zip #Until telethon update +https://github.com/New-dev0/Telethon/archive/artifact.zip #Until telethon update -ethon==1.3.5 +ethon==1.3.6 cryptg tgcrypto pyrogram From e7390a54142fcd2681993e077300f0289208dafc Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sat, 12 Feb 2022 08:31:09 +0530 Subject: [PATCH 193/410] Update requirements.txt --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index dbc7bd019..754332172 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,6 @@ #Github.com-Vasusen-code -https://github.com/New-dev0/Telethon/archive/artifact.zip #Until telethon update +https://github.com/New-dev0/Telethon/archive/Artifact.zip #Until telethon update ethon==1.3.6 cryptg From fc74f1ffaf82141081171c103552a8326f87166a Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sat, 12 Feb 2022 08:35:36 +0530 Subject: [PATCH 194/410] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 037548e76..4785dcd64 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +# Don't deploy upto next update(batch for pvt), stay connected to @MaheshChauhan on tg. +

Save restricted content Bot

From 4bcdde36b5d6ea254e0f375394b78d55accd6355 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sat, 12 Feb 2022 08:36:09 +0530 Subject: [PATCH 195/410] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 4785dcd64..795a02857 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Don't deploy upto next update(batch for pvt), stay connected to @MaheshChauhan on tg. +# Don't deploy upto next repo update(will take 1 day), stay connected to @MaheshChauhan on tg.

Save restricted content Bot From 2015675aa4835b98b37d768e6370ff0d5ee68ef6 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sat, 12 Feb 2022 08:41:26 +0530 Subject: [PATCH 196/410] Update requirements.txt --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 754332172..40ceb21b2 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,6 @@ #Github.com-Vasusen-code -https://github.com/New-dev0/Telethon/archive/Artifact.zip #Until telethon update +https://github.com/New-dev0/Telethon/archive/vector.zip #Until telethon update ethon==1.3.6 cryptg From 4f68aaa6cf9d1382188af442842dcd8fa8da0fef Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sat, 12 Feb 2022 08:42:05 +0530 Subject: [PATCH 197/410] Update README.md --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index 795a02857..037548e76 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,3 @@ -# Don't deploy upto next repo update(will take 1 day), stay connected to @MaheshChauhan on tg. -

Save restricted content Bot

From 2870ea3fbce8a1f021573e33ae2641e0a4d567f8 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sat, 12 Feb 2022 08:44:11 +0530 Subject: [PATCH 198/410] Update pyroplug.py --- main/plugins/pyroplug.py | 74 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) diff --git a/main/plugins/pyroplug.py b/main/plugins/pyroplug.py index e254cb161..09cbc25d8 100644 --- a/main/plugins/pyroplug.py +++ b/main/plugins/pyroplug.py @@ -23,3 +23,77 @@ async def _(bot, event): else: await event.edit(str(e)) +def thumbnail(sender): + if os.path.exists(f'{sender}.jpg'): + return f'{sender}.jpg' + else: + return None + +async def get_msg(userbot, client, sender, msg_link, edit): + chat = "" + msg_id = int(msg_link.split("/")[-1]) + if 't.me/c/' in msg_link: + chat = int('-100' + str(msg_link.split("/")[-2])) + try: + msg = await userbot.get_messages(chat, msg_id) + file = await userbot.download_media( + msg, + progress=progress_for_pyrogram, + progress_args=( + userbot, + "**DOWNLOADING:**\n", + edit, + time.time() + ) + ) + await edit.edit('Trying to Upload.') + caption = "" + if msg.text is not None: + caption = msg.text + if str(file).split(".")[-1] == 'mkv' or 'mp4' or 'webm': + if str(file).split(".")[-1] == 'webm' or 'mkv': + path = str(file).split(".")[0] + ".mp4" + os.rename(file, path) + file = str(file).split(".")[0] + ".mp4" + data = video_metadata(file) + duration = data["duration"] + thumb_path = await screenshot(file, duration/2, sender) + await client.send_video( + chat_id=sender, + video=file, + caption=caption, + supports_streaming=True, + duration=duration, + thumb=thumb_path, + progress=progress_for_pyrogram, + progress_args=( + client, + '**UPLOADING:**\n', + edit, + time.time() + ) + ) + else: + thumb_path=thumbnail(sender) + await client.send_document( + sender, + file, + caption=caption, + thumb=thumb_path, + progress=progress_for_pyrogram, + progress_args=( + client, + '**UPLOADING:**\n', + edit, + time.time() + ) + ) + await edit.delete() + except Exception as e: + await edit.edit(f'ERROR: {str(e)}') + return + else: + chat = msg_link.split("/")[-2] + await client.copy_message(int(sender), chat, msg_id) + await edit.delete() + From 21968ce5199c1b39955b06a00a3f09b299787a76 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sat, 12 Feb 2022 09:02:28 +0530 Subject: [PATCH 199/410] Update pyroplug.py --- main/plugins/pyroplug.py | 1 + 1 file changed, 1 insertion(+) diff --git a/main/plugins/pyroplug.py b/main/plugins/pyroplug.py index 09cbc25d8..dfca251e6 100644 --- a/main/plugins/pyroplug.py +++ b/main/plugins/pyroplug.py @@ -5,6 +5,7 @@ from .. import Bot from pyrogram import Client, filters +from ethon.pyfunc import video_metadata @Bot.on_message(filters.private & filters.outgoing) async def _(bot, event): From b0218df423908ce32adb1420188cbf1bd27a006b Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sat, 12 Feb 2022 09:14:39 +0530 Subject: [PATCH 200/410] Create progress.py --- main/plugins/progress.py | 88 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 main/plugins/progress.py diff --git a/main/plugins/progress.py b/main/plugins/progress.py new file mode 100644 index 000000000..d04bebd00 --- /dev/null +++ b/main/plugins/progress.py @@ -0,0 +1,88 @@ +import math +import os +import time +import json + +FINISHED_PROGRESS_STR = "█" +UN_FINISHED_PROGRESS_STR = "" +DOWNLOAD_LOCATION = "/app" + + +async def progress_for_pyrogram( + current, + total, + bot, + ud_type, + message, + start +): + now = time.time() + diff = now - start + if round(diff % 10.00) == 0 or current == total: + percentage = current * 100 / total + status = DOWNLOAD_LOCATION + "/status.json" + if os.path.exists(status): + with open(status, 'r+') as f: + statusMsg = json.load(f) + if not statusMsg["running"]: + bot.stop_transmission() + speed = current / diff + elapsed_time = round(diff) * 1000 + time_to_completion = round((total - current) / speed) * 1000 + estimated_total_time = elapsed_time + time_to_completion + + elapsed_time = TimeFormatter(milliseconds=elapsed_time) + estimated_total_time = TimeFormatter(milliseconds=estimated_total_time) + + progress = "**[{0}{1}]** `| {2}%`\n\n".format( + ''.join([FINISHED_PROGRESS_STR for i in range(math.floor(percentage / 10))]), + ''.join([UN_FINISHED_PROGRESS_STR for i in range(10 - math.floor(percentage / 10))]), + round(percentage, 2)) + + tmp = progress + "GROSSS: {0} of {1}\n\nSpeed: {2}/s\n\nETA: {3}\n".format( + humanbytes(current), + humanbytes(total), + humanbytes(speed), + estimated_total_time if estimated_total_time != '' else "0 s" + ) + try: + if not message.photo: + await message.edit_text( + text="{}\n {}".format( + ud_type, + tmp + ) + ) + else: + await message.edit_caption( + caption="{}\n {}".format( + ud_type, + tmp + ) + ) + except: + pass + + +def humanbytes(size): + if not size: + return "" + power = 2**10 + n = 0 + Dic_powerN = {0: ' ', 1: 'Ki', 2: 'Mi', 3: 'Gi', 4: 'Ti'} + while size > power: + size /= power + n += 1 + return str(round(size, 2)) + " " + Dic_powerN[n] + 'B' + + +def TimeFormatter(milliseconds: int) -> str: + seconds, milliseconds = divmod(int(milliseconds), 1000) + minutes, seconds = divmod(seconds, 60) + hours, minutes = divmod(minutes, 60) + days, hours = divmod(hours, 24) + tmp = ((str(days) + "d, ") if days else "") + \ + ((str(hours) + "h, ") if hours else "") + \ + ((str(minutes) + "m, ") if minutes else "") + \ + ((str(seconds) + "s, ") if seconds else "") + return tmp[:-2] From 5fbfd76f29b9f0298d183cfea4213038ad62f67c Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sat, 12 Feb 2022 09:16:58 +0530 Subject: [PATCH 201/410] Update pyroplug.py --- main/plugins/pyroplug.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/main/plugins/pyroplug.py b/main/plugins/pyroplug.py index dfca251e6..ad936a251 100644 --- a/main/plugins/pyroplug.py +++ b/main/plugins/pyroplug.py @@ -3,6 +3,7 @@ import asyncio from .. import Bot +from main.plugins.progress import progress_for_pyrogram from pyrogram import Client, filters from ethon.pyfunc import video_metadata @@ -49,8 +50,8 @@ async def get_msg(userbot, client, sender, msg_link, edit): ) await edit.edit('Trying to Upload.') caption = "" - if msg.text is not None: - caption = msg.text + if msg.caption is not None: + caption = msg.caption if str(file).split(".")[-1] == 'mkv' or 'mp4' or 'webm': if str(file).split(".")[-1] == 'webm' or 'mkv': path = str(file).split(".")[0] + ".mp4" From 70fb7326680893f31ade03a7047bf65f1ceeb029 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sat, 12 Feb 2022 09:24:16 +0530 Subject: [PATCH 202/410] Update main.py --- main/plugins/main.py | 86 +++----------------------------------------- 1 file changed, 4 insertions(+), 82 deletions(-) diff --git a/main/plugins/main.py b/main/plugins/main.py index 2ca07e479..957a307fd 100644 --- a/main/plugins/main.py +++ b/main/plugins/main.py @@ -3,7 +3,7 @@ import time, os from .. import bot as Drone -from .. import userbot +from .. import userbot, Bot from .. import FORCESUB as fs from telethon import events @@ -40,84 +40,6 @@ async def clone(event): x, y = await join(userbot, link) await edit.edit(y) return - if 't.me' in link: - if not 't.me/c/' in link: - chat = link.split("/")[-2] - msg_id = link.split("/")[-1] - await edit.edit(f'cloning {chat}-{msg_id}') - if 't.me/c/' in link: - try: - chat = int('-100' + str(link.split("/")[-2])) - msg_id = int(link.split("/")[-1]) - file = await userbot.get_messages(chat, ids=msg_id) - if not file: - await edit.edit("Couldn't get message!") - return - if file and file.text: - try: - if msg.text and not msg.media: - await event.client.send_message(event.chat_id, msg.text) - if msg.media.webpage: - await event.client.send_message(event.chat_id, msg.text) - except Exception: - pass - name = file.file.name - if not name: - if not file.file.mime_type: - await edit.edit("Couldn't fetch Name/Mime for the file.") - return - else: - if 'mp4' or 'x-matroska' in file.file.mime_type: - name = f'{chat}' + '-' + f'{msg_id}' + '.mp4' - await fast_download(name, file.document, userbot, edit, time.time(), '**DOWNLOADING:**') - await edit.edit("Preparing to upload.") - if 'mp4' in file.file.mime_type: - metadata = video_metadata(name) - height = metadata["height"] - width = metadata["width"] - duration = metadata["duration"] - attributes = [DocumentAttributeVideo(duration=duration, w=width, h=height, supports_streaming=True)] - thumb = await screenshot(name, duration/2, event.sender_id) - caption = name - if file.text: - caption=file.text - uploader = await fast_upload(name, name, time.time(), event.client, edit, '**UPLOADING:**') - await event.client.send_file(event.chat_id, uploader, caption=caption, thumb=thumb, attributes=attributes, force_document=False) - await edit.delete() - os.remove(name) - elif 'x-matroska' in file.file.mime_type: - metadata = video_metadata(name) - height = metadata["height"] - width = metadata["width"] - duration = metadata["duration"] - attributes = [DocumentAttributeVideo(duration=duration, w=width, h=height, supports_streaming=True)] - thumb = await screenshot(name, duration/2, event.sender_id) - caption = name - if file.text: - caption=file.text - uploader = await fast_upload(name, name, time.time(), event.client, edit, '**UPLOADING:**') - await event.client.send_file(event.chat_id, uploader, caption=caption, thumb=thumb, attributes=attributes, force_document=False) - await edit.delete() - os.remove(name) - else: - caption = name - if file.text: - caption=file.text - thumb=None - if os.path.exists(f'{event.sender_id}.jpg'): - thumb = f'{event.sender_id}.jpg' - uploader = await fast_upload(name, name, time.time(), event.client, edit, '**UPLOADING:**') - await event.client.send_file(event.chat_id, uploader, caption=caption, thumb=thumb, force_document=True) - await edit.delete() - os.remove(name) - except Exception as e: - print(e) - if 'Peer'in str(e): - await edit.edit("Channel not found, have you joined it?") - return - await edit.edit("Failed, try again!") - - - - - + if 't.me/' in link: + await get_msg(userbot, Bot, event.sender_id, link, edit) + From d78e4ffafffc3af7464950366d43c3fa14745a36 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sat, 12 Feb 2022 09:25:44 +0530 Subject: [PATCH 203/410] Update main.py --- main/plugins/main.py | 1 + 1 file changed, 1 insertion(+) diff --git a/main/plugins/main.py b/main/plugins/main.py index 957a307fd..957ca00b8 100644 --- a/main/plugins/main.py +++ b/main/plugins/main.py @@ -5,6 +5,7 @@ from .. import bot as Drone from .. import userbot, Bot from .. import FORCESUB as fs +from main.plugins.pyrogplug import get_msg from telethon import events from telethon.tl.types import DocumentAttributeVideo From 6aa67f4aaa5913837bdf3be9383794511bdc9a5e Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sat, 12 Feb 2022 09:28:47 +0530 Subject: [PATCH 204/410] Update __init__.py --- main/__init__.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/main/__init__.py b/main/__init__.py index ea284386b..5ca052a48 100644 --- a/main/__init__.py +++ b/main/__init__.py @@ -21,12 +21,15 @@ bot = TelegramClient('bot', API_ID, API_HASH).start(bot_token=BOT_TOKEN) -userbot = TelegramClient(StringSession(SESSION) , API_ID, API_HASH) +userbot = Client( + session_name=SESSION, + api_hash=API_HASH, + api_id=API_ID) try: userbot.start() except BaseException: - print("Userbot Error ! Have you added a STRING_SESSION in deploying??") + print("Userbot Error ! Have you added SESSION while deploying??") sys.exit(1) Bot = Client( From 77204c149f1eea5975b0c50af653ba58605df4d9 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sat, 12 Feb 2022 09:35:41 +0530 Subject: [PATCH 205/410] Update requirements.txt --- requirements.txt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/requirements.txt b/requirements.txt index 40ceb21b2..116c3de5e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,9 +1,8 @@ #Github.com-Vasusen-code -https://github.com/New-dev0/Telethon/archive/vector.zip #Until telethon update - ethon==1.3.6 cryptg tgcrypto +telethon pyrogram python-decouple From 995c499d9361ed71999e12078b02fc3e5ec104a4 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sat, 12 Feb 2022 09:39:20 +0530 Subject: [PATCH 206/410] Update main.py --- main/plugins/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/plugins/main.py b/main/plugins/main.py index 957ca00b8..e82fe78a5 100644 --- a/main/plugins/main.py +++ b/main/plugins/main.py @@ -5,7 +5,7 @@ from .. import bot as Drone from .. import userbot, Bot from .. import FORCESUB as fs -from main.plugins.pyrogplug import get_msg +from main.plugins.pyroplug import get_msg from telethon import events from telethon.tl.types import DocumentAttributeVideo From 2720f794c05260d3a64bff60d6fcc849c924fac3 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sat, 12 Feb 2022 09:44:18 +0530 Subject: [PATCH 207/410] Update pyroplug.py --- main/plugins/pyroplug.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/plugins/pyroplug.py b/main/plugins/pyroplug.py index ad936a251..67bd890b2 100644 --- a/main/plugins/pyroplug.py +++ b/main/plugins/pyroplug.py @@ -1,6 +1,6 @@ # Github.com/Vasusen-code -import asyncio +import asyncio, time from .. import Bot from main.plugins.progress import progress_for_pyrogram From dc7724c34e46219a3f44937415e79be2ef3fcebc Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sat, 12 Feb 2022 09:53:54 +0530 Subject: [PATCH 208/410] Update pyroplug.py --- main/plugins/pyroplug.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/plugins/pyroplug.py b/main/plugins/pyroplug.py index 67bd890b2..deab05788 100644 --- a/main/plugins/pyroplug.py +++ b/main/plugins/pyroplug.py @@ -1,6 +1,6 @@ # Github.com/Vasusen-code -import asyncio, time +import asyncio, time, os from .. import Bot from main.plugins.progress import progress_for_pyrogram From 692fda60d96ebb4d9fc78bd5b3949d56c062c200 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sat, 12 Feb 2022 10:00:04 +0530 Subject: [PATCH 209/410] Update pyroplug.py --- main/plugins/pyroplug.py | 1 + 1 file changed, 1 insertion(+) diff --git a/main/plugins/pyroplug.py b/main/plugins/pyroplug.py index deab05788..2b8be8a82 100644 --- a/main/plugins/pyroplug.py +++ b/main/plugins/pyroplug.py @@ -4,6 +4,7 @@ from .. import Bot from main.plugins.progress import progress_for_pyrogram +from main.plugins.helpers import screenshot from pyrogram import Client, filters from ethon.pyfunc import video_metadata From 282a36bb06415fc1dfce4282fc5a8e4ac9706fb8 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sat, 12 Feb 2022 10:06:44 +0530 Subject: [PATCH 210/410] Update main.py --- main/plugins/main.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/main/plugins/main.py b/main/plugins/main.py index e82fe78a5..887e5590f 100644 --- a/main/plugins/main.py +++ b/main/plugins/main.py @@ -36,11 +36,11 @@ async def clone(event): if s == True: await event.reply(r) return - edit = await event.reply('Trying to process.') if 't.me/+' in link: + reply = await event.reply("Processing!") x, y = await join(userbot, link) - await edit.edit(y) + await reply.edit(y) return if 't.me/' in link: - await get_msg(userbot, Bot, event.sender_id, link, edit) + await get_msg(userbot, Bot, event.sender_id, link) From 839782747e1d3a901f66686eaf3e0eb1da4ff628 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sat, 12 Feb 2022 10:19:58 +0530 Subject: [PATCH 211/410] Update pyroplug.py --- main/plugins/pyroplug.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/main/plugins/pyroplug.py b/main/plugins/pyroplug.py index 2b8be8a82..63bfdd6fa 100644 --- a/main/plugins/pyroplug.py +++ b/main/plugins/pyroplug.py @@ -32,7 +32,8 @@ def thumbnail(sender): else: return None -async def get_msg(userbot, client, sender, msg_link, edit): +async def get_msg(userbot, client, sender, msg_link): + edit = await client.send_message(sender, "Trying to Download.") chat = "" msg_id = int(msg_link.split("/")[-1]) if 't.me/c/' in msg_link: @@ -49,7 +50,7 @@ async def get_msg(userbot, client, sender, msg_link, edit): time.time() ) ) - await edit.edit('Trying to Upload.') + await edit.edit('Prearing to Upload!') caption = "" if msg.caption is not None: caption = msg.caption From ccf9f3414f7356a69aaa863ffe8a84414e0ee5c7 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sat, 12 Feb 2022 10:22:05 +0530 Subject: [PATCH 212/410] Update pyroplug.py --- main/plugins/pyroplug.py | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/main/plugins/pyroplug.py b/main/plugins/pyroplug.py index 63bfdd6fa..d393aab2a 100644 --- a/main/plugins/pyroplug.py +++ b/main/plugins/pyroplug.py @@ -9,23 +9,6 @@ from pyrogram import Client, filters from ethon.pyfunc import video_metadata -@Bot.on_message(filters.private & filters.outgoing) -async def _(bot, event): - if (str(event.text)).lower().startswith("cloning"): - c = (event.text).split(" ")[1] - try: - chat = c.split("-")[0] - msg_id = int(c.split("-")[1]) - await Bot.copy_message(event.chat.id, chat, msg_id) - await event.delete() - except ValueError: - await event.edit("Send me only message link or Invite of private channel.") - except Exception as e: - if 'username' in str(e): - await event.edit("Couldn't clone message, maybe i am banned from the given chat.") - else: - await event.edit(str(e)) - def thumbnail(sender): if os.path.exists(f'{sender}.jpg'): return f'{sender}.jpg' From 00750ed871e8c441f0e580f8ea3231559363d554 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sat, 12 Feb 2022 10:26:46 +0530 Subject: [PATCH 213/410] Update batch.py --- main/plugins/batch.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/main/plugins/batch.py b/main/plugins/batch.py index d380e71c2..c1e53cb43 100644 --- a/main/plugins/batch.py +++ b/main/plugins/batch.py @@ -8,7 +8,7 @@ import time, os from .. import bot as Drone -from .. import userbot, AUTH +from .. import userbot, Bot, AUTH from .. import FORCESUB as fs from telethon import events, Button, errors @@ -69,13 +69,18 @@ async def _batch(event): except ValueError: return await conv.send_message("Range must be an integer!") try: - await userbot.get_messages(chat, ids=id) + await userbot.get_messages(chat, int(id)) except Exception as e: print(e) return await conv.send_message("Have you joined the channel?") + try: + await Bot.get_messages(chat, int(id)) + except Exception as e: + print(e) + return await conv.send_message("Maybe i am banned from this chat!") try: batch.append(f'{event.sender_id}') - await private_batch(event, chat, id, value) + # await get_msg(userbot, Bot, id, value) conv.cancel() batch.pop(0) except Exception as e: From 332bd8afa3a9524a4a641443130b8370ba140eb8 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sat, 12 Feb 2022 15:09:45 +0530 Subject: [PATCH 214/410] Update pyroplug.py --- main/plugins/pyroplug.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/main/plugins/pyroplug.py b/main/plugins/pyroplug.py index d393aab2a..6c4af4d2c 100644 --- a/main/plugins/pyroplug.py +++ b/main/plugins/pyroplug.py @@ -15,11 +15,11 @@ def thumbnail(sender): else: return None -async def get_msg(userbot, client, sender, msg_link): - edit = await client.send_message(sender, "Trying to Download.") +async def get_msg(userbot, client, sender, edit_id, msg_link): chat = "" msg_id = int(msg_link.split("/")[-1]) if 't.me/c/' in msg_link: + edit = await client.edit_message_text(sender, edit_id, "Trying to Download.") chat = int('-100' + str(msg_link.split("/")[-2])) try: msg = await userbot.get_messages(chat, msg_id) @@ -80,6 +80,7 @@ async def get_msg(userbot, client, sender, msg_link): await edit.edit(f'ERROR: {str(e)}') return else: + edit = await client.edit_message_text(sender, "Cloning.") chat = msg_link.split("/")[-2] await client.copy_message(int(sender), chat, msg_id) await edit.delete() From 863ca55dcef408f932a8c2771ebc88f5173d59d1 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sat, 12 Feb 2022 15:10:50 +0530 Subject: [PATCH 215/410] Update main.py --- main/plugins/main.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/main/plugins/main.py b/main/plugins/main.py index 887e5590f..2f8f5d860 100644 --- a/main/plugins/main.py +++ b/main/plugins/main.py @@ -36,11 +36,11 @@ async def clone(event): if s == True: await event.reply(r) return + edit = await event.reply("Processing!") if 't.me/+' in link: - reply = await event.reply("Processing!") x, y = await join(userbot, link) - await reply.edit(y) + await edit.edit(y) return if 't.me/' in link: - await get_msg(userbot, Bot, event.sender_id, link) + await get_msg(userbot, Bot, event.sender_id, edit.id, link) From b497262ec93227ed12cd39079df8f6bd1042a4e7 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sat, 12 Feb 2022 15:30:20 +0530 Subject: [PATCH 216/410] Update pyroplug.py --- main/plugins/pyroplug.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/plugins/pyroplug.py b/main/plugins/pyroplug.py index 6c4af4d2c..16b4ccae6 100644 --- a/main/plugins/pyroplug.py +++ b/main/plugins/pyroplug.py @@ -27,7 +27,7 @@ async def get_msg(userbot, client, sender, edit_id, msg_link): msg, progress=progress_for_pyrogram, progress_args=( - userbot, + client, "**DOWNLOADING:**\n", edit, time.time() From 1abf00b34de4b8191f8edef55507f41f7dbac8d2 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sat, 12 Feb 2022 21:02:49 +0530 Subject: [PATCH 217/410] Update pyroplug.py --- main/plugins/pyroplug.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/main/plugins/pyroplug.py b/main/plugins/pyroplug.py index 16b4ccae6..7e32ba549 100644 --- a/main/plugins/pyroplug.py +++ b/main/plugins/pyroplug.py @@ -19,10 +19,21 @@ async def get_msg(userbot, client, sender, edit_id, msg_link): chat = "" msg_id = int(msg_link.split("/")[-1]) if 't.me/c/' in msg_link: - edit = await client.edit_message_text(sender, edit_id, "Trying to Download.") + edit = await client.edit_message_text(sender, edit_id, "Processing!") chat = int('-100' + str(msg_link.split("/")[-2])) try: msg = await userbot.get_messages(chat, msg_id) + if msg.media: + if 'web_page' in msg.media: + await client.send_message(sender, msg.text.markdown) + await edit.delete() + return + if not msg.media: + if msg.text: + await client.send_message(sender, msg.text.markdown) + await edit.delete() + return + await edit.edit("Trying to Download.") file = await userbot.download_media( msg, progress=progress_for_pyrogram, From 6b6d6f299a376c1ba4b4123f418e1f0903e3c2a3 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sat, 12 Feb 2022 21:11:22 +0530 Subject: [PATCH 218/410] Update pyroplug.py --- main/plugins/pyroplug.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/main/plugins/pyroplug.py b/main/plugins/pyroplug.py index 7e32ba549..8d4fd8a6e 100644 --- a/main/plugins/pyroplug.py +++ b/main/plugins/pyroplug.py @@ -19,7 +19,6 @@ async def get_msg(userbot, client, sender, edit_id, msg_link): chat = "" msg_id = int(msg_link.split("/")[-1]) if 't.me/c/' in msg_link: - edit = await client.edit_message_text(sender, edit_id, "Processing!") chat = int('-100' + str(msg_link.split("/")[-2])) try: msg = await userbot.get_messages(chat, msg_id) @@ -33,7 +32,7 @@ async def get_msg(userbot, client, sender, edit_id, msg_link): await client.send_message(sender, msg.text.markdown) await edit.delete() return - await edit.edit("Trying to Download.") + edit = await client.edit_message_text(sender, edit_id, "Trying to Download.") file = await userbot.download_media( msg, progress=progress_for_pyrogram, From e4484e1b3f961fa04535cdcb13ae98e43d1af8cc Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sat, 12 Feb 2022 21:25:40 +0530 Subject: [PATCH 219/410] Update pyroplug.py --- main/plugins/pyroplug.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/main/plugins/pyroplug.py b/main/plugins/pyroplug.py index 8d4fd8a6e..8a0353a93 100644 --- a/main/plugins/pyroplug.py +++ b/main/plugins/pyroplug.py @@ -16,6 +16,7 @@ def thumbnail(sender): return None async def get_msg(userbot, client, sender, edit_id, msg_link): + edit = "" chat = "" msg_id = int(msg_link.split("/")[-1]) if 't.me/c/' in msg_link: @@ -25,12 +26,12 @@ async def get_msg(userbot, client, sender, edit_id, msg_link): if msg.media: if 'web_page' in msg.media: await client.send_message(sender, msg.text.markdown) - await edit.delete() + await edit.delete(sender, edit_id) return if not msg.media: if msg.text: await client.send_message(sender, msg.text.markdown) - await edit.delete() + await edit.delete(sender, edit_id) return edit = await client.edit_message_text(sender, edit_id, "Trying to Download.") file = await userbot.download_media( @@ -87,7 +88,10 @@ async def get_msg(userbot, client, sender, edit_id, msg_link): ) await edit.delete() except Exception as e: - await edit.edit(f'ERROR: {str(e)}') + if 'CHANNEL' in str(e).split("_") and 'INVALID' in str(e).split("_"): + await client.edit_message_text(sender, edit_id, "Have you joined the channel?") + return + await client.edit_message_text(sender, edit_id, f'ERROR: {str(e)}') return else: edit = await client.edit_message_text(sender, "Cloning.") From 416627feb14b89e09fd0f8b21bbbcb858319a9e4 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sat, 12 Feb 2022 21:31:44 +0530 Subject: [PATCH 220/410] Update pyroplug.py --- main/plugins/pyroplug.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main/plugins/pyroplug.py b/main/plugins/pyroplug.py index 8a0353a93..814a6e9d9 100644 --- a/main/plugins/pyroplug.py +++ b/main/plugins/pyroplug.py @@ -26,12 +26,12 @@ async def get_msg(userbot, client, sender, edit_id, msg_link): if msg.media: if 'web_page' in msg.media: await client.send_message(sender, msg.text.markdown) - await edit.delete(sender, edit_id) + await client.delete(sender, edit_id) return if not msg.media: if msg.text: await client.send_message(sender, msg.text.markdown) - await edit.delete(sender, edit_id) + await client.delete(sender, edit_id) return edit = await client.edit_message_text(sender, edit_id, "Trying to Download.") file = await userbot.download_media( From 891be77a414ce2dd3cd4ba016d4259b685f19dd2 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sat, 12 Feb 2022 21:37:39 +0530 Subject: [PATCH 221/410] Update pyroplug.py --- main/plugins/pyroplug.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/main/plugins/pyroplug.py b/main/plugins/pyroplug.py index 814a6e9d9..513da62ac 100644 --- a/main/plugins/pyroplug.py +++ b/main/plugins/pyroplug.py @@ -25,13 +25,15 @@ async def get_msg(userbot, client, sender, edit_id, msg_link): msg = await userbot.get_messages(chat, msg_id) if msg.media: if 'web_page' in msg.media: + edit = await client.edit_message_text(sender, edit_id, "Cloning.") await client.send_message(sender, msg.text.markdown) - await client.delete(sender, edit_id) + await edit.delete() return if not msg.media: if msg.text: + edit = await client.edit_message_text(sender, edit_id, "Cloning.") await client.send_message(sender, msg.text.markdown) - await client.delete(sender, edit_id) + await edit.delete() return edit = await client.edit_message_text(sender, edit_id, "Trying to Download.") file = await userbot.download_media( @@ -45,7 +47,7 @@ async def get_msg(userbot, client, sender, edit_id, msg_link): ) ) await edit.edit('Prearing to Upload!') - caption = "" + caption = str(file) if msg.caption is not None: caption = msg.caption if str(file).split(".")[-1] == 'mkv' or 'mp4' or 'webm': @@ -94,7 +96,7 @@ async def get_msg(userbot, client, sender, edit_id, msg_link): await client.edit_message_text(sender, edit_id, f'ERROR: {str(e)}') return else: - edit = await client.edit_message_text(sender, "Cloning.") + edit = await client.edit_message_text(sender, edit_id, "Cloning.") chat = msg_link.split("/")[-2] await client.copy_message(int(sender), chat, msg_id) await edit.delete() From ebf075b37f106ebd2a7fd036d22698d7740d0eef Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sun, 13 Feb 2022 01:59:25 +0530 Subject: [PATCH 222/410] Update pyroplug.py --- main/plugins/pyroplug.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/main/plugins/pyroplug.py b/main/plugins/pyroplug.py index 513da62ac..a6e6829fe 100644 --- a/main/plugins/pyroplug.py +++ b/main/plugins/pyroplug.py @@ -98,6 +98,9 @@ async def get_msg(userbot, client, sender, edit_id, msg_link): else: edit = await client.edit_message_text(sender, edit_id, "Cloning.") chat = msg_link.split("/")[-2] - await client.copy_message(int(sender), chat, msg_id) + try: + await client.copy_message(int(sender), chat, msg_id) + except Exception as e: + print(e) await edit.delete() From 9e81b7805c00476e75759f2092cf156e6a8daf47 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sun, 13 Feb 2022 02:15:19 +0530 Subject: [PATCH 223/410] Update pyroplug.py --- main/plugins/pyroplug.py | 87 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) diff --git a/main/plugins/pyroplug.py b/main/plugins/pyroplug.py index a6e6829fe..d2fa65535 100644 --- a/main/plugins/pyroplug.py +++ b/main/plugins/pyroplug.py @@ -104,3 +104,90 @@ async def get_msg(userbot, client, sender, edit_id, msg_link): print(e) await edit.delete() +async def get_msg(userbot, client, sender, msg_link, _range): + edit = await client.send_message(sender, 'Processing!') + edit_id = edit.message_id + chat = "" + msg_id = int(msg_link.split("/")[-1] + _range) + if 't.me/c/' in msg_link: + chat = int('-100' + str(msg_link.split("/")[-2])) + try: + msg = await userbot.get_messages(chat, msg_id) + if msg.media: + if 'web_page' in msg.media: + edit = await client.edit_message_text(sender, edit_id, "Cloning.") + await client.send_message(sender, msg.text.markdown) + await edit.delete() + return + if not msg.media: + if msg.text: + edit = await client.edit_message_text(sender, edit_id, "Cloning.") + await client.send_message(sender, msg.text.markdown) + await edit.delete() + return + edit = await client.edit_message_text(sender, edit_id, "Trying to Download.") + file = await userbot.download_media( + msg, + progress=progress_for_pyrogram, + progress_args=( + client, + "**DOWNLOADING:**\n", + edit, + time.time() + ) + ) + await edit.edit('Prearing to Upload!') + caption = str(file) + if msg.caption is not None: + caption = msg.caption + if str(file).split(".")[-1] == 'mkv' or 'mp4' or 'webm': + if str(file).split(".")[-1] == 'webm' or 'mkv': + path = str(file).split(".")[0] + ".mp4" + os.rename(file, path) + file = str(file).split(".")[0] + ".mp4" + data = video_metadata(file) + duration = data["duration"] + thumb_path = await screenshot(file, duration/2, sender) + await client.send_video( + chat_id=sender, + video=file, + caption=caption, + supports_streaming=True, + duration=duration, + thumb=thumb_path, + progress=progress_for_pyrogram, + progress_args=( + client, + '**UPLOADING:**\n', + edit, + time.time() + ) + ) + else: + thumb_path=thumbnail(sender) + await client.send_document( + sender, + file, + caption=caption, + thumb=thumb_path, + progress=progress_for_pyrogram, + progress_args=( + client, + '**UPLOADING:**\n', + edit, + time.time() + ) + ) + await edit.delete() + except Exception: + await client.send_message(sender, f"Couldn't get this message: `t.me/c/{Chat}/{msg_id}`") + return + else: + edit = await client.edit_message_text(sender, edit_id, "Cloning.") + chat = msg_link.split("/")[-2] + try: + await client.copy_message(int(sender), chat, msg_id) + except Exception: + return await client.send_message(sender, f"Couldn't get this message: `t.me/{Chat}/{msg_id}`") + await edit.delete() + From e4982a1cd8d6c9c146009c7f85850ba58e102669 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sun, 13 Feb 2022 02:15:50 +0530 Subject: [PATCH 224/410] Update pyroplug.py --- main/plugins/pyroplug.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/plugins/pyroplug.py b/main/plugins/pyroplug.py index d2fa65535..4fdedaa1f 100644 --- a/main/plugins/pyroplug.py +++ b/main/plugins/pyroplug.py @@ -104,7 +104,7 @@ async def get_msg(userbot, client, sender, edit_id, msg_link): print(e) await edit.delete() -async def get_msg(userbot, client, sender, msg_link, _range): +async def get_bulk_msg(userbot, client, sender, msg_link, _range): edit = await client.send_message(sender, 'Processing!') edit_id = edit.message_id chat = "" From aaae747d4760c62e9e8ffbd7fd9053dc1037db11 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sun, 13 Feb 2022 02:25:06 +0530 Subject: [PATCH 225/410] Update pyroplug.py --- main/plugins/pyroplug.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/main/plugins/pyroplug.py b/main/plugins/pyroplug.py index 4fdedaa1f..aff0cd0b7 100644 --- a/main/plugins/pyroplug.py +++ b/main/plugins/pyroplug.py @@ -15,6 +15,23 @@ def thumbnail(sender): else: return None +async def check(userbot, client, link): + msg_id = int(msg_link.split("/")[-1]) + if 't.me/c/' in link: + try: + chat = int('-100' + str(link.split("/")[-2])) + await userbot.get_messages(chat, msg_id) + except ValueError: + return False, "**Invalid Link!**" + except Exception: + return False, "Have you joined the channel?" + else: + try: + chat = str(link.split("/")[-2]) + await client.get_messages(chat, msg_id) + except Exception: + return False, "Maybe bot is banned from the chat, or your link is invalid!" + async def get_msg(userbot, client, sender, edit_id, msg_link): edit = "" chat = "" From 12df2fd6c73b12a2e14f7ddc26dd3af9d69c4eb3 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sun, 13 Feb 2022 02:34:26 +0530 Subject: [PATCH 226/410] Update batch.py --- main/plugins/batch.py | 51 +++++++++++++------------------------------ 1 file changed, 15 insertions(+), 36 deletions(-) diff --git a/main/plugins/batch.py b/main/plugins/batch.py index c1e53cb43..081ae9276 100644 --- a/main/plugins/batch.py +++ b/main/plugins/batch.py @@ -44,18 +44,13 @@ async def _batch(event): await conv.send_message("Send me the message link you want to start saving from, as a reply to this message.", buttons=Button.force_reply()) try: link = await conv.get_reply() + try: + _link = get_link(link.text) + except Exception: + await conv.send_message("No link found.") except Exception as e: print(e) return await conv.send_message("Cannot wait more longer for your response!") - if not 't.me/c/' in link.text: - return await conv.send_message("Batch supported only for private restricted channels only!") - try: - _link = get_link(link.text) - chat = int('-100' + (str(_link)).split("/")[-2]) - id = int((str(_link)).split("/")[-1]) - except Exception as e: - print(e) - return await conv.send_message("**Invalid link!**") await conv.send_message("Send me the number of files/range you want to save from the given message, as a reply to this message.", buttons=Button.force_reply()) try: _range = await conv.get_reply() @@ -68,25 +63,15 @@ async def _batch(event): return await conv.send_message("You can only get upto 100 files in a single batch.") except ValueError: return await conv.send_message("Range must be an integer!") - try: - await userbot.get_messages(chat, int(id)) - except Exception as e: - print(e) - return await conv.send_message("Have you joined the channel?") - try: - await Bot.get_messages(chat, int(id)) - except Exception as e: - print(e) - return await conv.send_message("Maybe i am banned from this chat!") - try: - batch.append(f'{event.sender_id}') - # await get_msg(userbot, Bot, id, value) - conv.cancel() - batch.pop(0) - except Exception as e: - print(e) - batch.pop(0) - pass + s, r = await check(userbot, client, _link) + if s != True: + await conv.send_message(r) + return + batch.append(f'{event.sender_id}') + await run_batch( + conv.cancel() + batch.pop(0) + async def private_batch(event, chat, offset, _range): for i in range(_range): @@ -98,16 +83,10 @@ async def private_batch(event, chat, offset, _range): if i < 100 and i > 50: timer = 15 try: - try: - await get_pvt_content(event, chat, int(offset + i)) - except Exception: - await get_res_content(event, chat, int(offset + i)) + await get_bulk_msg(userbot, Bot, sender, link, i) except errors.FloodWaitError as fw: await asyncio.sleep(fw.seconds + 10) - try: - await get_pvt_content(event, chat, int(offset + i)) - except Exception: - await get_res_content(event, chat, int(offset + i)) + await get_bulk_msg(userbot, Bot, sender, link, i) protection = await event.client.send_message(event.chat_id, f"Sleeping for `{timer}` seconds to avoid Floodwaits and Protect account!") time.sleep(timer) await protection.delete() From 0f71dffcdbf9cf28596f78139bcc0a7b20514202 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sun, 13 Feb 2022 09:17:01 +0530 Subject: [PATCH 227/410] Update batch.py --- main/plugins/batch.py | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/main/plugins/batch.py b/main/plugins/batch.py index 081ae9276..50684651f 100644 --- a/main/plugins/batch.py +++ b/main/plugins/batch.py @@ -2,7 +2,7 @@ #Github.com/Vasusen-code """ -Plugin for private channels only! +Plugin for both public & private channels! """ import time, os @@ -14,6 +14,8 @@ from telethon import events, Button, errors from telethon.tl.types import DocumentAttributeVideo +from pyrogram.errors import FloodWait + from ethon.pyfunc import video_metadata from ethon.telefunc import fast_upload, fast_download, force_sub @@ -73,7 +75,7 @@ async def _batch(event): batch.pop(0) -async def private_batch(event, chat, offset, _range): +async def run_batch(userbot, client, sender, link): for i in range(_range): timer = 60 if i < 25: @@ -82,15 +84,22 @@ async def private_batch(event, chat, offset, _range): timer = 10 if i < 100 and i > 50: timer = 15 + if not 't.me/c/' in link: + if i < 25: + timer = 2 + else: + timer = 3 try: - await get_bulk_msg(userbot, Bot, sender, link, i) - except errors.FloodWaitError as fw: - await asyncio.sleep(fw.seconds + 10) - await get_bulk_msg(userbot, Bot, sender, link, i) + await get_bulk_msg(userbot, client, sender, link, i) + except FloodWait as fw: + await asyncio.sleep(fw.seconds + 5) + await get_bulk_msg(userbot, client, sender, link, i) protection = await event.client.send_message(event.chat_id, f"Sleeping for `{timer}` seconds to avoid Floodwaits and Protect account!") time.sleep(timer) await protection.delete() + +# This function is of no use, not cleaning incase may need it if again pyrogram >> Telethon! async def get_res_content(event, chat, id): msg = await userbot.get_messages(chat, ids=id) if msg is None: From 6cab966f4c1f3ae1200b03ce2963a8052dc0a58b Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sun, 13 Feb 2022 09:28:23 +0530 Subject: [PATCH 228/410] Update batch.py --- main/plugins/batch.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/plugins/batch.py b/main/plugins/batch.py index 50684651f..dfa983208 100644 --- a/main/plugins/batch.py +++ b/main/plugins/batch.py @@ -70,7 +70,7 @@ async def _batch(event): await conv.send_message(r) return batch.append(f'{event.sender_id}') - await run_batch( + await run_batch(userbot, Bot, event.sender_id, _link) conv.cancel() batch.pop(0) From 0be1fadeae243b3fbec1071dcdd607d06c42246d Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sun, 13 Feb 2022 09:45:34 +0530 Subject: [PATCH 229/410] Update batch.py --- main/plugins/batch.py | 1 + 1 file changed, 1 insertion(+) diff --git a/main/plugins/batch.py b/main/plugins/batch.py index dfa983208..a648a06ce 100644 --- a/main/plugins/batch.py +++ b/main/plugins/batch.py @@ -10,6 +10,7 @@ from .. import bot as Drone from .. import userbot, Bot, AUTH from .. import FORCESUB as fs +from main.plugins.pyroplug import check, get_bulk_msg from telethon import events, Button, errors from telethon.tl.types import DocumentAttributeVideo From b249d154d2efeab158e32bb3ee3d6c27ee78ac01 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sun, 13 Feb 2022 09:49:01 +0530 Subject: [PATCH 230/410] Update batch.py --- main/plugins/batch.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/plugins/batch.py b/main/plugins/batch.py index a648a06ce..8b3a6c339 100644 --- a/main/plugins/batch.py +++ b/main/plugins/batch.py @@ -66,7 +66,7 @@ async def _batch(event): return await conv.send_message("You can only get upto 100 files in a single batch.") except ValueError: return await conv.send_message("Range must be an integer!") - s, r = await check(userbot, client, _link) + s, r = await check(userbot, Bot, _link) if s != True: await conv.send_message(r) return From a8f58c57e9601789c04c8affc0dab1f1d310c314 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sun, 13 Feb 2022 09:49:46 +0530 Subject: [PATCH 231/410] Update batch.py --- main/plugins/batch.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/plugins/batch.py b/main/plugins/batch.py index 8b3a6c339..ad3813198 100644 --- a/main/plugins/batch.py +++ b/main/plugins/batch.py @@ -100,7 +100,7 @@ async def run_batch(userbot, client, sender, link): await protection.delete() -# This function is of no use, not cleaning incase may need it if again pyrogram >> Telethon! +# This function is not in use, not cleaning incase may need it if again pyrogram >> Telethon! async def get_res_content(event, chat, id): msg = await userbot.get_messages(chat, ids=id) if msg is None: From 9c4ff5e50189bb737c9f66d1d894042b251ca835 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sun, 13 Feb 2022 09:52:46 +0530 Subject: [PATCH 232/410] Update pyroplug.py --- main/plugins/pyroplug.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/plugins/pyroplug.py b/main/plugins/pyroplug.py index aff0cd0b7..94af68d69 100644 --- a/main/plugins/pyroplug.py +++ b/main/plugins/pyroplug.py @@ -16,7 +16,7 @@ def thumbnail(sender): return None async def check(userbot, client, link): - msg_id = int(msg_link.split("/")[-1]) + msg_id = int(link.split("/")[-1]) if 't.me/c/' in link: try: chat = int('-100' + str(link.split("/")[-2])) From ef23e08cab886867ff53c03a5bca151fe16eccc2 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sun, 13 Feb 2022 09:53:57 +0530 Subject: [PATCH 233/410] Update batch.py --- main/plugins/batch.py | 51 +------------------------------------------ 1 file changed, 1 insertion(+), 50 deletions(-) diff --git a/main/plugins/batch.py b/main/plugins/batch.py index ad3813198..f5b95383c 100644 --- a/main/plugins/batch.py +++ b/main/plugins/batch.py @@ -100,53 +100,4 @@ async def run_batch(userbot, client, sender, link): await protection.delete() -# This function is not in use, not cleaning incase may need it if again pyrogram >> Telethon! -async def get_res_content(event, chat, id): - msg = await userbot.get_messages(chat, ids=id) - if msg is None: - await event.client.send_message(event.chat_id, f"Couldn't get this message:\n\nchannel:` {chat}`\nid: `{id}`") - return - try: - if msg.text and not msg.media: - await event.client.send_message(event.chat_id, msg.text) - if msg.media.webpage: - await event.client.send_message(event.chat_id, msg.text) - except Exception: - pass - name = msg.file.name - if not name: - if not msg.file.mime_type: - await event.client.send_message(event.chat_id, f"Couldn't get this message:\n\nchannel:` {chat}`\nid: `{id}`") - return - else: - if 'mp4' or 'x-matroska' in msg.file.mime_type: - name = f'{chat}' + '-' + f'{id}' + '.mp4' - edit = await event.client.send_message(event.chat_id, "Preparing to Download!") - await fast_download(name, msg.document, userbot, edit, time.time(), '**DOWNLOADING:**') - await edit.edit("Preparing to upload.") - if 'mp4' in msg.file.mime_type or 'x-matroska' in msg.file.mime_type: - metadata = video_metadata(name) - height = metadata["height"] - width = metadata["width"] - duration = metadata["duration"] - attributes = [DocumentAttributeVideo(duration=duration, w=width, h=height, supports_streaming=True)] - thumb = await screenshot(name, duration/2, event.sender_id) - caption = name - if msg.text: - caption=msg.text - uploader = await fast_upload(name, name, time.time(), event.client, edit, '**UPLOADING:**') - await event.client.send_file(event.chat_id, uploader, caption=caption, thumb=thumb, attributes=attributes, force_document=False) - await edit.delete() - os.remove(name) - else: - caption = name - if msg.text: - caption=msg.text - thumb=None - if os.path.exists(f'{event.sender_id}.jpg'): - thumb = f'{event.sender_id}.jpg' - uploader = await fast_upload(name, name, time.time(), event.client, edit, '**UPLOADING:**') - await event.client.send_file(event.chat_id, uploader, caption=caption, thumb=thumb, force_document=True) - await edit.delete() - os.remove(name) - + From dbe428e080f9db17b1c49bcbd49851618b60f613 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sun, 13 Feb 2022 10:02:06 +0530 Subject: [PATCH 234/410] Update pyroplug.py --- main/plugins/pyroplug.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/main/plugins/pyroplug.py b/main/plugins/pyroplug.py index 94af68d69..b73dc3238 100644 --- a/main/plugins/pyroplug.py +++ b/main/plugins/pyroplug.py @@ -21,6 +21,7 @@ async def check(userbot, client, link): try: chat = int('-100' + str(link.split("/")[-2])) await userbot.get_messages(chat, msg_id) + return True, None except ValueError: return False, "**Invalid Link!**" except Exception: @@ -29,6 +30,7 @@ async def check(userbot, client, link): try: chat = str(link.split("/")[-2]) await client.get_messages(chat, msg_id) + return True, None except Exception: return False, "Maybe bot is banned from the chat, or your link is invalid!" From ef5a6458eb472e9a44c1b5e6ecbf7a5fc75c039a Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sun, 13 Feb 2022 10:27:45 +0530 Subject: [PATCH 235/410] Update batch.py --- main/plugins/batch.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main/plugins/batch.py b/main/plugins/batch.py index f5b95383c..cac0acfaa 100644 --- a/main/plugins/batch.py +++ b/main/plugins/batch.py @@ -71,12 +71,12 @@ async def _batch(event): await conv.send_message(r) return batch.append(f'{event.sender_id}') - await run_batch(userbot, Bot, event.sender_id, _link) + await run_batch(userbot, Bot, event.sender_id, _link, _range) conv.cancel() batch.pop(0) -async def run_batch(userbot, client, sender, link): +async def run_batch(userbot, client, sender, link, _range): for i in range(_range): timer = 60 if i < 25: From 6681f8c5dd97e189f0169b561ef8629660ecb143 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sun, 13 Feb 2022 10:50:11 +0530 Subject: [PATCH 236/410] Update batch.py --- main/plugins/batch.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/plugins/batch.py b/main/plugins/batch.py index cac0acfaa..6508177e1 100644 --- a/main/plugins/batch.py +++ b/main/plugins/batch.py @@ -71,7 +71,7 @@ async def _batch(event): await conv.send_message(r) return batch.append(f'{event.sender_id}') - await run_batch(userbot, Bot, event.sender_id, _link, _range) + await run_batch(userbot, Bot, event.sender_id, _link, value) conv.cancel() batch.pop(0) From 97e2ab0a02c7ddbbd19df26304817d29b71549ed Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sun, 13 Feb 2022 10:53:29 +0530 Subject: [PATCH 237/410] Update pyroplug.py --- main/plugins/pyroplug.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/plugins/pyroplug.py b/main/plugins/pyroplug.py index b73dc3238..7d7236acb 100644 --- a/main/plugins/pyroplug.py +++ b/main/plugins/pyroplug.py @@ -127,7 +127,7 @@ async def get_bulk_msg(userbot, client, sender, msg_link, _range): edit = await client.send_message(sender, 'Processing!') edit_id = edit.message_id chat = "" - msg_id = int(msg_link.split("/")[-1] + _range) + msg_id = int(msg_link.split("/")[-1] + str(_range)) if 't.me/c/' in msg_link: chat = int('-100' + str(msg_link.split("/")[-2])) try: From 2f43e9eb56cbc03d4739046d1ae1dfcfcfb96a3d Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sun, 13 Feb 2022 10:58:00 +0530 Subject: [PATCH 238/410] Update README.md --- README.md | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 037548e76..e7ea2d7dd 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,8 @@ A stable telegram bot to get restricted messages with custom thumbnail support , - supports text and webpage media messages - Faster speed - Forcesubscribe available -- `/batch` - (For owner only) Use this command to save upto 100 files from a pvt restricted channel at once. +- `/batch` - (For owner only) Use this command to save upto 100 files from a pvt or public restricted channel at once. +- Time delay is added to avoid FloodWait and keep user account safe. # Variables @@ -22,11 +23,11 @@ A stable telegram bot to get restricted messages with custom thumbnail support , - `AUTH` - Owner user id - `FORCESUB` - Public channel username without '@'. Don't forget to add bot in channel as administrator. -# Get API & TELETHON string session from: +# Get API & PYROGRAM string session from: API: [API scrapper Bot](https://t.me/USETGSBOT) or [Telegram.org](https://my.telegram.org/auth) -TELETHON SESSION: [SessionGen Bot](https://t.me/SessionStringGeneratorZBot) or [![Run on Repl.it](https://replit.com/badge/github/vasusen-code/saverestrictedcontentbot)](https://replit.com/@SpEcHiDe/GenerateStringSession) +PYROGRAM SESSION: [SessionGen Bot](https://t.me/SessionStringGeneratorZBot) or [![Run on Repl.it](https://replit.com/badge/github/vasusen-code/saverestrictedcontentbot)](https://replit.com/@SpEcHiDe/GenerateStringSession) BOT TOKEN: @Botfather on telegram @@ -43,7 +44,3 @@ Buildpacks for manual deploy: - `heroku/python` - `https://github.com/jonathanong/heroku-buildpack-ffmpeg-latest.git` - -# Upcoming features: - -- Save multiple content at once/Save in range for public channels From 4df98aa128d88ee2b43f30c34af5c01edb9ced59 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sun, 13 Feb 2022 11:02:06 +0530 Subject: [PATCH 239/410] Update pyroplug.py --- main/plugins/pyroplug.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/main/plugins/pyroplug.py b/main/plugins/pyroplug.py index 7d7236acb..ce3c2d785 100644 --- a/main/plugins/pyroplug.py +++ b/main/plugins/pyroplug.py @@ -198,15 +198,17 @@ async def get_bulk_msg(userbot, client, sender, msg_link, _range): ) ) await edit.delete() - except Exception: - await client.send_message(sender, f"Couldn't get this message: `t.me/c/{Chat}/{msg_id}`") + except Exception as e: + print(e) + await client.send_message(sender, f"Couldn't get this message: `t.me/c/{chat}/{msg_id}`") return else: edit = await client.edit_message_text(sender, edit_id, "Cloning.") chat = msg_link.split("/")[-2] try: await client.copy_message(int(sender), chat, msg_id) - except Exception: - return await client.send_message(sender, f"Couldn't get this message: `t.me/{Chat}/{msg_id}`") + except Exception as e: + print(e) + return await client.send_message(sender, f"Couldn't get this message: `t.me/{chat}/{msg_id}`") await edit.delete() From 81b7ffc57bd713b863a2f6bca442483beea5d8e5 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sun, 13 Feb 2022 11:15:45 +0530 Subject: [PATCH 240/410] Update pyroplug.py --- main/plugins/pyroplug.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/main/plugins/pyroplug.py b/main/plugins/pyroplug.py index ce3c2d785..9c60523b7 100644 --- a/main/plugins/pyroplug.py +++ b/main/plugins/pyroplug.py @@ -138,12 +138,11 @@ async def get_bulk_msg(userbot, client, sender, msg_link, _range): await client.send_message(sender, msg.text.markdown) await edit.delete() return - if not msg.media: - if msg.text: - edit = await client.edit_message_text(sender, edit_id, "Cloning.") - await client.send_message(sender, msg.text.markdown) - await edit.delete() - return + if msg.text: + edit = await client.edit_message_text(sender, edit_id, "Cloning.") + await client.send_message(sender, msg.text.markdown) + await edit.delete() + return edit = await client.edit_message_text(sender, edit_id, "Trying to Download.") file = await userbot.download_media( msg, From c14c6bb51263582a7a6d4cd08f7229c9aa7fd6e6 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sun, 13 Feb 2022 11:25:53 +0530 Subject: [PATCH 241/410] Update pyroplug.py --- main/plugins/pyroplug.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/main/plugins/pyroplug.py b/main/plugins/pyroplug.py index 9c60523b7..04eb0700e 100644 --- a/main/plugins/pyroplug.py +++ b/main/plugins/pyroplug.py @@ -138,11 +138,12 @@ async def get_bulk_msg(userbot, client, sender, msg_link, _range): await client.send_message(sender, msg.text.markdown) await edit.delete() return - if msg.text: - edit = await client.edit_message_text(sender, edit_id, "Cloning.") - await client.send_message(sender, msg.text.markdown) - await edit.delete() - return + if not msg.media: + if msg.text: + edit = await client.edit_message_text(sender, edit_id, "Cloning.") + await client.send_message(sender, msg.text.markdown) + await edit.delete() + return edit = await client.edit_message_text(sender, edit_id, "Trying to Download.") file = await userbot.download_media( msg, @@ -199,7 +200,7 @@ async def get_bulk_msg(userbot, client, sender, msg_link, _range): await edit.delete() except Exception as e: print(e) - await client.send_message(sender, f"Couldn't get this message: `t.me/c/{chat}/{msg_id}`") + await client.send_message(sender, f"Couldn't get this message: `t.me/c/{chat.spilt("-100")[1]}/{msg_id}`") return else: edit = await client.edit_message_text(sender, edit_id, "Cloning.") From b42528f5ab7bf59846b73465cc6897c1815cee06 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sun, 13 Feb 2022 11:46:03 +0530 Subject: [PATCH 242/410] Update pyroplug.py --- main/plugins/pyroplug.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/main/plugins/pyroplug.py b/main/plugins/pyroplug.py index 04eb0700e..9720821c4 100644 --- a/main/plugins/pyroplug.py +++ b/main/plugins/pyroplug.py @@ -129,6 +129,7 @@ async def get_bulk_msg(userbot, client, sender, msg_link, _range): chat = "" msg_id = int(msg_link.split("/")[-1] + str(_range)) if 't.me/c/' in msg_link: + _chat = int(msg_link.split("/")[-2]) chat = int('-100' + str(msg_link.split("/")[-2])) try: msg = await userbot.get_messages(chat, msg_id) @@ -200,7 +201,7 @@ async def get_bulk_msg(userbot, client, sender, msg_link, _range): await edit.delete() except Exception as e: print(e) - await client.send_message(sender, f"Couldn't get this message: `t.me/c/{chat.spilt("-100")[1]}/{msg_id}`") + await client.send_message(sender, f"Couldn't get this message: `t.me/c/{_chat}/{msg_id}`") return else: edit = await client.edit_message_text(sender, edit_id, "Cloning.") From 7d2815bf362880e351b71f93c4bac25dd43a82f5 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sun, 13 Feb 2022 11:51:23 +0530 Subject: [PATCH 243/410] Update batch.py --- main/plugins/batch.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/main/plugins/batch.py b/main/plugins/batch.py index 6508177e1..979e854a2 100644 --- a/main/plugins/batch.py +++ b/main/plugins/batch.py @@ -15,6 +15,7 @@ from telethon import events, Button, errors from telethon.tl.types import DocumentAttributeVideo +from pyrogram imporr Client from pyrogram.errors import FloodWait from ethon.pyfunc import video_metadata @@ -95,7 +96,7 @@ async def run_batch(userbot, client, sender, link, _range): except FloodWait as fw: await asyncio.sleep(fw.seconds + 5) await get_bulk_msg(userbot, client, sender, link, i) - protection = await event.client.send_message(event.chat_id, f"Sleeping for `{timer}` seconds to avoid Floodwaits and Protect account!") + protection = await client.send_message(sender, f"Sleeping for `{timer}` seconds to avoid Floodwaits and Protect account!") time.sleep(timer) await protection.delete() From 658127427fcf2067472988d1cb40016c55b64b43 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sun, 13 Feb 2022 11:56:10 +0530 Subject: [PATCH 244/410] Update batch.py --- main/plugins/batch.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/plugins/batch.py b/main/plugins/batch.py index 979e854a2..88dc97776 100644 --- a/main/plugins/batch.py +++ b/main/plugins/batch.py @@ -15,7 +15,7 @@ from telethon import events, Button, errors from telethon.tl.types import DocumentAttributeVideo -from pyrogram imporr Client +from pyrogram import Client from pyrogram.errors import FloodWait from ethon.pyfunc import video_metadata From 538af5979639b4ace7a292a60565756df14ca370 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sun, 13 Feb 2022 12:01:32 +0530 Subject: [PATCH 245/410] Update helpers.py --- main/plugins/helpers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/plugins/helpers.py b/main/plugins/helpers.py index 367cf03ec..d9c49df3c 100644 --- a/main/plugins/helpers.py +++ b/main/plugins/helpers.py @@ -17,7 +17,7 @@ async def join(client, invite_link): return False, "You have already joined the Channel." except errors.InviteHashExpiredError: return False, "Link Expired/Wrong URL." - except FloodWaitError: + except errors.FloodWaitError: return False, "Too many requests, try again later!" #Regex--------------------------------------------------------------------------------------------------------------- From aff887274a9196cfed6d68d8b7f787b42ad964ed Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sun, 13 Feb 2022 14:11:14 +0530 Subject: [PATCH 246/410] Update pyroplug.py --- main/plugins/pyroplug.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/main/plugins/pyroplug.py b/main/plugins/pyroplug.py index 9720821c4..60ea022ac 100644 --- a/main/plugins/pyroplug.py +++ b/main/plugins/pyroplug.py @@ -92,6 +92,19 @@ async def get_msg(userbot, client, sender, edit_id, msg_link): time.time() ) ) + elif str(file).split(".")[-1] == 'jpg' or 'jpeg' or 'png': + await client.send_photo( + sender, + file, + caption=caption, + progress=progress_for_pyrogram, + progress_args=( + client, + '**UPLOADING:**\n', + edit, + time.time() + ) + ) else: thumb_path=thumbnail(sender) await client.send_document( @@ -183,6 +196,19 @@ async def get_bulk_msg(userbot, client, sender, msg_link, _range): time.time() ) ) + elif str(file).split(".")[-1] == 'jpg' or 'jpeg' or 'png': + await client.send_photo( + sender, + file, + caption=caption, + progress=progress_for_pyrogram, + progress_args=( + client, + '**UPLOADING:**\n', + edit, + time.time() + ) + ) else: thumb_path=thumbnail(sender) await client.send_document( From 8ec2f1005760d2a94f41372b78af4266d0363175 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Mon, 14 Feb 2022 19:08:47 +0530 Subject: [PATCH 247/410] Update pyroplug.py --- main/plugins/pyroplug.py | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/main/plugins/pyroplug.py b/main/plugins/pyroplug.py index 60ea022ac..9edc745af 100644 --- a/main/plugins/pyroplug.py +++ b/main/plugins/pyroplug.py @@ -146,14 +146,14 @@ async def get_bulk_msg(userbot, client, sender, msg_link, _range): chat = int('-100' + str(msg_link.split("/")[-2])) try: msg = await userbot.get_messages(chat, msg_id) - if msg.media: - if 'web_page' in msg.media: + if not msg.media: + if msg.text: edit = await client.edit_message_text(sender, edit_id, "Cloning.") await client.send_message(sender, msg.text.markdown) await edit.delete() return - if not msg.media: - if msg.text: + if msg.media: + if 'web_page' in msg.media: edit = await client.edit_message_text(sender, edit_id, "Cloning.") await client.send_message(sender, msg.text.markdown) await edit.delete() @@ -173,11 +173,7 @@ async def get_bulk_msg(userbot, client, sender, msg_link, _range): caption = str(file) if msg.caption is not None: caption = msg.caption - if str(file).split(".")[-1] == 'mkv' or 'mp4' or 'webm': - if str(file).split(".")[-1] == 'webm' or 'mkv': - path = str(file).split(".")[0] + ".mp4" - os.rename(file, path) - file = str(file).split(".")[0] + ".mp4" + if str(file).split(".")[-1] == 'mkv' or 'mp4': data = video_metadata(file) duration = data["duration"] thumb_path = await screenshot(file, duration/2, sender) From 0eb61b210db0dd50e8f60bb33ec485faf881418a Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Mon, 14 Feb 2022 20:05:32 +0530 Subject: [PATCH 248/410] Update pyroplug.py --- main/plugins/pyroplug.py | 110 +++------------------------------------ 1 file changed, 8 insertions(+), 102 deletions(-) diff --git a/main/plugins/pyroplug.py b/main/plugins/pyroplug.py index 9edc745af..863ba037b 100644 --- a/main/plugins/pyroplug.py +++ b/main/plugins/pyroplug.py @@ -34,10 +34,10 @@ async def check(userbot, client, link): except Exception: return False, "Maybe bot is banned from the chat, or your link is invalid!" -async def get_msg(userbot, client, sender, edit_id, msg_link): +async def get_msg(userbot, client, sender, edit_id, msg_link, i): edit = "" chat = "" - msg_id = int(msg_link.split("/")[-1]) + msg_id = int(msg_link.split("/")[-1]) + int(i) if 't.me/c/' in msg_link: chat = int('-100' + str(msg_link.split("/")[-2])) try: @@ -122,108 +122,11 @@ async def get_msg(userbot, client, sender, edit_id, msg_link): ) await edit.delete() except Exception as e: + print(e) if 'CHANNEL' in str(e).split("_") and 'INVALID' in str(e).split("_"): await client.edit_message_text(sender, edit_id, "Have you joined the channel?") return - await client.edit_message_text(sender, edit_id, f'ERROR: {str(e)}') - return - else: - edit = await client.edit_message_text(sender, edit_id, "Cloning.") - chat = msg_link.split("/")[-2] - try: - await client.copy_message(int(sender), chat, msg_id) - except Exception as e: - print(e) - await edit.delete() - -async def get_bulk_msg(userbot, client, sender, msg_link, _range): - edit = await client.send_message(sender, 'Processing!') - edit_id = edit.message_id - chat = "" - msg_id = int(msg_link.split("/")[-1] + str(_range)) - if 't.me/c/' in msg_link: - _chat = int(msg_link.split("/")[-2]) - chat = int('-100' + str(msg_link.split("/")[-2])) - try: - msg = await userbot.get_messages(chat, msg_id) - if not msg.media: - if msg.text: - edit = await client.edit_message_text(sender, edit_id, "Cloning.") - await client.send_message(sender, msg.text.markdown) - await edit.delete() - return - if msg.media: - if 'web_page' in msg.media: - edit = await client.edit_message_text(sender, edit_id, "Cloning.") - await client.send_message(sender, msg.text.markdown) - await edit.delete() - return - edit = await client.edit_message_text(sender, edit_id, "Trying to Download.") - file = await userbot.download_media( - msg, - progress=progress_for_pyrogram, - progress_args=( - client, - "**DOWNLOADING:**\n", - edit, - time.time() - ) - ) - await edit.edit('Prearing to Upload!') - caption = str(file) - if msg.caption is not None: - caption = msg.caption - if str(file).split(".")[-1] == 'mkv' or 'mp4': - data = video_metadata(file) - duration = data["duration"] - thumb_path = await screenshot(file, duration/2, sender) - await client.send_video( - chat_id=sender, - video=file, - caption=caption, - supports_streaming=True, - duration=duration, - thumb=thumb_path, - progress=progress_for_pyrogram, - progress_args=( - client, - '**UPLOADING:**\n', - edit, - time.time() - ) - ) - elif str(file).split(".")[-1] == 'jpg' or 'jpeg' or 'png': - await client.send_photo( - sender, - file, - caption=caption, - progress=progress_for_pyrogram, - progress_args=( - client, - '**UPLOADING:**\n', - edit, - time.time() - ) - ) - else: - thumb_path=thumbnail(sender) - await client.send_document( - sender, - file, - caption=caption, - thumb=thumb_path, - progress=progress_for_pyrogram, - progress_args=( - client, - '**UPLOADING:**\n', - edit, - time.time() - ) - ) - await edit.delete() - except Exception as e: - print(e) - await client.send_message(sender, f"Couldn't get this message: `t.me/c/{_chat}/{msg_id}`") + await client.edit_message_text(sender, edit_id, f'Failed to save: `{msg_link}`') return else: edit = await client.edit_message_text(sender, edit_id, "Cloning.") @@ -232,6 +135,9 @@ async def get_bulk_msg(userbot, client, sender, msg_link, _range): await client.copy_message(int(sender), chat, msg_id) except Exception as e: print(e) - return await client.send_message(sender, f"Couldn't get this message: `t.me/{chat}/{msg_id}`") + return await client.edit_message_text(sender, edit_id, f'Failed to save: `{msg_link}`') await edit.delete() +async def get_bulk_msg(userbot, client, sender, edit_id, msg_link, i): + x = await client.send_message(sender, "Processing!") + await get_msg(userbot, client, sender, x.message_id, msg_link, i) From baaede597982cac41658b164d26888bddb2a2bde Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Mon, 14 Feb 2022 20:07:55 +0530 Subject: [PATCH 249/410] Update pyroplug.py --- main/plugins/pyroplug.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/plugins/pyroplug.py b/main/plugins/pyroplug.py index 863ba037b..9a2fc81df 100644 --- a/main/plugins/pyroplug.py +++ b/main/plugins/pyroplug.py @@ -138,6 +138,6 @@ async def get_msg(userbot, client, sender, edit_id, msg_link, i): return await client.edit_message_text(sender, edit_id, f'Failed to save: `{msg_link}`') await edit.delete() -async def get_bulk_msg(userbot, client, sender, edit_id, msg_link, i): +async def get_bulk_msg(userbot, client, sender, msg_link, i): x = await client.send_message(sender, "Processing!") await get_msg(userbot, client, sender, x.message_id, msg_link, i) From 79301ea8df206156ef7df83bd4c15dd096754a9b Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Mon, 14 Feb 2022 20:16:27 +0530 Subject: [PATCH 250/410] Update helpers.py --- main/plugins/helpers.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main/plugins/helpers.py b/main/plugins/helpers.py index d9c49df3c..8716cbb50 100644 --- a/main/plugins/helpers.py +++ b/main/plugins/helpers.py @@ -37,11 +37,11 @@ def get_link(string): #Screenshot--------------------------------------------------------------------------------------------------------------- -async def screenshot(video, time_stamp, sender): +async def screenshot(video, sender): if os.path.exists(f'{sender}.jpg'): return f'{sender}.jpg' out = str(video).split(".")[0] + ".jpg" - cmd = (f"ffmpeg -ss {time_stamp} -i {video} -vframes 1 {out} -y").split(" ") + cmd = (f"ffmpeg -ss 00:00:00 -i {video} -vframes 1 {out} -y").split(" ") process = await asyncio.create_subprocess_exec( *cmd, stdout=asyncio.subprocess.PIPE, From 65a0665035548ac51e287981174b114370e421d5 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Mon, 14 Feb 2022 20:17:29 +0530 Subject: [PATCH 251/410] Update pyroplug.py --- main/plugins/pyroplug.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/plugins/pyroplug.py b/main/plugins/pyroplug.py index 9a2fc81df..e5904b8b2 100644 --- a/main/plugins/pyroplug.py +++ b/main/plugins/pyroplug.py @@ -76,7 +76,7 @@ async def get_msg(userbot, client, sender, edit_id, msg_link, i): file = str(file).split(".")[0] + ".mp4" data = video_metadata(file) duration = data["duration"] - thumb_path = await screenshot(file, duration/2, sender) + thumb_path = await screenshot(file, sender) await client.send_video( chat_id=sender, video=file, From 013630024832794a495a1985be99ef82f8589ada Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Mon, 14 Feb 2022 20:24:51 +0530 Subject: [PATCH 252/410] Update helpers.py --- main/plugins/helpers.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/main/plugins/helpers.py b/main/plugins/helpers.py index 8716cbb50..02c3cb38c 100644 --- a/main/plugins/helpers.py +++ b/main/plugins/helpers.py @@ -1,6 +1,6 @@ #Github.com/Vasusen-code -from telethon.tl.functions.messages import ImportChatInviteRequest +from pyrogram.errors import FloodWait, BadRequest from telethon import errors, events import asyncio, subprocess, re, os, time @@ -10,15 +10,15 @@ async def join(client, invite_link): try: - hash_ = invite_link.split("+")[1] - await client(ImportChatInviteRequest(hash_)) - return True, "Successfully joined the Channel." - except errors.UserAlreadyParticipantError: - return False, "You have already joined the Channel." - except errors.InviteHashExpiredError: - return False, "Link Expired/Wrong URL." - except errors.FloodWaitError: - return False, "Too many requests, try again later!" + await client.join_chat(invite_link) + return "Successfully joined the Channel" + except BadRequest: + return "Could not join. Maybe your link is expired or Invalid." + except FloodWait: + return "Too many requests, try again later." + except Exception as e: + print(e) + return "Could not join, try joining manually." #Regex--------------------------------------------------------------------------------------------------------------- #to get the url from event From 0551764e29fc10e0598b15390f914e07596fcc49 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Mon, 14 Feb 2022 20:29:48 +0530 Subject: [PATCH 253/410] Update pyroplug.py --- main/plugins/pyroplug.py | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/main/plugins/pyroplug.py b/main/plugins/pyroplug.py index e5904b8b2..0f4b0be89 100644 --- a/main/plugins/pyroplug.py +++ b/main/plugins/pyroplug.py @@ -8,6 +8,7 @@ from pyrogram import Client, filters from ethon.pyfunc import video_metadata +from telethon import events def thumbnail(sender): if os.path.exists(f'{sender}.jpg'): @@ -92,19 +93,9 @@ async def get_msg(userbot, client, sender, edit_id, msg_link, i): time.time() ) ) - elif str(file).split(".")[-1] == 'jpg' or 'jpeg' or 'png': - await client.send_photo( - sender, - file, - caption=caption, - progress=progress_for_pyrogram, - progress_args=( - client, - '**UPLOADING:**\n', - edit, - time.time() - ) - ) + elif str(file).split(".")[-1] == 'jpg' or 'jpeg' or 'png' or 'webp': + await edit.edit("Uploading photo.") + await bot.send_file(sender, file, caption=caption) else: thumb_path=thumbnail(sender) await client.send_document( From 07ad2440ed873d6119be531b9ff72b6c2206cd97 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Mon, 14 Feb 2022 20:31:00 +0530 Subject: [PATCH 254/410] Update pyroplug.py --- main/plugins/pyroplug.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/plugins/pyroplug.py b/main/plugins/pyroplug.py index 0f4b0be89..d81a41003 100644 --- a/main/plugins/pyroplug.py +++ b/main/plugins/pyroplug.py @@ -2,7 +2,7 @@ import asyncio, time, os -from .. import Bot +from .. import Bot, bot from main.plugins.progress import progress_for_pyrogram from main.plugins.helpers import screenshot From 62cd63e15cef9251929ced5b4722a77f39bf5e05 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Mon, 14 Feb 2022 20:42:45 +0530 Subject: [PATCH 255/410] Update pyroplug.py --- main/plugins/pyroplug.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/main/plugins/pyroplug.py b/main/plugins/pyroplug.py index d81a41003..14410ed8a 100644 --- a/main/plugins/pyroplug.py +++ b/main/plugins/pyroplug.py @@ -70,8 +70,8 @@ async def get_msg(userbot, client, sender, edit_id, msg_link, i): caption = str(file) if msg.caption is not None: caption = msg.caption - if str(file).split(".")[-1] == 'mkv' or 'mp4' or 'webm': - if str(file).split(".")[-1] == 'webm' or 'mkv': + if str(file).split(".")[-1] in ['mkv', 'mp4', 'webm'] + if str(file).split(".")[-1] in ['webm', 'mkv'] path = str(file).split(".")[0] + ".mp4" os.rename(file, path) file = str(file).split(".")[0] + ".mp4" @@ -93,7 +93,7 @@ async def get_msg(userbot, client, sender, edit_id, msg_link, i): time.time() ) ) - elif str(file).split(".")[-1] == 'jpg' or 'jpeg' or 'png' or 'webp': + elif str(file).split(".")[-1] in ['jpg', 'jpeg', 'png', 'webp']: await edit.edit("Uploading photo.") await bot.send_file(sender, file, caption=caption) else: From 138e83dc507652aa65c4f3e7ad63ea1f62b3bc83 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Mon, 14 Feb 2022 20:43:41 +0530 Subject: [PATCH 256/410] Update main.py --- main/plugins/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/plugins/main.py b/main/plugins/main.py index 2f8f5d860..7977a51dc 100644 --- a/main/plugins/main.py +++ b/main/plugins/main.py @@ -42,5 +42,5 @@ async def clone(event): await edit.edit(y) return if 't.me/' in link: - await get_msg(userbot, Bot, event.sender_id, edit.id, link) + await get_msg(userbot, Bot, event.sender_id, edit.id, link, 0) From d4e22aa9d4411814b1b2ff3af85ad45fc41cda18 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Mon, 14 Feb 2022 20:47:05 +0530 Subject: [PATCH 257/410] Update pyroplug.py --- main/plugins/pyroplug.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main/plugins/pyroplug.py b/main/plugins/pyroplug.py index 14410ed8a..a231184d1 100644 --- a/main/plugins/pyroplug.py +++ b/main/plugins/pyroplug.py @@ -70,8 +70,8 @@ async def get_msg(userbot, client, sender, edit_id, msg_link, i): caption = str(file) if msg.caption is not None: caption = msg.caption - if str(file).split(".")[-1] in ['mkv', 'mp4', 'webm'] - if str(file).split(".")[-1] in ['webm', 'mkv'] + if str(file).split(".")[-1] in ['mkv', 'mp4', 'webm']: + if str(file).split(".")[-1] in ['webm', 'mkv']: path = str(file).split(".")[0] + ".mp4" os.rename(file, path) file = str(file).split(".")[0] + ".mp4" From 5328182841e20cfd2e12922b2e30fbbfb285939e Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Mon, 14 Feb 2022 21:15:56 +0530 Subject: [PATCH 258/410] Update main.py --- main/plugins/main.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/main/plugins/main.py b/main/plugins/main.py index 7977a51dc..3ce585e72 100644 --- a/main/plugins/main.py +++ b/main/plugins/main.py @@ -19,8 +19,7 @@ # To-Do: # Make these codes shorter and clean -# Add batch for Public messages -# replace pyroplug with telethon plugin for public channel +# ofc will never do it. @Drone.on(events.NewMessage(incoming=True, func=lambda e: e.is_private)) async def clone(event): From bf747c3f38f09fffb11ba928741594008681bbd5 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Mon, 14 Feb 2022 21:17:21 +0530 Subject: [PATCH 259/410] Cleaned --- main/plugins/batch.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/main/plugins/batch.py b/main/plugins/batch.py index 88dc97776..2cd425bef 100644 --- a/main/plugins/batch.py +++ b/main/plugins/batch.py @@ -11,6 +11,7 @@ from .. import userbot, Bot, AUTH from .. import FORCESUB as fs from main.plugins.pyroplug import check, get_bulk_msg +from main.plugins.helpers import get_link, screenshot from telethon import events, Button, errors from telethon.tl.types import DocumentAttributeVideo @@ -19,9 +20,6 @@ from pyrogram.errors import FloodWait from ethon.pyfunc import video_metadata -from ethon.telefunc import fast_upload, fast_download, force_sub - -from main.plugins.helpers import get_link, screenshot ft = f"To use this bot you've to join @{fs}." From 464152207c5d4c8585025cc9d6c77de490488019 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Tue, 15 Feb 2022 09:01:31 +0530 Subject: [PATCH 260/410] Delete app.json --- app.json | 44 -------------------------------------------- 1 file changed, 44 deletions(-) delete mode 100644 app.json diff --git a/app.json b/app.json deleted file mode 100644 index 8b2eba6fc..000000000 --- a/app.json +++ /dev/null @@ -1,44 +0,0 @@ -{ - "name": "Save Restricted", - "description": "Save restricted content", - "logo": "", - "keywords": [ - "Best", - "telegram", - "save restricted", - "bot" - ], - "repository": "https://github.com/vasusen-code/SaveRestrictedContentBot", - "website": "", - "success_url": "https://t.me/DroneBots", - "env": { - "API_HASH": { - "description": "Your API HASH from my.telegram.org", - "value": "" - }, - "API_ID": { - "description": "Your API ID from my.telegram.org", - "value": "" - }, - "BOT_TOKEN": { - "description": "Bot token, get it from @BotFather.", - "value": "" - }, - "SESSION": { - "description": "Telethon string session.", - "value": "" - }, - "FORCESUB": { - "description": "Public Channel username without using '@' to forcesub.", - "value": "" - } - }, - "buildpacks": [ - { - "url": "heroku/python" - }, - { - "url": "https://github.com/jonathanong/heroku-buildpack-ffmpeg-latest.git" - } - ] -} From 094483a4235b7ddc81c0db4667920f20f194a0b7 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Tue, 15 Feb 2022 16:25:31 +0530 Subject: [PATCH 261/410] Update batch.py --- main/plugins/batch.py | 1 + 1 file changed, 1 insertion(+) diff --git a/main/plugins/batch.py b/main/plugins/batch.py index 2cd425bef..b0deabc57 100644 --- a/main/plugins/batch.py +++ b/main/plugins/batch.py @@ -20,6 +20,7 @@ from pyrogram.errors import FloodWait from ethon.pyfunc import video_metadata +from ethon.telefunc import force_sub ft = f"To use this bot you've to join @{fs}." From 763865e2ce200786e58fb64ce16ce5c69c041d4d Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Tue, 15 Feb 2022 21:23:56 +0530 Subject: [PATCH 262/410] Update helpers.py --- main/plugins/helpers.py | 38 ++++++++++++++++++++++---------------- 1 file changed, 22 insertions(+), 16 deletions(-) diff --git a/main/plugins/helpers.py b/main/plugins/helpers.py index 02c3cb38c..0e4f62396 100644 --- a/main/plugins/helpers.py +++ b/main/plugins/helpers.py @@ -37,23 +37,29 @@ def get_link(string): #Screenshot--------------------------------------------------------------------------------------------------------------- -async def screenshot(video, sender): +def hhmmss(seconds): + x = time.strftime('%H:%M:%S',time.gmtime(seconds)) + return x + +async def screenshot(video, duration, sender): if os.path.exists(f'{sender}.jpg'): return f'{sender}.jpg' - out = str(video).split(".")[0] + ".jpg" - cmd = (f"ffmpeg -ss 00:00:00 -i {video} -vframes 1 {out} -y").split(" ") + time_stamp = hhmmss(int(duration)/2) + out = dt.now().isoformat("_", "seconds") + ".jpg" + cmd = ["ffmpeg", + "-ss", + f"{time_stamp}", + "-i", + f"{video}", + "-frames:v", + "1", + f"{out}", + "-y" + ] + print(cmd) process = await asyncio.create_subprocess_exec( - *cmd, - stdout=asyncio.subprocess.PIPE, - stderr=asyncio.subprocess.PIPE) - - stdout, stderr = await process.communicate() - x = stderr.decode().strip() - y = stdout.decode().strip() - print(x) - print(y) - if os.path.exists(str(Path(out))): - return out - else: - None + *cmd, + stdout=asyncio.subprocess.PIPE, + stderr=asyncio.subprocess.PIPE + ) From 6bae00079b390dc07b6f2abe510522b341f181c9 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Tue, 15 Feb 2022 21:24:51 +0530 Subject: [PATCH 263/410] Fixed screenshot issue --- main/plugins/pyroplug.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/plugins/pyroplug.py b/main/plugins/pyroplug.py index a231184d1..431ffd027 100644 --- a/main/plugins/pyroplug.py +++ b/main/plugins/pyroplug.py @@ -77,7 +77,7 @@ async def get_msg(userbot, client, sender, edit_id, msg_link, i): file = str(file).split(".")[0] + ".mp4" data = video_metadata(file) duration = data["duration"] - thumb_path = await screenshot(file, sender) + thumb_path = await screenshot(file, duration, sender) await client.send_video( chat_id=sender, video=file, From b47a77c60b4dd00dfac7492d20b58ca6afc0feb9 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Wed, 16 Feb 2022 09:10:16 +0530 Subject: [PATCH 264/410] Update main.py --- main/plugins/main.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main/plugins/main.py b/main/plugins/main.py index 3ce585e72..0143a33c8 100644 --- a/main/plugins/main.py +++ b/main/plugins/main.py @@ -37,8 +37,8 @@ async def clone(event): return edit = await event.reply("Processing!") if 't.me/+' in link: - x, y = await join(userbot, link) - await edit.edit(y) + Q = await join(userbot, link) + await edit.edit(Q) return if 't.me/' in link: await get_msg(userbot, Bot, event.sender_id, edit.id, link, 0) From 77e17d8c6a799b3a23eb8b1e27e65d3dda2a597f Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Wed, 16 Feb 2022 09:10:59 +0530 Subject: [PATCH 265/410] Fixed Join issue --- main/plugins/main.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main/plugins/main.py b/main/plugins/main.py index 0143a33c8..0dcce4fd9 100644 --- a/main/plugins/main.py +++ b/main/plugins/main.py @@ -37,8 +37,8 @@ async def clone(event): return edit = await event.reply("Processing!") if 't.me/+' in link: - Q = await join(userbot, link) - await edit.edit(Q) + q = await join(userbot, link) + await edit.edit(q) return if 't.me/' in link: await get_msg(userbot, Bot, event.sender_id, edit.id, link, 0) From 2164ce7e4a0038a2f399f60c72cab7ab5ab24871 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Wed, 16 Feb 2022 10:40:33 +0530 Subject: [PATCH 266/410] Update helpers.py --- main/plugins/helpers.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/main/plugins/helpers.py b/main/plugins/helpers.py index 0e4f62396..483f6c14e 100644 --- a/main/plugins/helpers.py +++ b/main/plugins/helpers.py @@ -1,6 +1,6 @@ #Github.com/Vasusen-code -from pyrogram.errors import FloodWait, BadRequest +from pyrogram.errors import FloodWait, InviteHashInvalid, InviteHashExpired, UserAlreadyParticipant from telethon import errors, events import asyncio, subprocess, re, os, time @@ -12,7 +12,9 @@ async def join(client, invite_link): try: await client.join_chat(invite_link) return "Successfully joined the Channel" - except BadRequest: + except UserAlreadyParticipant: + return "User is already a participant." + except (InviteHashInvalid, InviteHashExpired): return "Could not join. Maybe your link is expired or Invalid." except FloodWait: return "Too many requests, try again later." From 9e3e49b466ea6fbc00c02af6f2961a9277218756 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Wed, 16 Feb 2022 11:56:14 +0530 Subject: [PATCH 267/410] Defined dt --- main/plugins/helpers.py | 1 + 1 file changed, 1 insertion(+) diff --git a/main/plugins/helpers.py b/main/plugins/helpers.py index 483f6c14e..5ae8c4afa 100644 --- a/main/plugins/helpers.py +++ b/main/plugins/helpers.py @@ -5,6 +5,7 @@ import asyncio, subprocess, re, os, time from pathlib import Path +from datetime import datetime as dt #Join private chat------------------------------------------------------------------------------------------------------------- From ca0f42f90c414503ad3209f0bed94b056d53c2ea Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sat, 19 Feb 2022 18:03:26 +0530 Subject: [PATCH 268/410] Fixed screenshot issue --- main/plugins/helpers.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/main/plugins/helpers.py b/main/plugins/helpers.py index 5ae8c4afa..bc3ed2a47 100644 --- a/main/plugins/helpers.py +++ b/main/plugins/helpers.py @@ -59,10 +59,15 @@ async def screenshot(video, duration, sender): f"{out}", "-y" ] - print(cmd) process = await asyncio.create_subprocess_exec( *cmd, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE ) - + stdout, stderr = await process.communicate() + x = stderr.decode().strip() + y = stdout.decode().strip() + if os.path.isfile(out): + return out + else: + None From c2da848002e82e598d751e0456f54dcb95cc34c9 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Fri, 25 Feb 2022 14:48:28 +0530 Subject: [PATCH 269/410] Typo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e7ea2d7dd..b828e2874 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ A stable telegram bot to get restricted messages with custom thumbnail support , - `API_ID` - `API_HASH` - `SESSION` -- `BOT TOKEN` +- `BOT_TOKEN` - `AUTH` - Owner user id - `FORCESUB` - Public channel username without '@'. Don't forget to add bot in channel as administrator. From c8ee8fec80825b8d974bba82515c535d53b43437 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Wed, 16 Mar 2022 11:42:31 +0530 Subject: [PATCH 270/410] Update pyroplug.py --- main/plugins/pyroplug.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/main/plugins/pyroplug.py b/main/plugins/pyroplug.py index 431ffd027..59f3bd47d 100644 --- a/main/plugins/pyroplug.py +++ b/main/plugins/pyroplug.py @@ -6,7 +6,8 @@ from main.plugins.progress import progress_for_pyrogram from main.plugins.helpers import screenshot -from pyrogram import Client, filters +from pyrogram import Client, filters +from pyrogram.errors import ChannelBanned, ChannelInvalid, ChannelPrivate, ChatIdInvalid, ChatInvalid from ethon.pyfunc import video_metadata from telethon import events @@ -112,11 +113,10 @@ async def get_msg(userbot, client, sender, edit_id, msg_link, i): ) ) await edit.delete() + except (ChannelBanned, ChannelInvalid, ChannelPrivate, ChatIdInvalid, ChatInvalid): + await client.edit_message_text(sender, edit_id, "Have you joined the channel?") + return except Exception as e: - print(e) - if 'CHANNEL' in str(e).split("_") and 'INVALID' in str(e).split("_"): - await client.edit_message_text(sender, edit_id, "Have you joined the channel?") - return await client.edit_message_text(sender, edit_id, f'Failed to save: `{msg_link}`') return else: From f2491c7ac16f998892431efae3f30cfa181b107b Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Wed, 30 Mar 2022 19:17:53 +0530 Subject: [PATCH 271/410] Update and rename main.py to frontend.py --- main/plugins/{main.py => frontend.py} | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) rename main/plugins/{main.py => frontend.py} (84%) diff --git a/main/plugins/main.py b/main/plugins/frontend.py similarity index 84% rename from main/plugins/main.py rename to main/plugins/frontend.py index 0dcce4fd9..a63700db7 100644 --- a/main/plugins/main.py +++ b/main/plugins/frontend.py @@ -17,6 +17,8 @@ ft = f"To use this bot you've to join @{fs}." +message = "Send me the message link you want to start saving from, as a reply to this message." + # To-Do: # Make these codes shorter and clean # ofc will never do it. @@ -24,7 +26,9 @@ @Drone.on(events.NewMessage(incoming=True, func=lambda e: e.is_private)) async def clone(event): if event.is_reply: - return + reply = await event.get_reply_message() + if reply.text == message: + return try: link = get_link(event.text) if not link: From d7258a661bb8fdfd49ce76807aebe1b96e9bae5e Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Wed, 30 Mar 2022 19:24:25 +0530 Subject: [PATCH 272/410] Update frontend.py --- main/plugins/frontend.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/main/plugins/frontend.py b/main/plugins/frontend.py index a63700db7..21c3591ca 100644 --- a/main/plugins/frontend.py +++ b/main/plugins/frontend.py @@ -6,14 +6,11 @@ from .. import userbot, Bot from .. import FORCESUB as fs from main.plugins.pyroplug import get_msg +from main.plugins.helpers import get_link, join, screenshot from telethon import events -from telethon.tl.types import DocumentAttributeVideo - -from ethon.pyfunc import video_metadata -from ethon.telefunc import fast_upload, fast_download, force_sub -from main.plugins.helpers import get_link, join, screenshot +from ethon.telefunc import force_sub ft = f"To use this bot you've to join @{fs}." From 47dc9da222f09ceadc55a954b6d4bc21a03c185a Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Fri, 1 Apr 2022 11:24:07 +0530 Subject: [PATCH 273/410] Create okteto-stack.yaml --- okteto-stack.yaml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 okteto-stack.yaml diff --git a/okteto-stack.yaml b/okteto-stack.yaml new file mode 100644 index 000000000..676ff3a3e --- /dev/null +++ b/okteto-stack.yaml @@ -0,0 +1,14 @@ +services: + drone: + build: . + environment: + API_ID: $API_ID + API_HASH: $API_HASH + BOT_TOKEN: $BOT_TOKEN + AUTH: $AUTH + FORCESUB: $FORCESUB + ports: + - 8080 + resources: + cpu: 1000m + memory: 3Gi From 795a588798425893363eae9bb750a24762c76b01 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Fri, 1 Apr 2022 11:24:32 +0530 Subject: [PATCH 274/410] Update okteto-stack.yaml --- okteto-stack.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/okteto-stack.yaml b/okteto-stack.yaml index 676ff3a3e..04bb2f594 100644 --- a/okteto-stack.yaml +++ b/okteto-stack.yaml @@ -5,6 +5,7 @@ services: API_ID: $API_ID API_HASH: $API_HASH BOT_TOKEN: $BOT_TOKEN + SESSION: $SESSION AUTH: $AUTH FORCESUB: $FORCESUB ports: From f561779d4e940b174fc5910464c634ddd44c2704 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Fri, 1 Apr 2022 11:25:46 +0530 Subject: [PATCH 275/410] Create Dockerfile --- Dockerfile | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..61804edf4 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,8 @@ +FROM python:3.9.2-slim-buster +RUN mkdir /app && chmod 777 /app +WORKDIR /app +ENV DEBIAN_FRONTEND=noninteractive +RUN apt -qq update && apt -qq install -y git python3 python3-pip ffmpeg +COPY . . +RUN pip3 install --no-cache-dir -r requirements.txt +CMD ["bash","dronebots.sh"] From 3a96088302e315c8fa1cb637130753ed0fe00787 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Fri, 1 Apr 2022 11:27:31 +0530 Subject: [PATCH 276/410] Create bash.sh --- bash.sh | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 bash.sh diff --git a/bash.sh b/bash.sh new file mode 100644 index 000000000..0dc8e8668 --- /dev/null +++ b/bash.sh @@ -0,0 +1,2 @@ +echo "starting Bot ~@DroneBots"; +python3 -m main From 4ad79a8921a6718f789a7f848b7252d4651bd3ea Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Fri, 1 Apr 2022 11:27:51 +0530 Subject: [PATCH 277/410] Update Dockerfile --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 61804edf4..0bd91ea89 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,4 +5,4 @@ ENV DEBIAN_FRONTEND=noninteractive RUN apt -qq update && apt -qq install -y git python3 python3-pip ffmpeg COPY . . RUN pip3 install --no-cache-dir -r requirements.txt -CMD ["bash","dronebots.sh"] +CMD ["bash","bash.sh"] From df4a10c9bad066ceda73fa3c211e5a66991e4f37 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Fri, 1 Apr 2022 19:40:44 +0530 Subject: [PATCH 278/410] Update okteto-stack.yaml --- okteto-stack.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/okteto-stack.yaml b/okteto-stack.yaml index 04bb2f594..0ee662476 100644 --- a/okteto-stack.yaml +++ b/okteto-stack.yaml @@ -1,5 +1,5 @@ services: - drone: + drone-srcb: build: . environment: API_ID: $API_ID From b559517fa389993d118dc37d58ef39bf29ada36d Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Fri, 1 Apr 2022 22:25:59 +0530 Subject: [PATCH 279/410] Update README.md --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index b828e2874..baedc7263 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,8 @@ BOT TOKEN: @Botfather on telegram # Deploy +Deploy your bot on `heroku` + - Fork the repo, and star it - create app in heroku - go to settings of app>> config vars>> add all variables @@ -44,3 +46,7 @@ Buildpacks for manual deploy: - `heroku/python` - `https://github.com/jonathanong/heroku-buildpack-ffmpeg-latest.git` + +Deploy your bot on `Okteto` + +[![Develop on Okteto](https://okteto.com/develop-okteto.svg)](https://cloud.okteto.com) From 4c5ea84ec8f36fe7d63e325dc6711c341a64d3af Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Mon, 18 Apr 2022 13:39:42 +0530 Subject: [PATCH 280/410] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index baedc7263..226c8b229 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ Contact: [Telegram](https://t.me/MaheshChauhan) -A stable telegram bot to get restricted messages with custom thumbnail support , made by @MaheshChauhan. +A stable telegram bot to get restricted messages with custom thumbnail support , made by Mahesh Chauhan. - works for both public and private channels - Custom thumbnail support for Pvt medias From 9b87a0370ebc41ec073df61569849a46db090cf0 Mon Sep 17 00:00:00 2001 From: DeekshithSH Date: Thu, 21 Apr 2022 21:05:37 +0530 Subject: [PATCH 281/410] Imported asyncio --- main/plugins/batch.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/plugins/batch.py b/main/plugins/batch.py index b0deabc57..9a23e17c6 100644 --- a/main/plugins/batch.py +++ b/main/plugins/batch.py @@ -5,7 +5,7 @@ Plugin for both public & private channels! """ -import time, os +import time, os, asyncio from .. import bot as Drone from .. import userbot, Bot, AUTH From 779caaddda91c4ba5a93ffa6aa3c82caf10758c2 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sat, 23 Apr 2022 14:36:22 +0530 Subject: [PATCH 282/410] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 226c8b229..43e4b0b9f 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,7 @@ BOT TOKEN: @Botfather on telegram Deploy your bot on `heroku` -- Fork the repo, and star it +- Star the repo, and fork it - create app in heroku - go to settings of app>> config vars>> add all variables - add buildpacks From 08dc164001e260219c9dffa7a96347f5e0a0c6b1 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Tue, 26 Apr 2022 20:23:34 +0530 Subject: [PATCH 283/410] Create app.json --- app.json | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 app.json diff --git a/app.json b/app.json new file mode 100644 index 000000000..7c9d585ac --- /dev/null +++ b/app.json @@ -0,0 +1,45 @@ +{ + "name": "Save Restricted", + "description": "Save restricted content", + "logo": "", + "keywords": [ + "save restricted bot", + ], + "repository": "https://github.com/vasusen-code/SaveRestrictedContentBot", + "website": "", + "success_url": "https://t.me/DroneBots", + "env": { + "API_HASH": { + "description": "Your API HASH from my.telegram.org", + "value": "" + }, + "API_ID": { + "description": "Your API ID from my.telegram.org", + "value": "" + }, + "BOT_TOKEN": { + "description": "Bot token, get it from @BotFather.", + "value": "" + }, + "SESSION": { + "description": "pyrogram string session.", + "value": "" + }, + "AUTH": { + "description": "USER ID of bot owner", + "value": "" + }, + "FORCESUB": { + "description": "Public channel username without using '@'.", + "value": "" + } + }, + "buildpacks": [ + { + "url": "heroku/python" + }, + { + "url": "https://github.com/jonathanong/heroku-buildpack-ffmpeg-latest.git" + } + ] +} From 6fc2ec73400b4a3dcb297e591a77c88ec477c9ec Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Tue, 26 Apr 2022 20:24:29 +0530 Subject: [PATCH 284/410] Delete app.json --- app.json | 45 --------------------------------------------- 1 file changed, 45 deletions(-) delete mode 100644 app.json diff --git a/app.json b/app.json deleted file mode 100644 index 7c9d585ac..000000000 --- a/app.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "name": "Save Restricted", - "description": "Save restricted content", - "logo": "", - "keywords": [ - "save restricted bot", - ], - "repository": "https://github.com/vasusen-code/SaveRestrictedContentBot", - "website": "", - "success_url": "https://t.me/DroneBots", - "env": { - "API_HASH": { - "description": "Your API HASH from my.telegram.org", - "value": "" - }, - "API_ID": { - "description": "Your API ID from my.telegram.org", - "value": "" - }, - "BOT_TOKEN": { - "description": "Bot token, get it from @BotFather.", - "value": "" - }, - "SESSION": { - "description": "pyrogram string session.", - "value": "" - }, - "AUTH": { - "description": "USER ID of bot owner", - "value": "" - }, - "FORCESUB": { - "description": "Public channel username without using '@'.", - "value": "" - } - }, - "buildpacks": [ - { - "url": "heroku/python" - }, - { - "url": "https://github.com/jonathanong/heroku-buildpack-ffmpeg-latest.git" - } - ] -} From 7bf9db93e8a2078c91e3c8e36357513927c26b8f Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sun, 1 May 2022 09:34:52 +0530 Subject: [PATCH 285/410] =?UTF-8?q?Pyro-v2.0=20Login=F0=9F=98=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main/__init__.py b/main/__init__.py index 5ca052a48..bcddcdb49 100644 --- a/main/__init__.py +++ b/main/__init__.py @@ -21,8 +21,8 @@ bot = TelegramClient('bot', API_ID, API_HASH).start(bot_token=BOT_TOKEN) -userbot = Client( - session_name=SESSION, +userbot = Client("saverestricted", + session_string=SESSION, api_hash=API_HASH, api_id=API_ID) From 53e895464a43c4da9f5c7ed8166eaebf82e640d0 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Thu, 5 May 2022 11:41:50 +0530 Subject: [PATCH 286/410] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 43e4b0b9f..0e723e48d 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,7 @@ BOT TOKEN: @Botfather on telegram Deploy your bot on `heroku` -- Star the repo, and fork it +- Star the repo, and fork it in desktop mode - create app in heroku - go to settings of app>> config vars>> add all variables - add buildpacks From ecdcfed9b5c3d6a59563163d22ec35e37c460b9b Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Thu, 5 May 2022 13:11:58 +0530 Subject: [PATCH 287/410] Create app.json --- app.json | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 app.json diff --git a/app.json b/app.json new file mode 100644 index 000000000..7c9d585ac --- /dev/null +++ b/app.json @@ -0,0 +1,45 @@ +{ + "name": "Save Restricted", + "description": "Save restricted content", + "logo": "", + "keywords": [ + "save restricted bot", + ], + "repository": "https://github.com/vasusen-code/SaveRestrictedContentBot", + "website": "", + "success_url": "https://t.me/DroneBots", + "env": { + "API_HASH": { + "description": "Your API HASH from my.telegram.org", + "value": "" + }, + "API_ID": { + "description": "Your API ID from my.telegram.org", + "value": "" + }, + "BOT_TOKEN": { + "description": "Bot token, get it from @BotFather.", + "value": "" + }, + "SESSION": { + "description": "pyrogram string session.", + "value": "" + }, + "AUTH": { + "description": "USER ID of bot owner", + "value": "" + }, + "FORCESUB": { + "description": "Public channel username without using '@'.", + "value": "" + } + }, + "buildpacks": [ + { + "url": "heroku/python" + }, + { + "url": "https://github.com/jonathanong/heroku-buildpack-ffmpeg-latest.git" + } + ] +} From d1fe7a8f9c5612d1e3584ad92cc3a732f09c7a46 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Thu, 5 May 2022 13:21:18 +0530 Subject: [PATCH 288/410] Update README.md --- README.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 0e723e48d..c34ee94e7 100644 --- a/README.md +++ b/README.md @@ -32,9 +32,16 @@ PYROGRAM SESSION: [SessionGen Bot](https://t.me/SessionStringGeneratorZBot) or [ BOT TOKEN: @Botfather on telegram # Deploy - + Deploy your bot on `heroku` +» Method - 1: +- Star the repo, and fork it in desktop mode +- Go to settings of your forked repo +- Rename your repo by any other name +- Click on [![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy) + +» Method - 2: - Star the repo, and fork it in desktop mode - create app in heroku - go to settings of app>> config vars>> add all variables From 5781412bd24273df3ea9e14f7cfb5461cfe25644 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Thu, 5 May 2022 13:21:45 +0530 Subject: [PATCH 289/410] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c34ee94e7..d5c6cab3c 100644 --- a/README.md +++ b/README.md @@ -39,7 +39,7 @@ Deploy your bot on `heroku` - Star the repo, and fork it in desktop mode - Go to settings of your forked repo - Rename your repo by any other name -- Click on [![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy) +- Click on [![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy) » Method - 2: - Star the repo, and fork it in desktop mode From 4f1ba548016d033ecfbebb31ab82bc0db393a462 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Fri, 6 May 2022 10:36:52 +0530 Subject: [PATCH 290/410] Update __init__.py --- main/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/__init__.py b/main/__init__.py index bcddcdb49..7ff59b2bc 100644 --- a/main/__init__.py +++ b/main/__init__.py @@ -1,4 +1,4 @@ -#ChauhanMahesh/Vasusen/DroneBots/COL +#Github.com/Vasusen-code from pyrogram import Client From 3b18bfb01231b06b590a33bcd41ca626fc0aabc4 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sat, 7 May 2022 00:23:48 +0530 Subject: [PATCH 291/410] Update app.json --- app.json | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/app.json b/app.json index 7c9d585ac..e5d0314f9 100644 --- a/app.json +++ b/app.json @@ -1,9 +1,11 @@ { - "name": "Save Restricted", - "description": "Save restricted content", + "name": "Save restricted content bot", + "description": "Telegram bot to save restricted content.", "logo": "", "keywords": [ - "save restricted bot", + "telegram", + "Save restricted content", + "bot" ], "repository": "https://github.com/vasusen-code/SaveRestrictedContentBot", "website": "", @@ -22,15 +24,19 @@ "value": "" }, "SESSION": { - "description": "pyrogram string session.", + "description": "Pyrogram string session.", "value": "" }, "AUTH": { - "description": "USER ID of bot owner", + "description": "User ID of Bot owner.", "value": "" }, "FORCESUB": { - "description": "Public channel username without using '@'.", + "description": "Username name of public channel without using '@'.", + "value": "" + }, + "BOT_UN": { + "description": "Your bot username here. Do not use '@'.", "value": "" } }, From d1f6c6ec3e996ee100012ac0380cb7cc90afa804 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sat, 7 May 2022 00:24:43 +0530 Subject: [PATCH 292/410] Update app.json --- app.json | 4 ---- 1 file changed, 4 deletions(-) diff --git a/app.json b/app.json index e5d0314f9..3252378af 100644 --- a/app.json +++ b/app.json @@ -34,10 +34,6 @@ "FORCESUB": { "description": "Username name of public channel without using '@'.", "value": "" - }, - "BOT_UN": { - "description": "Your bot username here. Do not use '@'.", - "value": "" } }, "buildpacks": [ From 62673c2203b7c0fdfccd9da56f8119f0477dba19 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Mon, 9 May 2022 01:02:41 +0530 Subject: [PATCH 293/410] Typo --- main/plugins/pyroplug.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/plugins/pyroplug.py b/main/plugins/pyroplug.py index 59f3bd47d..abeed3336 100644 --- a/main/plugins/pyroplug.py +++ b/main/plugins/pyroplug.py @@ -67,7 +67,7 @@ async def get_msg(userbot, client, sender, edit_id, msg_link, i): time.time() ) ) - await edit.edit('Prearing to Upload!') + await edit.edit('Preparing to Upload!') caption = str(file) if msg.caption is not None: caption = msg.caption From 87cd8aa4b483d64257e9758fe81c12034df904dd Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Mon, 9 May 2022 11:13:37 +0530 Subject: [PATCH 294/410] Update requirements.txt --- requirements.txt | 2 -- 1 file changed, 2 deletions(-) diff --git a/requirements.txt b/requirements.txt index 116c3de5e..e75baaccf 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,6 +3,4 @@ ethon==1.3.6 cryptg tgcrypto -telethon pyrogram -python-decouple From ea1801c4f257eeeed136f76b5617ed145ac8153a Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sun, 15 May 2022 18:38:56 +0530 Subject: [PATCH 295/410] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index d5c6cab3c..7c962715b 100644 --- a/README.md +++ b/README.md @@ -56,4 +56,6 @@ Buildpacks for manual deploy: Deploy your bot on `Okteto` +Tutorial for okteto - [click here](https://telegra.ph/Okteto-Deploy-04-01) + [![Develop on Okteto](https://okteto.com/develop-okteto.svg)](https://cloud.okteto.com) From acca1683caf7148a9996e8ab09883d5f84ecf682 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sun, 15 May 2022 18:39:38 +0530 Subject: [PATCH 296/410] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 7c962715b..3259b49e5 100644 --- a/README.md +++ b/README.md @@ -54,7 +54,7 @@ Buildpacks for manual deploy: - `heroku/python` - `https://github.com/jonathanong/heroku-buildpack-ffmpeg-latest.git` -Deploy your bot on `Okteto` +Deploy your bot on `Okteto` [Useless] Tutorial for okteto - [click here](https://telegra.ph/Okteto-Deploy-04-01) From 0d450dceee7672262deee7a3b40a1fe303ff027f Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sun, 15 May 2022 18:40:28 +0530 Subject: [PATCH 297/410] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 3259b49e5..98ff58966 100644 --- a/README.md +++ b/README.md @@ -44,7 +44,7 @@ Deploy your bot on `heroku` » Method - 2: - Star the repo, and fork it in desktop mode - create app in heroku -- go to settings of app>> config vars>> add all variables +- go to settings of app›› config vars›› add all variables - add buildpacks - connect to github and deploy - turn on dynos From 3e2252cba6258f635d85b0a4cab9a4a37d889ae1 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Wed, 18 May 2022 07:23:37 +0530 Subject: [PATCH 298/410] Update README.md --- README.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 98ff58966..1bac90a4c 100644 --- a/README.md +++ b/README.md @@ -33,9 +33,13 @@ BOT TOKEN: @Botfather on telegram # Deploy +Deploy your bot on `Render` + +Tutorial - [Click here](https://telegra.ph/SRCB-on-Render-05-17) + Deploy your bot on `heroku` -» Method - 1: +» Method - 1 [Will work after heroku fix issues]: - Star the repo, and fork it in desktop mode - Go to settings of your forked repo - Rename your repo by any other name From b7bb30f0bfd9d80eafad1057ea18a6cd367b541b Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Wed, 18 May 2022 07:47:11 +0530 Subject: [PATCH 299/410] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 1bac90a4c..30f711bda 100644 --- a/README.md +++ b/README.md @@ -35,6 +35,8 @@ BOT TOKEN: @Botfather on telegram Deploy your bot on `Render` +

+ Tutorial - [Click here](https://telegra.ph/SRCB-on-Render-05-17) Deploy your bot on `heroku` From fe3ca01d8deeca76ccbcecca09b4ad10f3bcd476 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Wed, 18 May 2022 07:51:24 +0530 Subject: [PATCH 300/410] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 30f711bda..d0a8d46f8 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,7 @@ BOT TOKEN: @Botfather on telegram Deploy your bot on `Render` -

+[![Deploy](https://www.generalcatalyst.com/wp-content/uploads/2019/04/render-logo-wordmark-735x277.png)](dashboard.render.com) Tutorial - [Click here](https://telegra.ph/SRCB-on-Render-05-17) From f8a763e60ffb86209104191e7e6cb1d8bfb57815 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Wed, 18 May 2022 07:52:37 +0530 Subject: [PATCH 301/410] Update README.md --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index d0a8d46f8..1bac90a4c 100644 --- a/README.md +++ b/README.md @@ -35,8 +35,6 @@ BOT TOKEN: @Botfather on telegram Deploy your bot on `Render` -[![Deploy](https://www.generalcatalyst.com/wp-content/uploads/2019/04/render-logo-wordmark-735x277.png)](dashboard.render.com) - Tutorial - [Click here](https://telegra.ph/SRCB-on-Render-05-17) Deploy your bot on `heroku` From 6e87f23e4b359bdce83ff9f92448a88b8a15c2df Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Wed, 18 May 2022 08:13:11 +0530 Subject: [PATCH 302/410] Update __init__.py --- main/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/__init__.py b/main/__init__.py index 7ff59b2bc..aab835c2b 100644 --- a/main/__init__.py +++ b/main/__init__.py @@ -22,7 +22,7 @@ bot = TelegramClient('bot', API_ID, API_HASH).start(bot_token=BOT_TOKEN) userbot = Client("saverestricted", - session_string=SESSION, + session_name=SESSION, api_hash=API_HASH, api_id=API_ID) From 1c486251ec830c591ef06bcbdde5b689576a52df Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Wed, 18 May 2022 08:13:51 +0530 Subject: [PATCH 303/410] Update requirements.txt --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index e75baaccf..c257a51a5 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,4 +3,4 @@ ethon==1.3.6 cryptg tgcrypto -pyrogram +pyrogram==1.4.16 From c7442ee23b70bdf5cc63adbb9cdcdac4df90e9ed Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Wed, 18 May 2022 11:25:06 +0530 Subject: [PATCH 304/410] Update __init__.py --- main/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/__init__.py b/main/__init__.py index aab835c2b..85aed9ced 100644 --- a/main/__init__.py +++ b/main/__init__.py @@ -21,7 +21,7 @@ bot = TelegramClient('bot', API_ID, API_HASH).start(bot_token=BOT_TOKEN) -userbot = Client("saverestricted", +userbot = Client( session_name=SESSION, api_hash=API_HASH, api_id=API_ID) From 6855616b1e3769fa8ad06a256f96a3a46bf585d2 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sat, 9 Jul 2022 21:05:31 +0530 Subject: [PATCH 305/410] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1bac90a4c..0dc831cbb 100644 --- a/README.md +++ b/README.md @@ -39,7 +39,7 @@ Tutorial - [Click here](https://telegra.ph/SRCB-on-Render-05-17) Deploy your bot on `heroku` -» Method - 1 [Will work after heroku fix issues]: +» Method - 1: - Star the repo, and fork it in desktop mode - Go to settings of your forked repo - Rename your repo by any other name From ff19de44b8847db48ba2e7947116852eaa4f4df9 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Tue, 8 Nov 2022 23:00:02 +0530 Subject: [PATCH 306/410] Update README.md --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 0dc831cbb..5f82d201e 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,10 @@ BOT TOKEN: @Botfather on telegram # Deploy +Deploy on `VPS` + +Tutorial - [Click here](https://t.me/MaheshChauhan/36) + Deploy your bot on `Render` Tutorial - [Click here](https://telegra.ph/SRCB-on-Render-05-17) From 901a224e88a6ac13b3357a56c757ffd63f1f9ea6 Mon Sep 17 00:00:00 2001 From: LotusCloud <113554611+LotusCloud@users.noreply.github.com> Date: Mon, 28 Nov 2022 03:50:36 +0530 Subject: [PATCH 307/410] Create docker-compose.yml --- docker-compose.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 docker-compose.yml diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 000000000..558898ced --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,14 @@ +version: "3.3" + +services: + app: + container_name: srcbot + build: . + command: bash bash.sh + environment: + API_ID: #fill here + API_HASH: #fill here + BOT_TOKEN: #fill here + SESSION: #fill here + AUTH: #fill here + FORCESUB: #fill here From e5fc5b443012abee5b5e291250b4ecfb208b8baf Mon Sep 17 00:00:00 2001 From: LotusCloud <113554611+LotusCloud@users.noreply.github.com> Date: Mon, 28 Nov 2022 03:52:09 +0530 Subject: [PATCH 308/410] Update docker-compose.yml --- docker-compose.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 558898ced..51b41620d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -6,9 +6,9 @@ services: build: . command: bash bash.sh environment: - API_ID: #fill here - API_HASH: #fill here - BOT_TOKEN: #fill here - SESSION: #fill here - AUTH: #fill here - FORCESUB: #fill here + API_ID: # Your API HASH from my.telegram.org + API_HASH: # Your API ID from my.telegram.org + BOT_TOKEN: # Bot token, get it from @BotFather + SESSION: # Pyrogram string session + AUTH: # User ID of Bot owner + FORCESUB: # Username name of public channel without using '@' From 5027330edec72ff9ffe5194c72f1e8055356298c Mon Sep 17 00:00:00 2001 From: LotusCloud <113554611+LotusCloud@users.noreply.github.com> Date: Mon, 28 Nov 2022 14:22:36 +0530 Subject: [PATCH 309/410] Update README.md --- README.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/README.md b/README.md index 5f82d201e..9a2bfd5bb 100644 --- a/README.md +++ b/README.md @@ -37,6 +37,19 @@ Deploy on `VPS` Tutorial - [Click here](https://t.me/MaheshChauhan/36) +Easy Method + +1. Intall docker-compose +2. Fill in the variables in docker-compose.yml file using your favorite text editor or nano +3. Start the container + +``` +sudo apt install docker-compose -y +nano docker-compose.yml +sudo docker-compose up --build +``` + + Deploy your bot on `Render` Tutorial - [Click here](https://telegra.ph/SRCB-on-Render-05-17) From 774b61ebda5183d8685fa21f28d045fddb715e88 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Mon, 28 Nov 2022 22:02:52 +0530 Subject: [PATCH 310/410] auto delete --- main/plugins/pyroplug.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/main/plugins/pyroplug.py b/main/plugins/pyroplug.py index abeed3336..d8aab875a 100644 --- a/main/plugins/pyroplug.py +++ b/main/plugins/pyroplug.py @@ -94,9 +94,11 @@ async def get_msg(userbot, client, sender, edit_id, msg_link, i): time.time() ) ) + os.remove(file) elif str(file).split(".")[-1] in ['jpg', 'jpeg', 'png', 'webp']: await edit.edit("Uploading photo.") await bot.send_file(sender, file, caption=caption) + os.remove(file) else: thumb_path=thumbnail(sender) await client.send_document( @@ -112,6 +114,7 @@ async def get_msg(userbot, client, sender, edit_id, msg_link, i): time.time() ) ) + os.remove(file) await edit.delete() except (ChannelBanned, ChannelInvalid, ChannelPrivate, ChatIdInvalid, ChatInvalid): await client.edit_message_text(sender, edit_id, "Have you joined the channel?") From b6e42e3a74b3e25329456cc193a374efa9b00f60 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Tue, 29 Nov 2022 18:43:12 +0530 Subject: [PATCH 311/410] auto clear --- main/plugins/pyroplug.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/main/plugins/pyroplug.py b/main/plugins/pyroplug.py index d8aab875a..188c60e72 100644 --- a/main/plugins/pyroplug.py +++ b/main/plugins/pyroplug.py @@ -42,6 +42,7 @@ async def get_msg(userbot, client, sender, edit_id, msg_link, i): msg_id = int(msg_link.split("/")[-1]) + int(i) if 't.me/c/' in msg_link: chat = int('-100' + str(msg_link.split("/")[-2])) + file = "" try: msg = await userbot.get_messages(chat, msg_id) if msg.media: @@ -121,6 +122,7 @@ async def get_msg(userbot, client, sender, edit_id, msg_link, i): return except Exception as e: await client.edit_message_text(sender, edit_id, f'Failed to save: `{msg_link}`') + os.remove(file) return else: edit = await client.edit_message_text(sender, edit_id, "Cloning.") From 17d524cb4ec3f838793930b9adce03b81f42b43d Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sun, 4 Dec 2022 22:24:32 +0530 Subject: [PATCH 312/410] logging error --- main/plugins/pyroplug.py | 1 + 1 file changed, 1 insertion(+) diff --git a/main/plugins/pyroplug.py b/main/plugins/pyroplug.py index 188c60e72..fa0523409 100644 --- a/main/plugins/pyroplug.py +++ b/main/plugins/pyroplug.py @@ -121,6 +121,7 @@ async def get_msg(userbot, client, sender, edit_id, msg_link, i): await client.edit_message_text(sender, edit_id, "Have you joined the channel?") return except Exception as e: + print(e) await client.edit_message_text(sender, edit_id, f'Failed to save: `{msg_link}`') os.remove(file) return From d41a3d9658e587684b930eda00c292258df49255 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sun, 4 Dec 2022 22:25:39 +0530 Subject: [PATCH 313/410] fw.x --- main/plugins/batch.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/plugins/batch.py b/main/plugins/batch.py index 9a23e17c6..9883e6684 100644 --- a/main/plugins/batch.py +++ b/main/plugins/batch.py @@ -93,7 +93,7 @@ async def run_batch(userbot, client, sender, link, _range): try: await get_bulk_msg(userbot, client, sender, link, i) except FloodWait as fw: - await asyncio.sleep(fw.seconds + 5) + await asyncio.sleep(fw.x + 5) await get_bulk_msg(userbot, client, sender, link, i) protection = await client.send_message(sender, f"Sleeping for `{timer}` seconds to avoid Floodwaits and Protect account!") time.sleep(timer) From 5f7826ea3818460f2aae27724402156c22c4e6f7 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sun, 4 Dec 2022 22:28:57 +0530 Subject: [PATCH 314/410] fw handling --- main/plugins/batch.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/main/plugins/batch.py b/main/plugins/batch.py index 9883e6684..5630bfcde 100644 --- a/main/plugins/batch.py +++ b/main/plugins/batch.py @@ -93,7 +93,9 @@ async def run_batch(userbot, client, sender, link, _range): try: await get_bulk_msg(userbot, client, sender, link, i) except FloodWait as fw: + fw_alert = await client.send_message(sender, f"Sleeping for f'{fw.x} seconds due to floodwait.") await asyncio.sleep(fw.x + 5) + await fw_alert.delete() await get_bulk_msg(userbot, client, sender, link, i) protection = await client.send_message(sender, f"Sleeping for `{timer}` seconds to avoid Floodwaits and Protect account!") time.sleep(timer) From e297a4273e6315c87274402742ab0d13da57da8d Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sun, 4 Dec 2022 22:41:20 +0530 Subject: [PATCH 315/410] Update README.md --- README.md | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 9a2bfd5bb..0336eb815 100644 --- a/README.md +++ b/README.md @@ -35,13 +35,11 @@ BOT TOKEN: @Botfather on telegram Deploy on `VPS` -Tutorial - [Click here](https://t.me/MaheshChauhan/36) +Easy Method: -Easy Method - -1. Intall docker-compose -2. Fill in the variables in docker-compose.yml file using your favorite text editor or nano -3. Start the container +- Intall docker-compose +- Fill in the variables in docker-compose.yml file using your favorite text editor or nano +- Start the container ``` sudo apt install docker-compose -y @@ -49,6 +47,23 @@ nano docker-compose.yml sudo docker-compose up --build ``` +The hard Way: + +- Fill vars in your fork in [this](https://github.com/vasusen-code/SaveRestrictedContentBot/blob/master/main/__init__.py) file as shown above in the picture +- enter all the below commands + +``` +sudo apt update +sudo apt install ffmpeg git python3-pip +git clone your_repo_link +cd saverestrictedcontentbot +pip3 install -r requirements.txt +python3 -m main +``` + +if you want bot to be running in background then enter `screen -S srcb` before `python3 -m main` +after `python3 -m main`, click ctrl+A and ctrl+D +if you want to stop bot, then enter `screen -r srcb` and click ctrl+A then press K and enter Y. Deploy your bot on `Render` From e18c625f9fb94f5a657a9bbc23dc4e9d89ecb3a8 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sun, 4 Dec 2022 22:42:12 +0530 Subject: [PATCH 316/410] Update README.md --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 0336eb815..a5a904a0a 100644 --- a/README.md +++ b/README.md @@ -61,9 +61,9 @@ pip3 install -r requirements.txt python3 -m main ``` -if you want bot to be running in background then enter `screen -S srcb` before `python3 -m main` -after `python3 -m main`, click ctrl+A and ctrl+D -if you want to stop bot, then enter `screen -r srcb` and click ctrl+A then press K and enter Y. +- if you want bot to be running in background then enter `screen -S srcb` before `python3 -m main` +- after `python3 -m main`, click ctrl+A and ctrl+D +- if you want to stop bot, then enter `screen -r srcb` and click ctrl+A then press K and enter Y. Deploy your bot on `Render` From 9aaa44d6be8574c51c07be6ae3e1674075c7a0b9 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sun, 4 Dec 2022 22:46:20 +0530 Subject: [PATCH 317/410] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a5a904a0a..34b72a15a 100644 --- a/README.md +++ b/README.md @@ -49,7 +49,7 @@ sudo docker-compose up --build The hard Way: -- Fill vars in your fork in [this](https://github.com/vasusen-code/SaveRestrictedContentBot/blob/master/main/__init__.py) file as shown above in the picture +- Fill vars in your fork in [this](https://github.com/vasusen-code/SaveRestrictedContentBot/blob/master/main/__init__.py) file as shown in this [picture](https://t.me/MaheshChauhan/36) - enter all the below commands ``` From 9d96e47b5b78d90bfd8ef88a03499fa96ce4ed61 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sun, 4 Dec 2022 22:55:14 +0530 Subject: [PATCH 318/410] fw handling --- main/plugins/pyroplug.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/main/plugins/pyroplug.py b/main/plugins/pyroplug.py index fa0523409..1f7670268 100644 --- a/main/plugins/pyroplug.py +++ b/main/plugins/pyroplug.py @@ -130,6 +130,9 @@ async def get_msg(userbot, client, sender, edit_id, msg_link, i): chat = msg_link.split("/")[-2] try: await client.copy_message(int(sender), chat, msg_id) + except FloodWait as fw: + await client.edit_message_text(sender, edit_id, f'Please try after {fw.x} seconds, due to floodwaits caused by too many requests.') + return print(fw) except Exception as e: print(e) return await client.edit_message_text(sender, edit_id, f'Failed to save: `{msg_link}`') From fc8d67e918fa37a65c32cfaa7ab9e957918c5ee0 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sun, 4 Dec 2022 22:55:38 +0530 Subject: [PATCH 319/410] Update pyroplug.py --- main/plugins/pyroplug.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/plugins/pyroplug.py b/main/plugins/pyroplug.py index 1f7670268..1c1d3b1ad 100644 --- a/main/plugins/pyroplug.py +++ b/main/plugins/pyroplug.py @@ -7,7 +7,7 @@ from main.plugins.helpers import screenshot from pyrogram import Client, filters -from pyrogram.errors import ChannelBanned, ChannelInvalid, ChannelPrivate, ChatIdInvalid, ChatInvalid +from pyrogram.errors import ChannelBanned, ChannelInvalid, ChannelPrivate, ChatIdInvalid, ChatInvalid, FloodWait from ethon.pyfunc import video_metadata from telethon import events From 022c7ee1f6425fce0303689e145a9cd1cbde94b1 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sun, 11 Dec 2022 19:46:59 +0530 Subject: [PATCH 320/410] Update pyroplug.py --- main/plugins/pyroplug.py | 57 +++++++++++++++++++--------------------- 1 file changed, 27 insertions(+), 30 deletions(-) diff --git a/main/plugins/pyroplug.py b/main/plugins/pyroplug.py index 1c1d3b1ad..3279b0cd0 100644 --- a/main/plugins/pyroplug.py +++ b/main/plugins/pyroplug.py @@ -9,7 +9,9 @@ from pyrogram import Client, filters from pyrogram.errors import ChannelBanned, ChannelInvalid, ChannelPrivate, ChatIdInvalid, ChatInvalid, FloodWait from ethon.pyfunc import video_metadata +from ethon.telefunc import fast_upload from telethon import events +from telethon.tl.types import DocumentAttributeVideo def thumbnail(sender): if os.path.exists(f'{sender}.jpg'): @@ -72,28 +74,26 @@ async def get_msg(userbot, client, sender, edit_id, msg_link, i): caption = str(file) if msg.caption is not None: caption = msg.caption - if str(file).split(".")[-1] in ['mkv', 'mp4', 'webm']: - if str(file).split(".")[-1] in ['webm', 'mkv']: + if str(file).split(".")[-1] in ['mkv', 'mp4', 'webm', 'mpe4', 'mpeg']: + if str(file).split(".")[-1] in ['webm', 'mkv', 'mpe4', 'mpeg']: path = str(file).split(".")[0] + ".mp4" os.rename(file, path) file = str(file).split(".")[0] + ".mp4" data = video_metadata(file) duration = data["duration"] + width = data["width"] + height = data["height"] thumb_path = await screenshot(file, duration, sender) - await client.send_video( - chat_id=sender, - video=file, - caption=caption, - supports_streaming=True, - duration=duration, - thumb=thumb_path, - progress=progress_for_pyrogram, - progress_args=( - client, - '**UPLOADING:**\n', - edit, - time.time() - ) + UT = time.time() + uploader = await fast_upload(f'{file}', f'{file}', UT, bot, edit, '**UPLOADING:**') + attributes = [DocumentAttributeVideo(duration=duration, w=width, h=height, supports_streaming=True)] + await bot.send_file( + sender, + uploader, + caption=caption, + thumb=thumb_path, + attributes=attributes, + force_document=False ) os.remove(file) elif str(file).split(".")[-1] in ['jpg', 'jpeg', 'png', 'webp']: @@ -102,18 +102,14 @@ async def get_msg(userbot, client, sender, edit_id, msg_link, i): os.remove(file) else: thumb_path=thumbnail(sender) - await client.send_document( - sender, - file, - caption=caption, - thumb=thumb_path, - progress=progress_for_pyrogram, - progress_args=( - client, - '**UPLOADING:**\n', - edit, - time.time() - ) + UT = time.time() + uploader = await fast_upload(f'{file}', f'{file}', UT, bot, edit, '**UPLOADING:**') + await bot.send_file( + sender, + uploader, + caption=caption, + thumb=thumb_path, + force_document=True ) os.remove(file) await edit.delete() @@ -131,13 +127,14 @@ async def get_msg(userbot, client, sender, edit_id, msg_link, i): try: await client.copy_message(int(sender), chat, msg_id) except FloodWait as fw: - await client.edit_message_text(sender, edit_id, f'Please try after {fw.x} seconds, due to floodwaits caused by too many requests.') - return print(fw) + print(fw) + return await client.edit_message_text(sender, edit_id, f'Try again after {fw.x} seconds due to floodwait from telegram.') except Exception as e: print(e) return await client.edit_message_text(sender, edit_id, f'Failed to save: `{msg_link}`') await edit.delete() + async def get_bulk_msg(userbot, client, sender, msg_link, i): x = await client.send_message(sender, "Processing!") await get_msg(userbot, client, sender, x.message_id, msg_link, i) From 3ace99d7b6236768e722b27f15004f0a2dddbed5 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sun, 11 Dec 2022 22:16:08 +0530 Subject: [PATCH 321/410] Update batch.py --- main/plugins/batch.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main/plugins/batch.py b/main/plugins/batch.py index 5630bfcde..97273516d 100644 --- a/main/plugins/batch.py +++ b/main/plugins/batch.py @@ -93,12 +93,12 @@ async def run_batch(userbot, client, sender, link, _range): try: await get_bulk_msg(userbot, client, sender, link, i) except FloodWait as fw: - fw_alert = await client.send_message(sender, f"Sleeping for f'{fw.x} seconds due to floodwait.") + fw_alert = await client.send_message(sender, f"Sleeping for f'{int(fw.x) + 5} seconds due to floodwait.") await asyncio.sleep(fw.x + 5) await fw_alert.delete() await get_bulk_msg(userbot, client, sender, link, i) protection = await client.send_message(sender, f"Sleeping for `{timer}` seconds to avoid Floodwaits and Protect account!") - time.sleep(timer) + await asyncio.sleep(timer) await protection.delete() From e73b47440c60742d7bcb827af7862a2e097aa302 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sun, 11 Dec 2022 22:23:38 +0530 Subject: [PATCH 322/410] Update pyroplug.py --- main/plugins/pyroplug.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/main/plugins/pyroplug.py b/main/plugins/pyroplug.py index 3279b0cd0..1dfcaff5a 100644 --- a/main/plugins/pyroplug.py +++ b/main/plugins/pyroplug.py @@ -38,7 +38,7 @@ async def check(userbot, client, link): except Exception: return False, "Maybe bot is banned from the chat, or your link is invalid!" -async def get_msg(userbot, client, sender, edit_id, msg_link, i): +async def get_msg(userbot, client, sender, edit_id, msg_link, i, bulk=False): edit = "" chat = "" msg_id = int(msg_link.split("/")[-1]) + int(i) @@ -128,13 +128,16 @@ async def get_msg(userbot, client, sender, edit_id, msg_link, i): await client.copy_message(int(sender), chat, msg_id) except FloodWait as fw: print(fw) - return await client.edit_message_text(sender, edit_id, f'Try again after {fw.x} seconds due to floodwait from telegram.') - except Exception as e: + if bulk is True: + return await client.edit_message_text(sender, edit_id, f'Sleeping for {int(fw.x) + 5} seconds due to floodwait from telegram.') + else: + return await client.edit_message_text(sender, edit_id, f'Try again after {fw.x} seconds due to floodwait from telegram.') + except exception as e: print(e) return await client.edit_message_text(sender, edit_id, f'Failed to save: `{msg_link}`') await edit.delete() - + async def get_bulk_msg(userbot, client, sender, msg_link, i): x = await client.send_message(sender, "Processing!") - await get_msg(userbot, client, sender, x.message_id, msg_link, i) + await get_msg(userbot, client, sender, x.message_id, msg_link, i, bulk=True) From 0b89181322d03c19d072c4b6c06045c222ab118f Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sun, 11 Dec 2022 22:40:08 +0530 Subject: [PATCH 323/410] Update pyroplug.py --- main/plugins/pyroplug.py | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/main/plugins/pyroplug.py b/main/plugins/pyroplug.py index 1dfcaff5a..159109505 100644 --- a/main/plugins/pyroplug.py +++ b/main/plugins/pyroplug.py @@ -52,13 +52,13 @@ async def get_msg(userbot, client, sender, edit_id, msg_link, i, bulk=False): edit = await client.edit_message_text(sender, edit_id, "Cloning.") await client.send_message(sender, msg.text.markdown) await edit.delete() - return + return None, None if not msg.media: if msg.text: edit = await client.edit_message_text(sender, edit_id, "Cloning.") await client.send_message(sender, msg.text.markdown) await edit.delete() - return + return None, None edit = await client.edit_message_text(sender, edit_id, "Trying to Download.") file = await userbot.download_media( msg, @@ -113,31 +113,37 @@ async def get_msg(userbot, client, sender, edit_id, msg_link, i, bulk=False): ) os.remove(file) await edit.delete() + return None, None except (ChannelBanned, ChannelInvalid, ChannelPrivate, ChatIdInvalid, ChatInvalid): await client.edit_message_text(sender, edit_id, "Have you joined the channel?") - return + return None, None + except FloodWait as fw: + print(fw) + if bulk is True: + return "FW", f"Sleeping for {int(fw.x) + 5} seconds due to floodwait from telegram." + return None, await client.edit_message_text(sender, edit_id, f'Try again after {fw.x} seconds due to floodwait from telegram.') except Exception as e: print(e) await client.edit_message_text(sender, edit_id, f'Failed to save: `{msg_link}`') os.remove(file) - return + return None, None else: edit = await client.edit_message_text(sender, edit_id, "Cloning.") chat = msg_link.split("/")[-2] try: await client.copy_message(int(sender), chat, msg_id) + return None, None except FloodWait as fw: print(fw) if bulk is True: - return await client.edit_message_text(sender, edit_id, f'Sleeping for {int(fw.x) + 5} seconds due to floodwait from telegram.') - else: - return await client.edit_message_text(sender, edit_id, f'Try again after {fw.x} seconds due to floodwait from telegram.') + return "FW", f"Sleeping for {int(fw.x) + 5} seconds due to floodwait from telegram." + return None, await client.edit_message_text(sender, edit_id, f'Try again after {fw.x} seconds due to floodwait from telegram.') except exception as e: print(e) - return await client.edit_message_text(sender, edit_id, f'Failed to save: `{msg_link}`') + return None, await client.edit_message_text(sender, edit_id, f'Failed to save: `{msg_link}`') await edit.delete() - - + return None, None + async def get_bulk_msg(userbot, client, sender, msg_link, i): x = await client.send_message(sender, "Processing!") await get_msg(userbot, client, sender, x.message_id, msg_link, i, bulk=True) From a9a948ab5352043e7b554bfe3b9a6537e5712f08 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sun, 11 Dec 2022 22:44:54 +0530 Subject: [PATCH 324/410] Update batch.py --- main/plugins/batch.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/main/plugins/batch.py b/main/plugins/batch.py index 97273516d..51cfa00e2 100644 --- a/main/plugins/batch.py +++ b/main/plugins/batch.py @@ -90,11 +90,10 @@ async def run_batch(userbot, client, sender, link, _range): timer = 2 else: timer = 3 - try: - await get_bulk_msg(userbot, client, sender, link, i) - except FloodWait as fw: - fw_alert = await client.send_message(sender, f"Sleeping for f'{int(fw.x) + 5} seconds due to floodwait.") - await asyncio.sleep(fw.x + 5) + er, out = await get_bulk_msg(userbot, client, sender, link, i) + if er == "FW": + fw_alert = await client.send_message(sender, f'Sleeping for {int(out)} second(s) due to telegram flooodwait.') + await asyncio.sleep(out) await fw_alert.delete() await get_bulk_msg(userbot, client, sender, link, i) protection = await client.send_message(sender, f"Sleeping for `{timer}` seconds to avoid Floodwaits and Protect account!") From 1a96c3f16e159ae41897cd66c95f019ace1a00f8 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sun, 11 Dec 2022 22:46:26 +0530 Subject: [PATCH 325/410] Update pyroplug.py --- main/plugins/pyroplug.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main/plugins/pyroplug.py b/main/plugins/pyroplug.py index 159109505..662350d83 100644 --- a/main/plugins/pyroplug.py +++ b/main/plugins/pyroplug.py @@ -120,7 +120,7 @@ async def get_msg(userbot, client, sender, edit_id, msg_link, i, bulk=False): except FloodWait as fw: print(fw) if bulk is True: - return "FW", f"Sleeping for {int(fw.x) + 5} seconds due to floodwait from telegram." + return "FW", int(fw.x) + 5 return None, await client.edit_message_text(sender, edit_id, f'Try again after {fw.x} seconds due to floodwait from telegram.') except Exception as e: print(e) @@ -136,7 +136,7 @@ async def get_msg(userbot, client, sender, edit_id, msg_link, i, bulk=False): except FloodWait as fw: print(fw) if bulk is True: - return "FW", f"Sleeping for {int(fw.x) + 5} seconds due to floodwait from telegram." + return "FW", int(fw.x) + 5 return None, await client.edit_message_text(sender, edit_id, f'Try again after {fw.x} seconds due to floodwait from telegram.') except exception as e: print(e) From 78a6d3bf9517dc51b3c797b09f88cad2852131f2 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sun, 11 Dec 2022 22:49:38 +0530 Subject: [PATCH 326/410] Update batch.py --- main/plugins/batch.py | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/main/plugins/batch.py b/main/plugins/batch.py index 51cfa00e2..50d492ca8 100644 --- a/main/plugins/batch.py +++ b/main/plugins/batch.py @@ -90,15 +90,19 @@ async def run_batch(userbot, client, sender, link, _range): timer = 2 else: timer = 3 - er, out = await get_bulk_msg(userbot, client, sender, link, i) - if er == "FW": - fw_alert = await client.send_message(sender, f'Sleeping for {int(out)} second(s) due to telegram flooodwait.') - await asyncio.sleep(out) - await fw_alert.delete() - await get_bulk_msg(userbot, client, sender, link, i) - protection = await client.send_message(sender, f"Sleeping for `{timer}` seconds to avoid Floodwaits and Protect account!") - await asyncio.sleep(timer) - await protection.delete() - + try: + er, out = await get_bulk_msg(userbot, client, sender, link, i) + if er == "FW": + fw_alert = await client.send_message(sender, f'Sleeping for {int(out)} second(s) due to telegram flooodwait.') + await asyncio.sleep(out) + await fw_alert.delete() + await get_bulk_msg(userbot, client, sender, link, i) + protection = await client.send_message(sender, f"Sleeping for `{timer}` seconds to avoid Floodwaits and Protect account!") + await asyncio.sleep(timer) + await protection.delete() + except exception as e: + print(e) + await client.send_message(sender, f"Error occured: {e}\n\nAction: **PASS**") + pass From 459da6bd1d9eae0fb8fabb2e7ca890a0dbbe78eb Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sun, 11 Dec 2022 22:52:50 +0530 Subject: [PATCH 327/410] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 34b72a15a..829763f67 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ A stable telegram bot to get restricted messages with custom thumbnail support , API: [API scrapper Bot](https://t.me/USETGSBOT) or [Telegram.org](https://my.telegram.org/auth) -PYROGRAM SESSION: [SessionGen Bot](https://t.me/SessionStringGeneratorZBot) or [![Run on Repl.it](https://replit.com/badge/github/vasusen-code/saverestrictedcontentbot)](https://replit.com/@SpEcHiDe/GenerateStringSession) +PYROGRAM SESSION: [SessionGen Bot](https://t.me/SessionStringGeneratorZBot) or [![Run on Repl.it](https://replit.com/badge/github/vasusen-code/saverestrictedcontentbot)](https://replit.com/@dashezup/generate-pyrogram-session-string) BOT TOKEN: @Botfather on telegram From 9bcc018025d94d6d10491718bd125a59fbf4012d Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sun, 11 Dec 2022 22:54:37 +0530 Subject: [PATCH 328/410] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 829763f67..251d58852 100644 --- a/README.md +++ b/README.md @@ -62,7 +62,7 @@ python3 -m main ``` - if you want bot to be running in background then enter `screen -S srcb` before `python3 -m main` -- after `python3 -m main`, click ctrl+A and ctrl+D +- after `python3 -m main`, click ctrl+A, ctrl+D - if you want to stop bot, then enter `screen -r srcb` and click ctrl+A then press K and enter Y. Deploy your bot on `Render` From 086b56b7264b89ad80660d72342109698d671094 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sun, 11 Dec 2022 23:39:19 +0530 Subject: [PATCH 329/410] Update batch.py --- main/plugins/batch.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/main/plugins/batch.py b/main/plugins/batch.py index 50d492ca8..678e2ef6a 100644 --- a/main/plugins/batch.py +++ b/main/plugins/batch.py @@ -90,13 +90,13 @@ async def run_batch(userbot, client, sender, link, _range): timer = 2 else: timer = 3 - try: - er, out = await get_bulk_msg(userbot, client, sender, link, i) - if er == "FW": - fw_alert = await client.send_message(sender, f'Sleeping for {int(out)} second(s) due to telegram flooodwait.') - await asyncio.sleep(out) - await fw_alert.delete() - await get_bulk_msg(userbot, client, sender, link, i) + try: + er, out = await get_bulk_msg(userbot, client, sender, link, i) + if er == "FW": + fw_alert = await client.send_message(sender, f'Sleeping for {int(out)} second(s) due to telegram flooodwait.') + await asyncio.sleep(out) + await fw_alert.delete() + await get_bulk_msg(userbot, client, sender, link, i) protection = await client.send_message(sender, f"Sleeping for `{timer}` seconds to avoid Floodwaits and Protect account!") await asyncio.sleep(timer) await protection.delete() From 61131172023c509b4248abe4a3c425dc9b657378 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Mon, 12 Dec 2022 00:26:19 +0530 Subject: [PATCH 330/410] Update batch.py --- main/plugins/batch.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/plugins/batch.py b/main/plugins/batch.py index 678e2ef6a..0076a97ec 100644 --- a/main/plugins/batch.py +++ b/main/plugins/batch.py @@ -100,7 +100,7 @@ async def run_batch(userbot, client, sender, link, _range): protection = await client.send_message(sender, f"Sleeping for `{timer}` seconds to avoid Floodwaits and Protect account!") await asyncio.sleep(timer) await protection.delete() - except exception as e: + except Exception as e: print(e) await client.send_message(sender, f"Error occured: {e}\n\nAction: **PASS**") pass From e2f422d6d6416e801d659cc1fbd3ffdeafc53606 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Mon, 12 Dec 2022 00:27:42 +0530 Subject: [PATCH 331/410] Update pyroplug.py --- main/plugins/pyroplug.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/plugins/pyroplug.py b/main/plugins/pyroplug.py index 662350d83..8ae201435 100644 --- a/main/plugins/pyroplug.py +++ b/main/plugins/pyroplug.py @@ -138,7 +138,7 @@ async def get_msg(userbot, client, sender, edit_id, msg_link, i, bulk=False): if bulk is True: return "FW", int(fw.x) + 5 return None, await client.edit_message_text(sender, edit_id, f'Try again after {fw.x} seconds due to floodwait from telegram.') - except exception as e: + except Exception as e: print(e) return None, await client.edit_message_text(sender, edit_id, f'Failed to save: `{msg_link}`') await edit.delete() From d44ed17d79a9d870eee93a1465b6ee6a07fa004c Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Mon, 12 Dec 2022 00:38:55 +0530 Subject: [PATCH 332/410] Update requirements.txt --- requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/requirements.txt b/requirements.txt index c257a51a5..df11c193a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,6 @@ #Github.com-Vasusen-code +https://github.com/vasusen-code/my-tt/archive/refs/tags/v1.24.0.zip ethon==1.3.6 cryptg tgcrypto From a59175bae62501ddf8e6f0c848e36c9d0255e274 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Mon, 12 Dec 2022 18:19:47 +0530 Subject: [PATCH 333/410] Update requirements.txt --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index df11c193a..d31b3d48a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,6 @@ #Github.com-Vasusen-code -https://github.com/vasusen-code/my-tt/archive/refs/tags/v1.24.0.zip +https://github.com/vasusen-code/Telethon/archive/refs/tags/v1.24.0.zip ethon==1.3.6 cryptg tgcrypto From 034f225f7fd8b26f2d03d776cc40d5d003a85547 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Mon, 12 Dec 2022 21:49:23 +0530 Subject: [PATCH 334/410] Update requirements.txt --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index d31b3d48a..c4752ecdc 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,6 @@ #Github.com-Vasusen-code -https://github.com/vasusen-code/Telethon/archive/refs/tags/v1.24.0.zip +https://github.com/vasusen-code/Telethon/archive/refs/tags/v1.23.0.zip ethon==1.3.6 cryptg tgcrypto From 0351fa29724e5449f7bdb11b22c910cbf5a7fe81 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Mon, 12 Dec 2022 22:08:13 +0530 Subject: [PATCH 335/410] Update requirements.txt --- requirements.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/requirements.txt b/requirements.txt index c4752ecdc..e0df30062 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,7 +1,7 @@ #Github.com-Vasusen-code -https://github.com/vasusen-code/Telethon/archive/refs/tags/v1.23.0.zip -ethon==1.3.6 +https://github.com/vasusen-code/Telethon/archive/refs/tags/v1.24.0.zip +ethon==1.3.8 cryptg tgcrypto pyrogram==1.4.16 From 184b1c1caccb47a2964868314a013c152094d126 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Mon, 12 Dec 2022 23:20:38 +0530 Subject: [PATCH 336/410] Update pyroplug.py --- main/plugins/pyroplug.py | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/main/plugins/pyroplug.py b/main/plugins/pyroplug.py index 8ae201435..ba9c9efac 100644 --- a/main/plugins/pyroplug.py +++ b/main/plugins/pyroplug.py @@ -20,7 +20,13 @@ def thumbnail(sender): return None async def check(userbot, client, link): - msg_id = int(link.split("/")[-1]) + msg_id = 0 + try: + msg_id = int(link.split("/")[-1]) + except ValueError: + if '?single' in link: + link_ = link.split("?single")[0] + msg_id = int(link_.split("/")[-1]) if 't.me/c/' in link: try: chat = int('-100' + str(link.split("/")[-2])) @@ -41,7 +47,13 @@ async def check(userbot, client, link): async def get_msg(userbot, client, sender, edit_id, msg_link, i, bulk=False): edit = "" chat = "" - msg_id = int(msg_link.split("/")[-1]) + int(i) + msg_id = 0 + try: + msg_id = int(msg_link.split("/")[-1]) + except ValueError: + if '?single' in link: + link_ = msg_link.split("?single")[0] + msg_id = int(link_.split("/")[-1]) if 't.me/c/' in msg_link: chat = int('-100' + str(msg_link.split("/")[-2])) file = "" @@ -132,7 +144,6 @@ async def get_msg(userbot, client, sender, edit_id, msg_link, i, bulk=False): chat = msg_link.split("/")[-2] try: await client.copy_message(int(sender), chat, msg_id) - return None, None except FloodWait as fw: print(fw) if bulk is True: From e263e241061e85dd3ad75b2076b0ad2a95cd5a6d Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Mon, 12 Dec 2022 23:22:18 +0530 Subject: [PATCH 337/410] Update batch.py --- main/plugins/batch.py | 1 - 1 file changed, 1 deletion(-) diff --git a/main/plugins/batch.py b/main/plugins/batch.py index 0076a97ec..eeb9b5cb2 100644 --- a/main/plugins/batch.py +++ b/main/plugins/batch.py @@ -102,7 +102,6 @@ async def run_batch(userbot, client, sender, link, _range): await protection.delete() except Exception as e: print(e) - await client.send_message(sender, f"Error occured: {e}\n\nAction: **PASS**") pass From 09571ed113338d80061d7215060dca7db91d731e Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Mon, 12 Dec 2022 23:31:45 +0530 Subject: [PATCH 338/410] Update frontend.py --- main/plugins/frontend.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/main/plugins/frontend.py b/main/plugins/frontend.py index 21c3591ca..ec6b2b074 100644 --- a/main/plugins/frontend.py +++ b/main/plugins/frontend.py @@ -16,6 +16,10 @@ message = "Send me the message link you want to start saving from, as a reply to this message." +process=[] +timer=[] +user=[] + # To-Do: # Make these codes shorter and clean # ofc will never do it. @@ -37,10 +41,13 @@ async def clone(event): await event.reply(r) return edit = await event.reply("Processing!") + if f'{int(event.sender_id)}' in user: + return await edit.edit("Please don't spam links, wait until ongoing process is done.") + user.append(f'{int(event.sender_id)}') if 't.me/+' in link: q = await join(userbot, link) await edit.edit(q) - return if 't.me/' in link: await get_msg(userbot, Bot, event.sender_id, edit.id, link, 0) - + ind = user.index(f'{int(event.sender_id)}') + user.pop(int(ind)) From 6c0eb99ade7239264ed9d2d34bc1619bc0d7a1ad Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Tue, 13 Dec 2022 21:12:38 +0530 Subject: [PATCH 339/410] Update pyroplug.py --- main/plugins/pyroplug.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/plugins/pyroplug.py b/main/plugins/pyroplug.py index ba9c9efac..de87e654d 100644 --- a/main/plugins/pyroplug.py +++ b/main/plugins/pyroplug.py @@ -51,7 +51,7 @@ async def get_msg(userbot, client, sender, edit_id, msg_link, i, bulk=False): try: msg_id = int(msg_link.split("/")[-1]) except ValueError: - if '?single' in link: + if '?single' in msg_link: link_ = msg_link.split("?single")[0] msg_id = int(link_.split("/")[-1]) if 't.me/c/' in msg_link: From ad10ce30d9e84c733f805cbefec5da2f8f5a1a65 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Tue, 13 Dec 2022 21:22:29 +0530 Subject: [PATCH 340/410] Update pyroplug.py --- main/plugins/pyroplug.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/main/plugins/pyroplug.py b/main/plugins/pyroplug.py index de87e654d..fe76ac16e 100644 --- a/main/plugins/pyroplug.py +++ b/main/plugins/pyroplug.py @@ -27,6 +27,8 @@ async def check(userbot, client, link): if '?single' in link: link_ = link.split("?single")[0] msg_id = int(link_.split("/")[-1]) + else: + return False, "**Invalid Link!**" if 't.me/c/' in link: try: chat = int('-100' + str(link.split("/")[-2])) @@ -54,6 +56,8 @@ async def get_msg(userbot, client, sender, edit_id, msg_link, i, bulk=False): if '?single' in msg_link: link_ = msg_link.split("?single")[0] msg_id = int(link_.split("/")[-1]) + else: + return None, await client.edit_message_text(sender, edit_id, "**Invalid Link!**") if 't.me/c/' in msg_link: chat = int('-100' + str(msg_link.split("/")[-2])) file = "" From 09692e22f795395c2ff4d33b970ed949c8b4addf Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Tue, 13 Dec 2022 21:32:39 +0530 Subject: [PATCH 341/410] Update frontend.py --- main/plugins/frontend.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/main/plugins/frontend.py b/main/plugins/frontend.py index ec6b2b074..bc0c7f357 100644 --- a/main/plugins/frontend.py +++ b/main/plugins/frontend.py @@ -44,10 +44,14 @@ async def clone(event): if f'{int(event.sender_id)}' in user: return await edit.edit("Please don't spam links, wait until ongoing process is done.") user.append(f'{int(event.sender_id)}') - if 't.me/+' in link: - q = await join(userbot, link) - await edit.edit(q) - if 't.me/' in link: - await get_msg(userbot, Bot, event.sender_id, edit.id, link, 0) + try: + if 't.me/+' in link: + q = await join(userbot, link) + await edit.edit(q) + if 't.me/' in link: + await get_msg(userbot, Bot, event.sender_id, edit.id, link, 0) + except Exception as e: + print(e) + pass ind = user.index(f'{int(event.sender_id)}') user.pop(int(ind)) From a24311df401de1f60211a697cb13522245ef77c2 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Wed, 14 Dec 2022 00:14:37 +0530 Subject: [PATCH 342/410] Update batch.py --- main/plugins/batch.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/plugins/batch.py b/main/plugins/batch.py index eeb9b5cb2..378639670 100644 --- a/main/plugins/batch.py +++ b/main/plugins/batch.py @@ -102,6 +102,6 @@ async def run_batch(userbot, client, sender, link, _range): await protection.delete() except Exception as e: print(e) - pass + return From 9a70fef4e0fb9203e002a915ed6b64f95df0be33 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Wed, 14 Dec 2022 00:30:38 +0530 Subject: [PATCH 343/410] Update batch.py --- main/plugins/batch.py | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/main/plugins/batch.py b/main/plugins/batch.py index 378639670..2f4d67084 100644 --- a/main/plugins/batch.py +++ b/main/plugins/batch.py @@ -90,18 +90,13 @@ async def run_batch(userbot, client, sender, link, _range): timer = 2 else: timer = 3 - try: - er, out = await get_bulk_msg(userbot, client, sender, link, i) - if er == "FW": - fw_alert = await client.send_message(sender, f'Sleeping for {int(out)} second(s) due to telegram flooodwait.') - await asyncio.sleep(out) - await fw_alert.delete() - await get_bulk_msg(userbot, client, sender, link, i) - protection = await client.send_message(sender, f"Sleeping for `{timer}` seconds to avoid Floodwaits and Protect account!") - await asyncio.sleep(timer) - await protection.delete() - except Exception as e: - print(e) - return - - + er, out = await get_bulk_msg(userbot, client, sender, link, i) + if er == "FW": + fw_alert = await client.send_message(sender, f'Sleeping for {int(out)} second(s) due to telegram flooodwait.') + await asyncio.sleep(out) + await fw_alert.delete() + await get_bulk_msg(userbot, client, sender, link, i) + protection = await client.send_message(sender, f"Sleeping for `{timer}` seconds to avoid Floodwaits and Protect account!") + await asyncio.sleep(timer) + await protection.delete() + From 13f312c8617ffb2f676de4047044de576fff943b Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Wed, 14 Dec 2022 15:40:34 +0530 Subject: [PATCH 344/410] Update pyroplug.py --- main/plugins/pyroplug.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/main/plugins/pyroplug.py b/main/plugins/pyroplug.py index fe76ac16e..8257fa934 100644 --- a/main/plugins/pyroplug.py +++ b/main/plugins/pyroplug.py @@ -57,7 +57,7 @@ async def get_msg(userbot, client, sender, edit_id, msg_link, i, bulk=False): link_ = msg_link.split("?single")[0] msg_id = int(link_.split("/")[-1]) else: - return None, await client.edit_message_text(sender, edit_id, "**Invalid Link!**") + return True, await client.edit_message_text(sender, edit_id, "**Invalid Link!**") if 't.me/c/' in msg_link: chat = int('-100' + str(msg_link.split("/")[-2])) file = "" @@ -68,13 +68,13 @@ async def get_msg(userbot, client, sender, edit_id, msg_link, i, bulk=False): edit = await client.edit_message_text(sender, edit_id, "Cloning.") await client.send_message(sender, msg.text.markdown) await edit.delete() - return None, None + return True, None if not msg.media: if msg.text: edit = await client.edit_message_text(sender, edit_id, "Cloning.") await client.send_message(sender, msg.text.markdown) await edit.delete() - return None, None + return True, None edit = await client.edit_message_text(sender, edit_id, "Trying to Download.") file = await userbot.download_media( msg, @@ -129,20 +129,20 @@ async def get_msg(userbot, client, sender, edit_id, msg_link, i, bulk=False): ) os.remove(file) await edit.delete() - return None, None + return True, None except (ChannelBanned, ChannelInvalid, ChannelPrivate, ChatIdInvalid, ChatInvalid): await client.edit_message_text(sender, edit_id, "Have you joined the channel?") - return None, None + return True, None except FloodWait as fw: print(fw) if bulk is True: return "FW", int(fw.x) + 5 - return None, await client.edit_message_text(sender, edit_id, f'Try again after {fw.x} seconds due to floodwait from telegram.') + return True, await client.edit_message_text(sender, edit_id, f'Try again after {fw.x} seconds due to floodwait from telegram.') except Exception as e: print(e) await client.edit_message_text(sender, edit_id, f'Failed to save: `{msg_link}`') os.remove(file) - return None, None + return True, None else: edit = await client.edit_message_text(sender, edit_id, "Cloning.") chat = msg_link.split("/")[-2] @@ -152,12 +152,12 @@ async def get_msg(userbot, client, sender, edit_id, msg_link, i, bulk=False): print(fw) if bulk is True: return "FW", int(fw.x) + 5 - return None, await client.edit_message_text(sender, edit_id, f'Try again after {fw.x} seconds due to floodwait from telegram.') + return True, await client.edit_message_text(sender, edit_id, f'Try again after {fw.x} seconds due to floodwait from telegram.') except Exception as e: print(e) - return None, await client.edit_message_text(sender, edit_id, f'Failed to save: `{msg_link}`') + return True, await client.edit_message_text(sender, edit_id, f'Failed to save: `{msg_link}`') await edit.delete() - return None, None + return True, None async def get_bulk_msg(userbot, client, sender, msg_link, i): x = await client.send_message(sender, "Processing!") From c1b87e042a933c6028d3636fad50687688ad3c93 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Wed, 14 Dec 2022 15:45:12 +0530 Subject: [PATCH 345/410] Update batch.py --- main/plugins/batch.py | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/main/plugins/batch.py b/main/plugins/batch.py index 2f4d67084..ee2c601eb 100644 --- a/main/plugins/batch.py +++ b/main/plugins/batch.py @@ -90,13 +90,18 @@ async def run_batch(userbot, client, sender, link, _range): timer = 2 else: timer = 3 - er, out = await get_bulk_msg(userbot, client, sender, link, i) - if er == "FW": - fw_alert = await client.send_message(sender, f'Sleeping for {int(out)} second(s) due to telegram flooodwait.') - await asyncio.sleep(out) - await fw_alert.delete() - await get_bulk_msg(userbot, client, sender, link, i) - protection = await client.send_message(sender, f"Sleeping for `{timer}` seconds to avoid Floodwaits and Protect account!") - await asyncio.sleep(timer) - await protection.delete() - + try: + er, out = await get_bulk_msg(userbot, client, sender, link, i) + if er is not True: + if er == "FW": + fw_alert = await client.send_message(sender, f'Sleeping for {int(out)} second(s) due to telegram flooodwait.') + await asyncio.sleep(out) + await fw_alert.delete() + await get_bulk_msg(userbot, client, sender, link, i) + protection = await client.send_message(sender, f"Sleeping for `{timer}` seconds to avoid Floodwaits and Protect account!") + await asyncio.sleep(timer) + await protection.delete() + except Exception as e: + print(e) + pass + From b068f9c405860229b467a5ed1c35b1d6f6aecd8d Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Wed, 14 Dec 2022 15:59:38 +0530 Subject: [PATCH 346/410] Update batch.py --- main/plugins/batch.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/main/plugins/batch.py b/main/plugins/batch.py index ee2c601eb..4ccb14eb7 100644 --- a/main/plugins/batch.py +++ b/main/plugins/batch.py @@ -25,6 +25,7 @@ ft = f"To use this bot you've to join @{fs}." batch = [] +ids = [] async def get_pvt_content(event, chat, id): msg = await userbot.get_messages(chat, ids=id) @@ -77,7 +78,7 @@ async def _batch(event): async def run_batch(userbot, client, sender, link, _range): - for i in range(_range): + for i in range(len(ids)): timer = 60 if i < 25: timer = 5 @@ -91,16 +92,20 @@ async def run_batch(userbot, client, sender, link, _range): else: timer = 3 try: - er, out = await get_bulk_msg(userbot, client, sender, link, i) + integer = int(ids[i]) + er, out = await get_bulk_msg(userbot, client, sender, link, integer) if er is not True: if er == "FW": fw_alert = await client.send_message(sender, f'Sleeping for {int(out)} second(s) due to telegram flooodwait.') await asyncio.sleep(out) await fw_alert.delete() - await get_bulk_msg(userbot, client, sender, link, i) + await get_bulk_msg(userbot, client, sender, link, integer) protection = await client.send_message(sender, f"Sleeping for `{timer}` seconds to avoid Floodwaits and Protect account!") await asyncio.sleep(timer) await protection.delete() + except IndexError: + await client.send_message(sender, "Batch successfully completed!") + break except Exception as e: print(e) pass From 9b91ab7c8ea07b48c33f80fd2f399a7544bb4ebc Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Wed, 14 Dec 2022 20:26:23 +0530 Subject: [PATCH 347/410] Update batch.py --- main/plugins/batch.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/main/plugins/batch.py b/main/plugins/batch.py index 4ccb14eb7..411ff31bc 100644 --- a/main/plugins/batch.py +++ b/main/plugins/batch.py @@ -72,12 +72,17 @@ async def _batch(event): await conv.send_message(r) return batch.append(f'{event.sender_id}') - await run_batch(userbot, Bot, event.sender_id, _link, value) + cd = await conv.send_message("**Batch process ongoing.**\n\nProcess completed: 0", + buttons=[[Button.inline("CANCEL❌", data="cancel")]]) + await run_batch(userbot, Bot, event.sender_id, cd, _link, value) conv.cancel() batch.pop(0) - - -async def run_batch(userbot, client, sender, link, _range): + +@Drone.on(events.callbackquery.CallbackQuery(data="cancel")) +async def cancel(event): + ids.clear() + +async def run_batch(userbot, client, sender, countdown, link, _range): for i in range(len(ids)): timer = 60 if i < 25: @@ -101,12 +106,17 @@ async def run_batch(userbot, client, sender, link, _range): await fw_alert.delete() await get_bulk_msg(userbot, client, sender, link, integer) protection = await client.send_message(sender, f"Sleeping for `{timer}` seconds to avoid Floodwaits and Protect account!") + await countdown.edit(f"**Batch process ongoing.**\n\nProcess completed: {i+1}", + buttons=[[Button.inline("CANCEL❌", data="cancel")]]) await asyncio.sleep(timer) await protection.delete() except IndexError: await client.send_message(sender, "Batch successfully completed!") + await countdown.delete() break except Exception as e: print(e) + await countdown.edit(f"**Batch process ongoing.**\n\nProcess completed: {i+1}", + buttons=[[Button.inline("CANCEL❌", data="cancel")]]) pass From d24c6d44ec4f0fceac18734c05b6acabd31ba62e Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Thu, 15 Dec 2022 00:22:49 +0530 Subject: [PATCH 348/410] Update batch.py --- main/plugins/batch.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/main/plugins/batch.py b/main/plugins/batch.py index 411ff31bc..a2893c11e 100644 --- a/main/plugins/batch.py +++ b/main/plugins/batch.py @@ -67,6 +67,8 @@ async def _batch(event): return await conv.send_message("You can only get upto 100 files in a single batch.") except ValueError: return await conv.send_message("Range must be an integer!") + for i in range(value + 1): + ids.append(i) s, r = await check(userbot, Bot, _link) if s != True: await conv.send_message(r) @@ -74,7 +76,7 @@ async def _batch(event): batch.append(f'{event.sender_id}') cd = await conv.send_message("**Batch process ongoing.**\n\nProcess completed: 0", buttons=[[Button.inline("CANCEL❌", data="cancel")]]) - await run_batch(userbot, Bot, event.sender_id, cd, _link, value) + await run_batch(userbot, Bot, event.sender_id, cd, _link) conv.cancel() batch.pop(0) @@ -82,7 +84,7 @@ async def _batch(event): async def cancel(event): ids.clear() -async def run_batch(userbot, client, sender, countdown, link, _range): +async def run_batch(userbot, client, sender, countdown, link): for i in range(len(ids)): timer = 60 if i < 25: From 92d77ef2262d0dfc140c3017843b0597c1293617 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Thu, 15 Dec 2022 17:01:54 +0530 Subject: [PATCH 349/410] Update batch.py --- main/plugins/batch.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/main/plugins/batch.py b/main/plugins/batch.py index a2893c11e..3ca3e7336 100644 --- a/main/plugins/batch.py +++ b/main/plugins/batch.py @@ -102,11 +102,10 @@ async def run_batch(userbot, client, sender, countdown, link): integer = int(ids[i]) er, out = await get_bulk_msg(userbot, client, sender, link, integer) if er is not True: - if er == "FW": - fw_alert = await client.send_message(sender, f'Sleeping for {int(out)} second(s) due to telegram flooodwait.') - await asyncio.sleep(out) - await fw_alert.delete() - await get_bulk_msg(userbot, client, sender, link, integer) + fw_alert = await client.send_message(sender, f'Sleeping for {int(out)} second(s) due to telegram flooodwait.') + await asyncio.sleep(out) + await fw_alert.delete() + await get_bulk_msg(userbot, client, sender, link, integer) protection = await client.send_message(sender, f"Sleeping for `{timer}` seconds to avoid Floodwaits and Protect account!") await countdown.edit(f"**Batch process ongoing.**\n\nProcess completed: {i+1}", buttons=[[Button.inline("CANCEL❌", data="cancel")]]) From cb5da53a5b2bf84e157e4ae588dd51f6f7fa93fc Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Thu, 15 Dec 2022 17:03:03 +0530 Subject: [PATCH 350/410] Update batch.py --- main/plugins/batch.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/plugins/batch.py b/main/plugins/batch.py index 3ca3e7336..252178fc7 100644 --- a/main/plugins/batch.py +++ b/main/plugins/batch.py @@ -119,5 +119,5 @@ async def run_batch(userbot, client, sender, countdown, link): print(e) await countdown.edit(f"**Batch process ongoing.**\n\nProcess completed: {i+1}", buttons=[[Button.inline("CANCEL❌", data="cancel")]]) - pass + From 1b9f290cbfb082c868bb75d7f1c191666089674b Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Thu, 15 Dec 2022 17:07:09 +0530 Subject: [PATCH 351/410] Update pyroplug.py --- main/plugins/pyroplug.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/main/plugins/pyroplug.py b/main/plugins/pyroplug.py index 8257fa934..8ff638d71 100644 --- a/main/plugins/pyroplug.py +++ b/main/plugins/pyroplug.py @@ -99,7 +99,11 @@ async def get_msg(userbot, client, sender, edit_id, msg_link, i, bulk=False): duration = data["duration"] width = data["width"] height = data["height"] - thumb_path = await screenshot(file, duration, sender) + try: + thumb_path = await screenshot(file, duration, sender) + except Exception as e: + print(e) + thumb_path = None UT = time.time() uploader = await fast_upload(f'{file}', f'{file}', UT, bot, edit, '**UPLOADING:**') attributes = [DocumentAttributeVideo(duration=duration, w=width, h=height, supports_streaming=True)] From 986169de660b32e6523f4ebff0d673308257fb1f Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Tue, 20 Dec 2022 21:26:05 +0530 Subject: [PATCH 352/410] Update pyroplug.py --- main/plugins/pyroplug.py | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/main/plugins/pyroplug.py b/main/plugins/pyroplug.py index 8ff638d71..f7d6b574a 100644 --- a/main/plugins/pyroplug.py +++ b/main/plugins/pyroplug.py @@ -57,7 +57,8 @@ async def get_msg(userbot, client, sender, edit_id, msg_link, i, bulk=False): link_ = msg_link.split("?single")[0] msg_id = int(link_.split("/")[-1]) else: - return True, await client.edit_message_text(sender, edit_id, "**Invalid Link!**") + await client.edit_message_text(sender, edit_id, "**Invalid Link!**") + return None if 't.me/c/' in msg_link: chat = int('-100' + str(msg_link.split("/")[-2])) file = "" @@ -68,13 +69,13 @@ async def get_msg(userbot, client, sender, edit_id, msg_link, i, bulk=False): edit = await client.edit_message_text(sender, edit_id, "Cloning.") await client.send_message(sender, msg.text.markdown) await edit.delete() - return True, None + return None if not msg.media: if msg.text: edit = await client.edit_message_text(sender, edit_id, "Cloning.") await client.send_message(sender, msg.text.markdown) await edit.delete() - return True, None + return None edit = await client.edit_message_text(sender, edit_id, "Trying to Download.") file = await userbot.download_media( msg, @@ -133,20 +134,21 @@ async def get_msg(userbot, client, sender, edit_id, msg_link, i, bulk=False): ) os.remove(file) await edit.delete() - return True, None + return None except (ChannelBanned, ChannelInvalid, ChannelPrivate, ChatIdInvalid, ChatInvalid): await client.edit_message_text(sender, edit_id, "Have you joined the channel?") - return True, None + return None except FloodWait as fw: print(fw) if bulk is True: - return "FW", int(fw.x) + 5 - return True, await client.edit_message_text(sender, edit_id, f'Try again after {fw.x} seconds due to floodwait from telegram.') + return int(fw.x) + 5 + await client.edit_message_text(sender, edit_id, f'Try again after {fw.x} seconds due to floodwait from telegram.') + return None except Exception as e: print(e) await client.edit_message_text(sender, edit_id, f'Failed to save: `{msg_link}`') os.remove(file) - return True, None + return None else: edit = await client.edit_message_text(sender, edit_id, "Cloning.") chat = msg_link.split("/")[-2] @@ -155,13 +157,15 @@ async def get_msg(userbot, client, sender, edit_id, msg_link, i, bulk=False): except FloodWait as fw: print(fw) if bulk is True: - return "FW", int(fw.x) + 5 - return True, await client.edit_message_text(sender, edit_id, f'Try again after {fw.x} seconds due to floodwait from telegram.') + return int(fw.x) + 5 + await client.edit_message_text(sender, edit_id, f'Try again after {fw.x} seconds due to floodwait from telegram.') + return None except Exception as e: print(e) - return True, await client.edit_message_text(sender, edit_id, f'Failed to save: `{msg_link}`') + await client.edit_message_text(sender, edit_id, f'Failed to save: `{msg_link}`') + return None await edit.delete() - return True, None + return None async def get_bulk_msg(userbot, client, sender, msg_link, i): x = await client.send_message(sender, "Processing!") From bc8e22fc112bd710343e42ee01f3a591e56d11e0 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Tue, 20 Dec 2022 21:31:26 +0530 Subject: [PATCH 353/410] Update batch.py --- main/plugins/batch.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/main/plugins/batch.py b/main/plugins/batch.py index 252178fc7..79efddc77 100644 --- a/main/plugins/batch.py +++ b/main/plugins/batch.py @@ -100,14 +100,14 @@ async def run_batch(userbot, client, sender, countdown, link): timer = 3 try: integer = int(ids[i]) - er, out = await get_bulk_msg(userbot, client, sender, link, integer) - if er is not True: + out = await get_bulk_msg(userbot, client, sender, link, integer) + if out is not None: fw_alert = await client.send_message(sender, f'Sleeping for {int(out)} second(s) due to telegram flooodwait.') await asyncio.sleep(out) await fw_alert.delete() await get_bulk_msg(userbot, client, sender, link, integer) protection = await client.send_message(sender, f"Sleeping for `{timer}` seconds to avoid Floodwaits and Protect account!") - await countdown.edit(f"**Batch process ongoing.**\n\nProcess completed: {i+1}", + await countdown.edit(f"**Batch process ongoing.**\n\nProcess completed: {i}", buttons=[[Button.inline("CANCEL❌", data="cancel")]]) await asyncio.sleep(timer) await protection.delete() @@ -117,7 +117,7 @@ async def run_batch(userbot, client, sender, countdown, link): break except Exception as e: print(e) - await countdown.edit(f"**Batch process ongoing.**\n\nProcess completed: {i+1}", + await countdown.edit(f"**Batch process ongoing.**\n\nProcess completed: {i}", buttons=[[Button.inline("CANCEL❌", data="cancel")]]) From 1436bf396dcfd89f6f8e55150edd57501e46b9e4 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sat, 24 Dec 2022 21:26:40 +0530 Subject: [PATCH 354/410] Update batch.py --- main/plugins/batch.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/main/plugins/batch.py b/main/plugins/batch.py index 79efddc77..c1ac30be2 100644 --- a/main/plugins/batch.py +++ b/main/plugins/batch.py @@ -74,7 +74,7 @@ async def _batch(event): await conv.send_message(r) return batch.append(f'{event.sender_id}') - cd = await conv.send_message("**Batch process ongoing.**\n\nProcess completed: 0", + cd = await conv.send_message("**Batch process ongoing.**\n\nProcess completed: ", buttons=[[Button.inline("CANCEL❌", data="cancel")]]) await run_batch(userbot, Bot, event.sender_id, cd, _link) conv.cancel() @@ -107,7 +107,7 @@ async def run_batch(userbot, client, sender, countdown, link): await fw_alert.delete() await get_bulk_msg(userbot, client, sender, link, integer) protection = await client.send_message(sender, f"Sleeping for `{timer}` seconds to avoid Floodwaits and Protect account!") - await countdown.edit(f"**Batch process ongoing.**\n\nProcess completed: {i}", + await countdown.edit(count_down, buttons=[[Button.inline("CANCEL❌", data="cancel")]]) await asyncio.sleep(timer) await protection.delete() @@ -117,7 +117,6 @@ async def run_batch(userbot, client, sender, countdown, link): break except Exception as e: print(e) - await countdown.edit(f"**Batch process ongoing.**\n\nProcess completed: {i}", - buttons=[[Button.inline("CANCEL❌", data="cancel")]]) + if not countdown.text == count_down: + await countdown.edit(count_down, buttons=[[Button.inline("CANCEL❌", data="cancel")]]) - From 3c4377275f02e4def72997581b032eb761ccfeb6 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sat, 24 Dec 2022 21:28:10 +0530 Subject: [PATCH 355/410] Update batch.py --- main/plugins/batch.py | 1 + 1 file changed, 1 insertion(+) diff --git a/main/plugins/batch.py b/main/plugins/batch.py index c1ac30be2..443f36575 100644 --- a/main/plugins/batch.py +++ b/main/plugins/batch.py @@ -99,6 +99,7 @@ async def run_batch(userbot, client, sender, countdown, link): else: timer = 3 try: + count_down = f"**Batch process ongoing.**\n\nProcess completed: {i+1}" integer = int(ids[i]) out = await get_bulk_msg(userbot, client, sender, link, integer) if out is not None: From ee559f27003cc390cc1d279b4b5f34a27422cd3f Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sat, 24 Dec 2022 21:37:49 +0530 Subject: [PATCH 356/410] Update pyroplug.py --- main/plugins/pyroplug.py | 69 ++++++++++++++++++++++++++-------------- 1 file changed, 45 insertions(+), 24 deletions(-) diff --git a/main/plugins/pyroplug.py b/main/plugins/pyroplug.py index f7d6b574a..bbbbcff0c 100644 --- a/main/plugins/pyroplug.py +++ b/main/plugins/pyroplug.py @@ -9,9 +9,7 @@ from pyrogram import Client, filters from pyrogram.errors import ChannelBanned, ChannelInvalid, ChannelPrivate, ChatIdInvalid, ChatInvalid, FloodWait from ethon.pyfunc import video_metadata -from ethon.telefunc import fast_upload from telethon import events -from telethon.tl.types import DocumentAttributeVideo def thumbnail(sender): if os.path.exists(f'{sender}.jpg'): @@ -98,23 +96,42 @@ async def get_msg(userbot, client, sender, edit_id, msg_link, i, bulk=False): file = str(file).split(".")[0] + ".mp4" data = video_metadata(file) duration = data["duration"] - width = data["width"] - height = data["height"] try: thumb_path = await screenshot(file, duration, sender) - except Exception as e: - print(e) + except Exception: thumb_path = None - UT = time.time() - uploader = await fast_upload(f'{file}', f'{file}', UT, bot, edit, '**UPLOADING:**') - attributes = [DocumentAttributeVideo(duration=duration, w=width, h=height, supports_streaming=True)] - await bot.send_file( - sender, - uploader, - caption=caption, - thumb=thumb_path, - attributes=attributes, - force_document=False + await client.send_video( + chat_id=sender, + video=file, + caption=caption, + supports_streaming=True, + duration=duration, + thumb=thumb_path, + progress=progress_for_pyrogram, + progress_args=( + client, + '**UPLOADING:**\n', + edit, + time.time() + ) + ) + elif str(file).split(".")[-1] in ['jpg', 'jpeg', 'png', 'webp']: + await edit.edit("Uploading photo.") + await bot.send_file(sender, file, caption=caption) + else: + thumb_path=thumbnail(sender) + await client.send_document( + sender, + file, + caption=caption, + thumb=thumb_path, + progress=progress_for_pyrogram, + progress_args=( + client, + '**UPLOADING:**\n', + edit, + time.time() + ) ) os.remove(file) elif str(file).split(".")[-1] in ['jpg', 'jpeg', 'png', 'webp']: @@ -123,14 +140,18 @@ async def get_msg(userbot, client, sender, edit_id, msg_link, i, bulk=False): os.remove(file) else: thumb_path=thumbnail(sender) - UT = time.time() - uploader = await fast_upload(f'{file}', f'{file}', UT, bot, edit, '**UPLOADING:**') - await bot.send_file( - sender, - uploader, - caption=caption, - thumb=thumb_path, - force_document=True + await client.send_document( + sender, + file, + caption=caption, + thumb=thumb_path, + progress=progress_for_pyrogram, + progress_args=( + client, + '**UPLOADING:**\n', + edit, + time.time() + ) ) os.remove(file) await edit.delete() From 6c8925e457951e5b071ed9318445b4ea7b984b7a Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sat, 24 Dec 2022 21:53:48 +0530 Subject: [PATCH 357/410] Update pyroplug.py --- main/plugins/pyroplug.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/plugins/pyroplug.py b/main/plugins/pyroplug.py index bbbbcff0c..a36ae7ebc 100644 --- a/main/plugins/pyroplug.py +++ b/main/plugins/pyroplug.py @@ -115,7 +115,7 @@ async def get_msg(userbot, client, sender, edit_id, msg_link, i, bulk=False): time.time() ) ) - elif str(file).split(".")[-1] in ['jpg', 'jpeg', 'png', 'webp']: + if str(file).split(".")[-1] in ['jpg', 'jpeg', 'png', 'webp']: await edit.edit("Uploading photo.") await bot.send_file(sender, file, caption=caption) else: From f5bcfd1516339bcef3bb433560968e8d499188f9 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sat, 24 Dec 2022 22:14:21 +0530 Subject: [PATCH 358/410] Syntax error --- main/plugins/pyroplug.py | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) diff --git a/main/plugins/pyroplug.py b/main/plugins/pyroplug.py index a36ae7ebc..664afc20f 100644 --- a/main/plugins/pyroplug.py +++ b/main/plugins/pyroplug.py @@ -115,29 +115,9 @@ async def get_msg(userbot, client, sender, edit_id, msg_link, i, bulk=False): time.time() ) ) - if str(file).split(".")[-1] in ['jpg', 'jpeg', 'png', 'webp']: - await edit.edit("Uploading photo.") - await bot.send_file(sender, file, caption=caption) - else: - thumb_path=thumbnail(sender) - await client.send_document( - sender, - file, - caption=caption, - thumb=thumb_path, - progress=progress_for_pyrogram, - progress_args=( - client, - '**UPLOADING:**\n', - edit, - time.time() - ) - ) - os.remove(file) elif str(file).split(".")[-1] in ['jpg', 'jpeg', 'png', 'webp']: await edit.edit("Uploading photo.") await bot.send_file(sender, file, caption=caption) - os.remove(file) else: thumb_path=thumbnail(sender) await client.send_document( @@ -153,7 +133,7 @@ async def get_msg(userbot, client, sender, edit_id, msg_link, i, bulk=False): time.time() ) ) - os.remove(file) + os.remove(file) await edit.delete() return None except (ChannelBanned, ChannelInvalid, ChannelPrivate, ChatIdInvalid, ChatInvalid): From 8674bb8bfbeea3d4a66f3c4d896e7953e00055b1 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sun, 25 Dec 2022 13:10:38 +0530 Subject: [PATCH 359/410] Update batch.py --- main/plugins/batch.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main/plugins/batch.py b/main/plugins/batch.py index 443f36575..e2a555b1f 100644 --- a/main/plugins/batch.py +++ b/main/plugins/batch.py @@ -102,7 +102,7 @@ async def run_batch(userbot, client, sender, countdown, link): count_down = f"**Batch process ongoing.**\n\nProcess completed: {i+1}" integer = int(ids[i]) out = await get_bulk_msg(userbot, client, sender, link, integer) - if out is not None: + if not out == None: fw_alert = await client.send_message(sender, f'Sleeping for {int(out)} second(s) due to telegram flooodwait.') await asyncio.sleep(out) await fw_alert.delete() @@ -120,4 +120,4 @@ async def run_batch(userbot, client, sender, countdown, link): print(e) if not countdown.text == count_down: await countdown.edit(count_down, buttons=[[Button.inline("CANCEL❌", data="cancel")]]) - + return From 9e1d52cb5421da7699f296c87bc02d9520e9bc66 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sun, 25 Dec 2022 15:50:38 +0530 Subject: [PATCH 360/410] Update pyroplug.py --- main/plugins/pyroplug.py | 28 +++------------------------- 1 file changed, 3 insertions(+), 25 deletions(-) diff --git a/main/plugins/pyroplug.py b/main/plugins/pyroplug.py index 664afc20f..f286b7832 100644 --- a/main/plugins/pyroplug.py +++ b/main/plugins/pyroplug.py @@ -44,7 +44,7 @@ async def check(userbot, client, link): except Exception: return False, "Maybe bot is banned from the chat, or your link is invalid!" -async def get_msg(userbot, client, sender, edit_id, msg_link, i, bulk=False): +async def get_msg(userbot, client, sender, edit_id, msg_link, i): edit = "" chat = "" msg_id = 0 @@ -139,35 +139,13 @@ async def get_msg(userbot, client, sender, edit_id, msg_link, i, bulk=False): except (ChannelBanned, ChannelInvalid, ChannelPrivate, ChatIdInvalid, ChatInvalid): await client.edit_message_text(sender, edit_id, "Have you joined the channel?") return None - except FloodWait as fw: - print(fw) - if bulk is True: - return int(fw.x) + 5 - await client.edit_message_text(sender, edit_id, f'Try again after {fw.x} seconds due to floodwait from telegram.') - return None - except Exception as e: - print(e) - await client.edit_message_text(sender, edit_id, f'Failed to save: `{msg_link}`') - os.remove(file) - return None else: edit = await client.edit_message_text(sender, edit_id, "Cloning.") chat = msg_link.split("/")[-2] - try: - await client.copy_message(int(sender), chat, msg_id) - except FloodWait as fw: - print(fw) - if bulk is True: - return int(fw.x) + 5 - await client.edit_message_text(sender, edit_id, f'Try again after {fw.x} seconds due to floodwait from telegram.') - return None - except Exception as e: - print(e) - await client.edit_message_text(sender, edit_id, f'Failed to save: `{msg_link}`') - return None + await client.copy_message(int(sender), chat, msg_id) await edit.delete() return None async def get_bulk_msg(userbot, client, sender, msg_link, i): x = await client.send_message(sender, "Processing!") - await get_msg(userbot, client, sender, x.message_id, msg_link, i, bulk=True) + await get_msg(userbot, client, sender, x.message_id, msg_link, i) From 7b2c68127f818c61e04410ffe9af95188d391af0 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sun, 25 Dec 2022 15:59:55 +0530 Subject: [PATCH 361/410] Update frontend.py --- main/plugins/frontend.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/main/plugins/frontend.py b/main/plugins/frontend.py index bc0c7f357..153d5bccc 100644 --- a/main/plugins/frontend.py +++ b/main/plugins/frontend.py @@ -9,6 +9,7 @@ from main.plugins.helpers import get_link, join, screenshot from telethon import events +from pyrogram.errors import FloodWait from ethon.telefunc import force_sub @@ -50,8 +51,10 @@ async def clone(event): await edit.edit(q) if 't.me/' in link: await get_msg(userbot, Bot, event.sender_id, edit.id, link, 0) + except FloodWait as fw: + await Drone.send_message(event.sender_id, f'Try again after {fw.x} seconds due to floodwait from telegram.') except Exception as e: print(e) - pass + await Drone.send_message(event.sender_id, f"An error occurred during cloning of `{link}`\n\n**Error:** {str(e)}") ind = user.index(f'{int(event.sender_id)}') user.pop(int(ind)) From 1c6ea280a6675fc14cdb4cc48fd87a24d1e82b44 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sun, 25 Dec 2022 16:12:15 +0530 Subject: [PATCH 362/410] Update batch.py --- main/plugins/batch.py | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/main/plugins/batch.py b/main/plugins/batch.py index e2a555b1f..81f86f3c3 100644 --- a/main/plugins/batch.py +++ b/main/plugins/batch.py @@ -78,7 +78,8 @@ async def _batch(event): buttons=[[Button.inline("CANCEL❌", data="cancel")]]) await run_batch(userbot, Bot, event.sender_id, cd, _link) conv.cancel() - batch.pop(0) + ids.clear() + batch.clear() @Drone.on(events.callbackquery.CallbackQuery(data="cancel")) async def cancel(event): @@ -101,12 +102,7 @@ async def run_batch(userbot, client, sender, countdown, link): try: count_down = f"**Batch process ongoing.**\n\nProcess completed: {i+1}" integer = int(ids[i]) - out = await get_bulk_msg(userbot, client, sender, link, integer) - if not out == None: - fw_alert = await client.send_message(sender, f'Sleeping for {int(out)} second(s) due to telegram flooodwait.') - await asyncio.sleep(out) - await fw_alert.delete() - await get_bulk_msg(userbot, client, sender, link, integer) + await get_bulk_msg(userbot, client, sender, link, integer) protection = await client.send_message(sender, f"Sleeping for `{timer}` seconds to avoid Floodwaits and Protect account!") await countdown.edit(count_down, buttons=[[Button.inline("CANCEL❌", data="cancel")]]) @@ -116,8 +112,24 @@ async def run_batch(userbot, client, sender, countdown, link): await client.send_message(sender, "Batch successfully completed!") await countdown.delete() break + except Floodwait as fw: + if int(fw.x) > 300: + await client.send_message(sender, f'You have floodwaits of {fw.x} seconds, cancelling batch') + ids.clear() + break + else: + fw_alert = await client.send_message(sender, f'Sleeping for {fw.x + 5} second(s) due to telegram flooodwait.') + await asyncio.sleep(out) + await fw_alert.delete() + try: + await get_bulk_msg(userbot, client, sender, link, integer) + except Exception as e: + print(e) + if not countdown.text == count_down: + await countdown.edit(count_down, buttons=[[Button.inline("CANCEL❌", data="cancel")]]) except Exception as e: print(e) + await client.send_message(sender, f"An error occurred during cloning, batch will continue.\n\n**Error:** {str(e)}") if not countdown.text == count_down: await countdown.edit(count_down, buttons=[[Button.inline("CANCEL❌", data="cancel")]]) - return + From 84541a49cc70672ce832c8ca7450bef028fc1197 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Wed, 28 Dec 2022 23:18:23 +0530 Subject: [PATCH 363/410] Update pyroplug.py --- main/plugins/pyroplug.py | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/main/plugins/pyroplug.py b/main/plugins/pyroplug.py index f286b7832..2a6367033 100644 --- a/main/plugins/pyroplug.py +++ b/main/plugins/pyroplug.py @@ -44,7 +44,7 @@ async def check(userbot, client, link): except Exception: return False, "Maybe bot is banned from the chat, or your link is invalid!" -async def get_msg(userbot, client, sender, edit_id, msg_link, i): +async def get_msg(userbot, client, sender, edit_id, msg_link, i, bulk=False): edit = "" chat = "" msg_id = 0 @@ -139,13 +139,37 @@ async def get_msg(userbot, client, sender, edit_id, msg_link, i): except (ChannelBanned, ChannelInvalid, ChannelPrivate, ChatIdInvalid, ChatInvalid): await client.edit_message_text(sender, edit_id, "Have you joined the channel?") return None + except FloodWait as fw: + print(fw) + if bulk is True: + return int(fw.x) + 5 + else: + await client.edit_message_text(sender, edit_id, f'Try again after {fw.x} seconds due to floodwait from telegram.') + return None + except Exception as e: + print(e) + await client.edit_message_text(sender, edit_id, f'Failed to save: `{msg_link}`') + os.remove(file) + return None else: edit = await client.edit_message_text(sender, edit_id, "Cloning.") chat = msg_link.split("/")[-2] - await client.copy_message(int(sender), chat, msg_id) + try: + await client.copy_message(int(sender), chat, msg_id) + except FloodWait as fw: + print(fw) + if bulk is True: + return int(fw.x) + 5 + else: + await client.edit_message_text(sender, edit_id, f'Try again after {fw.x} seconds due to floodwait from telegram.') + return None + except Exception as e: + print(e) + await client.edit_message_text(sender, edit_id, f'Failed to save: `{msg_link}`') + return None await edit.delete() - return None + return None async def get_bulk_msg(userbot, client, sender, msg_link, i): x = await client.send_message(sender, "Processing!") - await get_msg(userbot, client, sender, x.message_id, msg_link, i) + await get_msg(userbot, client, sender, x.message_id, msg_link, i, bulk=True) From ad43543a5217f58a033fca7e1e8635152aed9243 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Wed, 28 Dec 2022 23:29:14 +0530 Subject: [PATCH 364/410] Update pyroplug.py --- main/plugins/pyroplug.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/main/plugins/pyroplug.py b/main/plugins/pyroplug.py index 2a6367033..b36de40c1 100644 --- a/main/plugins/pyroplug.py +++ b/main/plugins/pyroplug.py @@ -149,7 +149,8 @@ async def get_msg(userbot, client, sender, edit_id, msg_link, i, bulk=False): except Exception as e: print(e) await client.edit_message_text(sender, edit_id, f'Failed to save: `{msg_link}`') - os.remove(file) + if os.path.isfile(file) == True: + os.remove(file) return None else: edit = await client.edit_message_text(sender, edit_id, "Cloning.") From 402068088d2226d404b1f46f6b6222b2c76c67a2 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Wed, 28 Dec 2022 23:55:21 +0530 Subject: [PATCH 365/410] Update batch.py --- main/plugins/batch.py | 55 ++++++++++++++++++------------------------- 1 file changed, 23 insertions(+), 32 deletions(-) diff --git a/main/plugins/batch.py b/main/plugins/batch.py index 81f86f3c3..5500bd2d5 100644 --- a/main/plugins/batch.py +++ b/main/plugins/batch.py @@ -25,7 +25,7 @@ ft = f"To use this bot you've to join @{fs}." batch = [] -ids = [] +batch_ = [] async def get_pvt_content(event, chat, id): msg = await userbot.get_messages(chat, ids=id) @@ -67,26 +67,24 @@ async def _batch(event): return await conv.send_message("You can only get upto 100 files in a single batch.") except ValueError: return await conv.send_message("Range must be an integer!") - for i in range(value + 1): - ids.append(i) - s, r = await check(userbot, Bot, _link) if s != True: await conv.send_message(r) return batch.append(f'{event.sender_id}') + batch_.append(f'{event.sender_id}') cd = await conv.send_message("**Batch process ongoing.**\n\nProcess completed: ", buttons=[[Button.inline("CANCEL❌", data="cancel")]]) - await run_batch(userbot, Bot, event.sender_id, cd, _link) + await run_batch(userbot, Bot, event.sender_id, value, cd, _link) conv.cancel() - ids.clear() batch.clear() - + batch_.clear() + @Drone.on(events.callbackquery.CallbackQuery(data="cancel")) async def cancel(event): - ids.clear() + batch_.clear() -async def run_batch(userbot, client, sender, countdown, link): - for i in range(len(ids)): +async def run_batch(userbot, client, sender, range_, countdown, link): + for i in range(range_ + 1): timer = 60 if i < 25: timer = 5 @@ -100,36 +98,29 @@ async def run_batch(userbot, client, sender, countdown, link): else: timer = 3 try: + check_ = batch_[0] count_down = f"**Batch process ongoing.**\n\nProcess completed: {i+1}" - integer = int(ids[i]) - await get_bulk_msg(userbot, client, sender, link, integer) + out = await get_bulk_msg(userbot, client, sender, link, i) + if not out == None: + if out - 5 > 300: + await client.send_message(sender, f'You have floodwaits of {out - 5} seconds, cancelling batch') + batch_.clear() + break + else: + fw_alert = await client.send_message(sender, f'Sleeping for {out} second(s) due to telegram flooodwait.') + await asyncio.sleep(out) + await fw_alert.delete() + await get_bulk_msg(userbot, client, sender, link, i) protection = await client.send_message(sender, f"Sleeping for `{timer}` seconds to avoid Floodwaits and Protect account!") - await countdown.edit(count_down, - buttons=[[Button.inline("CANCEL❌", data="cancel")]]) + await countdown.edit(count_down) await asyncio.sleep(timer) await protection.delete() except IndexError: await client.send_message(sender, "Batch successfully completed!") await countdown.delete() break - except Floodwait as fw: - if int(fw.x) > 300: - await client.send_message(sender, f'You have floodwaits of {fw.x} seconds, cancelling batch') - ids.clear() - break - else: - fw_alert = await client.send_message(sender, f'Sleeping for {fw.x + 5} second(s) due to telegram flooodwait.') - await asyncio.sleep(out) - await fw_alert.delete() - try: - await get_bulk_msg(userbot, client, sender, link, integer) - except Exception as e: - print(e) - if not countdown.text == count_down: - await countdown.edit(count_down, buttons=[[Button.inline("CANCEL❌", data="cancel")]]) except Exception as e: print(e) - await client.send_message(sender, f"An error occurred during cloning, batch will continue.\n\n**Error:** {str(e)}") if not countdown.text == count_down: - await countdown.edit(count_down, buttons=[[Button.inline("CANCEL❌", data="cancel")]]) - + await countdown.edit(count_down) + From ad40acbdefbeb466f2b5518c784472f29f1a3ad5 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Thu, 9 Mar 2023 20:41:30 +0530 Subject: [PATCH 366/410] Update requirements.txt --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index e0df30062..2ff2e4a97 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,7 +1,7 @@ #Github.com-Vasusen-code https://github.com/vasusen-code/Telethon/archive/refs/tags/v1.24.0.zip -ethon==1.3.8 +ethon==0.1.1 cryptg tgcrypto pyrogram==1.4.16 From 477ef73037e402c885d7c81966f9d39a38b18b5c Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Thu, 9 Mar 2023 22:45:00 +0530 Subject: [PATCH 367/410] Update requirements.txt --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 2ff2e4a97..9498c4d79 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,7 +1,7 @@ #Github.com-Vasusen-code https://github.com/vasusen-code/Telethon/archive/refs/tags/v1.24.0.zip -ethon==0.1.1 +ethon==0.1.2 cryptg tgcrypto pyrogram==1.4.16 From f81cec81ca6021009c73cb58be57629f1ed8a64f Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sat, 13 May 2023 11:53:03 +0530 Subject: [PATCH 368/410] Update batch.py --- main/plugins/batch.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/main/plugins/batch.py b/main/plugins/batch.py index 5500bd2d5..f4254c1bd 100644 --- a/main/plugins/batch.py +++ b/main/plugins/batch.py @@ -25,7 +25,6 @@ ft = f"To use this bot you've to join @{fs}." batch = [] -batch_ = [] async def get_pvt_content(event, chat, id): msg = await userbot.get_messages(chat, ids=id) @@ -71,17 +70,15 @@ async def _batch(event): await conv.send_message(r) return batch.append(f'{event.sender_id}') - batch_.append(f'{event.sender_id}') cd = await conv.send_message("**Batch process ongoing.**\n\nProcess completed: ", buttons=[[Button.inline("CANCEL❌", data="cancel")]]) await run_batch(userbot, Bot, event.sender_id, value, cd, _link) conv.cancel() batch.clear() - batch_.clear() @Drone.on(events.callbackquery.CallbackQuery(data="cancel")) async def cancel(event): - batch_.clear() + batch.clear() async def run_batch(userbot, client, sender, range_, countdown, link): for i in range(range_ + 1): From bcb7e5c21b82f0c226344ad28cbc6db56200610d Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sat, 13 May 2023 11:55:51 +0530 Subject: [PATCH 369/410] Update pyroplug.py --- main/plugins/pyroplug.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main/plugins/pyroplug.py b/main/plugins/pyroplug.py index b36de40c1..b11d06bc0 100644 --- a/main/plugins/pyroplug.py +++ b/main/plugins/pyroplug.py @@ -159,14 +159,14 @@ async def get_msg(userbot, client, sender, edit_id, msg_link, i, bulk=False): await client.copy_message(int(sender), chat, msg_id) except FloodWait as fw: print(fw) - if bulk is True: + if bulk == True: return int(fw.x) + 5 else: await client.edit_message_text(sender, edit_id, f'Try again after {fw.x} seconds due to floodwait from telegram.') return None except Exception as e: print(e) - await client.edit_message_text(sender, edit_id, f'Failed to save: `{msg_link}`') + await client.edit_message_text(sender, edit_id, f'Failed to save: `{msg_link}`\n**Error:** str(e)') return None await edit.delete() return None From bb82a5cded2abf0d33e2e0e8c5a26289d5019f4d Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sat, 13 May 2023 12:04:51 +0530 Subject: [PATCH 370/410] Update batch.py --- main/plugins/batch.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/main/plugins/batch.py b/main/plugins/batch.py index f4254c1bd..f4277bb58 100644 --- a/main/plugins/batch.py +++ b/main/plugins/batch.py @@ -95,13 +95,13 @@ async def run_batch(userbot, client, sender, range_, countdown, link): else: timer = 3 try: - check_ = batch_[0] + check_ = batch[0] count_down = f"**Batch process ongoing.**\n\nProcess completed: {i+1}" out = await get_bulk_msg(userbot, client, sender, link, i) - if not out == None: + if out != None: if out - 5 > 300: await client.send_message(sender, f'You have floodwaits of {out - 5} seconds, cancelling batch') - batch_.clear() + batch.clear() break else: fw_alert = await client.send_message(sender, f'Sleeping for {out} second(s) due to telegram flooodwait.') @@ -118,6 +118,7 @@ async def run_batch(userbot, client, sender, range_, countdown, link): break except Exception as e: print(e) - if not countdown.text == count_down: + if countdown.text != count_down: await countdown.edit(count_down) + continue From 6dc1791639037bdb7b411338389acaa494aebec5 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sat, 13 May 2023 12:05:53 +0530 Subject: [PATCH 371/410] Update pyroplug.py --- main/plugins/pyroplug.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/main/plugins/pyroplug.py b/main/plugins/pyroplug.py index b11d06bc0..a7f30cf9a 100644 --- a/main/plugins/pyroplug.py +++ b/main/plugins/pyroplug.py @@ -173,4 +173,5 @@ async def get_msg(userbot, client, sender, edit_id, msg_link, i, bulk=False): async def get_bulk_msg(userbot, client, sender, msg_link, i): x = await client.send_message(sender, "Processing!") - await get_msg(userbot, client, sender, x.message_id, msg_link, i, bulk=True) + ok = await get_msg(userbot, client, sender, x.message_id, msg_link, i, bulk=True) + return ok From bb8a8caed83dc3afe01bf9bdf06944f8fedac019 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sat, 13 May 2023 12:06:29 +0530 Subject: [PATCH 372/410] Update batch.py --- main/plugins/batch.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/plugins/batch.py b/main/plugins/batch.py index f4277bb58..b8a537bf5 100644 --- a/main/plugins/batch.py +++ b/main/plugins/batch.py @@ -120,5 +120,5 @@ async def run_batch(userbot, client, sender, range_, countdown, link): print(e) if countdown.text != count_down: await countdown.edit(count_down) - continue + From bc73cb7fb893b72d733259747d184722aa734ab8 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sun, 28 May 2023 15:05:52 +0530 Subject: [PATCH 373/410] Update pyroplug.py --- main/plugins/pyroplug.py | 215 +++++++++++++++++++++++---------------- 1 file changed, 130 insertions(+), 85 deletions(-) diff --git a/main/plugins/pyroplug.py b/main/plugins/pyroplug.py index a7f30cf9a..cd59f5498 100644 --- a/main/plugins/pyroplug.py +++ b/main/plugins/pyroplug.py @@ -1,14 +1,17 @@ # Github.com/Vasusen-code +from .. import bot as Drone import asyncio, time, os -from .. import Bot, bot from main.plugins.progress import progress_for_pyrogram from main.plugins.helpers import screenshot from pyrogram import Client, filters -from pyrogram.errors import ChannelBanned, ChannelInvalid, ChannelPrivate, ChatIdInvalid, ChatInvalid, FloodWait +from pyrogram.errors import ChannelBanned, ChannelInvalid, ChannelPrivate, ChatIdInvalid, ChatInvalid +from pyrogram.enums import MessageMediaType, ChatType from ethon.pyfunc import video_metadata +from ethon.telefunc import fast_upload +from telethon.tl.types import DocumentAttributeVideo from telethon import events def thumbnail(sender): @@ -17,63 +20,34 @@ def thumbnail(sender): else: return None -async def check(userbot, client, link): - msg_id = 0 - try: - msg_id = int(link.split("/")[-1]) - except ValueError: - if '?single' in link: - link_ = link.split("?single")[0] - msg_id = int(link_.split("/")[-1]) - else: - return False, "**Invalid Link!**" - if 't.me/c/' in link: - try: - chat = int('-100' + str(link.split("/")[-2])) - await userbot.get_messages(chat, msg_id) - return True, None - except ValueError: - return False, "**Invalid Link!**" - except Exception: - return False, "Have you joined the channel?" - else: - try: - chat = str(link.split("/")[-2]) - await client.get_messages(chat, msg_id) - return True, None - except Exception: - return False, "Maybe bot is banned from the chat, or your link is invalid!" - -async def get_msg(userbot, client, sender, edit_id, msg_link, i, bulk=False): +async def get_msg(userbot, client, bot, sender, to, edit_id, msg_link, i): edit = "" chat = "" - msg_id = 0 - try: - msg_id = int(msg_link.split("/")[-1]) - except ValueError: - if '?single' in msg_link: - link_ = msg_link.split("?single")[0] - msg_id = int(link_.split("/")[-1]) + round_message = False + if "?single" in msg_link: + msg_link = msg_link.split("?single")[0] + msg_id = int(msg_link.split("/")[-1]) + int(i) + height, width, duration, thumb_path = 90, 90, 0, None + if 't.me/c/' in msg_link or 't.me/b/' in msg_link: + if 't.me/b/' in msg_link: + chat = str(msg_link.split("/")[-2]) else: - await client.edit_message_text(sender, edit_id, "**Invalid Link!**") - return None - if 't.me/c/' in msg_link: - chat = int('-100' + str(msg_link.split("/")[-2])) + chat = int('-100' + str(msg_link.split("/")[-2])) file = "" try: msg = await userbot.get_messages(chat, msg_id) if msg.media: - if 'web_page' in msg.media: + if msg.media==MessageMediaType.WEB_PAGE: edit = await client.edit_message_text(sender, edit_id, "Cloning.") - await client.send_message(sender, msg.text.markdown) + await client.send_message(to, msg.text.markdown) await edit.delete() - return None + return if not msg.media: if msg.text: edit = await client.edit_message_text(sender, edit_id, "Cloning.") - await client.send_message(sender, msg.text.markdown) + await client.send_message(to, msg.text.markdown) await edit.delete() - return None + return edit = await client.edit_message_text(sender, edit_id, "Trying to Download.") file = await userbot.download_media( msg, @@ -85,27 +59,49 @@ async def get_msg(userbot, client, sender, edit_id, msg_link, i, bulk=False): time.time() ) ) + print(file) await edit.edit('Preparing to Upload!') - caption = str(file) + caption = None if msg.caption is not None: caption = msg.caption - if str(file).split(".")[-1] in ['mkv', 'mp4', 'webm', 'mpe4', 'mpeg']: - if str(file).split(".")[-1] in ['webm', 'mkv', 'mpe4', 'mpeg']: - path = str(file).split(".")[0] + ".mp4" - os.rename(file, path) - file = str(file).split(".")[0] + ".mp4" + if msg.media==MessageMediaType.VIDEO_NOTE: + round_message = True + print("Trying to get metadata") + data = video_metadata(file) + height, width, duration = data["height"], data["width"], data["duration"] + print(f'd: {duration}, w: {width}, h:{height}') + try: + thumb_path = await screenshot(file, duration, sender) + except Exception: + thumb_path = None + await client.send_video_note( + chat_id=to, + video_note=file, + length=height, duration=duration, + thumb=thumb_path, + progress=progress_for_pyrogram, + progress_args=( + client, + '**UPLOADING:**\n', + edit, + time.time() + ) + ) + elif msg.media==MessageMediaType.VIDEO and msg.video.mime_type in ["video/mp4", "video/x-matroska"]: + print("Trying to get metadata") data = video_metadata(file) - duration = data["duration"] + height, width, duration = data["height"], data["width"], data["duration"] + print(f'd: {duration}, w: {width}, h:{height}') try: thumb_path = await screenshot(file, duration, sender) except Exception: thumb_path = None await client.send_video( - chat_id=sender, + chat_id=to, video=file, caption=caption, supports_streaming=True, - duration=duration, + height=height, width=width, duration=duration, thumb=thumb_path, progress=progress_for_pyrogram, progress_args=( @@ -115,13 +111,14 @@ async def get_msg(userbot, client, sender, edit_id, msg_link, i, bulk=False): time.time() ) ) - elif str(file).split(".")[-1] in ['jpg', 'jpeg', 'png', 'webp']: + + elif msg.media==MessageMediaType.PHOTO: await edit.edit("Uploading photo.") - await bot.send_file(sender, file, caption=caption) + await bot.send_file(to, file, caption=caption) else: thumb_path=thumbnail(sender) await client.send_document( - sender, + to, file, caption=caption, thumb=thumb_path, @@ -133,45 +130,93 @@ async def get_msg(userbot, client, sender, edit_id, msg_link, i, bulk=False): time.time() ) ) - os.remove(file) + try: + os.remove(file) + if os.path.isfile(file) == True: + os.remove(file) + except Exception as e: + print(e) await edit.delete() - return None except (ChannelBanned, ChannelInvalid, ChannelPrivate, ChatIdInvalid, ChatInvalid): await client.edit_message_text(sender, edit_id, "Have you joined the channel?") - return None - except FloodWait as fw: - print(fw) - if bulk is True: - return int(fw.x) + 5 - else: - await client.edit_message_text(sender, edit_id, f'Try again after {fw.x} seconds due to floodwait from telegram.') - return None + return except Exception as e: print(e) - await client.edit_message_text(sender, edit_id, f'Failed to save: `{msg_link}`') + if "messages.SendMedia" in str(e): + try: + if msg.media==MessageMediaType.VIDEO and msg.video.mime_type in ["video/mp4", "video/x-matroska"]: + UT = time.time() + uploader = await fast_upload(f'{file}', f'{file}', UT, bot, edit, '**UPLOADING:**') + attributes = [DocumentAttributeVideo(duration=duration, w=width, h=height, round_message=round_message, supports_streaming=True)] + await bot.send_file(to, uploader, caption=caption, thumb=thumb_path, attributes=attributes, force_document=False) + elif msg.media==MessageMediaType.VIDEO_NOTE: + uploader = await fast_upload(f'{file}', f'{file}', UT, bot, edit, '**UPLOADING:**') + attributes = [DocumentAttributeVideo(duration=duration, w=width, h=height, round_message=round_message, supports_streaming=True)] + await bot.send_file(to, uploader, caption=caption, thumb=thumb_path, attributes=attributes, force_document=False) + else: + UT = time.time() + uploader = await fast_upload(f'{file}', f'{file}', UT, bot, edit, '**UPLOADING:**') + await bot.send_file(to, uploader, caption=caption, thumb=thumb_path, force_document=True) + if os.path.isfile(file) == True: + os.remove(file) + except Exception as e: + print(e) + await client.edit_message_text(sender, edit_id, f'Failed to save: `{msg_link}`\n\nError: {str(e)}') + try: + os.remove(file) + except Exception: + return + return + elif "SaveBigFilePartRequest" in str(e): + try: + if msg.media==MessageMediaType.VIDEO and msg.video.mime_type in ["video/mp4", "video/x-matroska"]: + UT = time.time() + uploader = await fast_upload(f'{file}', f'{file}', UT, bot, edit, '**UPLOADING:**') + attributes = [DocumentAttributeVideo(duration=duration, w=width, h=height, round_message=round_message, supports_streaming=True)] + await bot.send_file(to, uploader, caption=caption, thumb=thumb_path, attributes=attributes, force_document=False) + elif msg.media==MessageMediaType.VIDEO_NOTE: + uploader = await fast_upload(f'{file}', f'{file}', UT, bot, edit, '**UPLOADING:**') + attributes = [DocumentAttributeVideo(duration=duration, w=width, h=height, round_message=round_message, supports_streaming=True)] + await bot.send_file(to, uploader, caption=caption, thumb=thumb_path, attributes=attributes, force_document=False) + else: + UT = time.time() + uploader = await fast_upload(f'{file}', f'{file}', UT, bot, edit, '**UPLOADING:**') + await bot.send_file(to, uploader, caption=caption, thumb=thumb_path, force_document=True) + if os.path.isfile(file) == True: + os.remove(file) + except Exception as e: + print("Telethon tried but failed!") + print(e) + await client.edit_message_text(sender, edit_id, f'Failed to save: `{msg_link}`\n\nError: {str(e)}') + try: + os.remove(file) + except Exception: + return + return + else: + await client.edit_message_text(sender, edit_id, f'Failed to save: `{msg_link}`\n\nError: {str(e)}') + try: + os.remove(file) + except Exception: + return + return + try: + os.remove(file) if os.path.isfile(file) == True: os.remove(file) - return None + except Exception as e: + print(e) + await edit.delete() else: edit = await client.edit_message_text(sender, edit_id, "Cloning.") chat = msg_link.split("/")[-2] try: - await client.copy_message(int(sender), chat, msg_id) - except FloodWait as fw: - print(fw) - if bulk == True: - return int(fw.x) + 5 - else: - await client.edit_message_text(sender, edit_id, f'Try again after {fw.x} seconds due to floodwait from telegram.') - return None + await client.copy_message(to, chat, msg_id) except Exception as e: print(e) - await client.edit_message_text(sender, edit_id, f'Failed to save: `{msg_link}`\n**Error:** str(e)') - return None + return await client.edit_message_text(sender, edit_id, f'Failed to save: `{msg_link}`\n\nError: {str(e)}') await edit.delete() - return None - -async def get_bulk_msg(userbot, client, sender, msg_link, i): + +async def get_bulk_msg(userbot, client, sender, chat, msg_link, i): x = await client.send_message(sender, "Processing!") - ok = await get_msg(userbot, client, sender, x.message_id, msg_link, i, bulk=True) - return ok + await get_msg(userbot, client, Drone, sender, chat, x.id, msg_link, i) From d3edf50ca1ef9a62d1714fb26521eda738844534 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sun, 28 May 2023 15:16:20 +0530 Subject: [PATCH 374/410] Update pyroplug.py --- main/plugins/pyroplug.py | 196 +++++++++++++-------------------------- 1 file changed, 64 insertions(+), 132 deletions(-) diff --git a/main/plugins/pyroplug.py b/main/plugins/pyroplug.py index cd59f5498..1ec3055bc 100644 --- a/main/plugins/pyroplug.py +++ b/main/plugins/pyroplug.py @@ -1,17 +1,12 @@ -# Github.com/Vasusen-code - -from .. import bot as Drone import asyncio, time, os +from .. import Bot, bot from main.plugins.progress import progress_for_pyrogram from main.plugins.helpers import screenshot from pyrogram import Client, filters -from pyrogram.errors import ChannelBanned, ChannelInvalid, ChannelPrivate, ChatIdInvalid, ChatInvalid -from pyrogram.enums import MessageMediaType, ChatType +from pyrogram.errors import ChannelBanned, ChannelInvalid, ChannelPrivate, ChatIdInvalid, ChatInvalid, FloodWait from ethon.pyfunc import video_metadata -from ethon.telefunc import fast_upload -from telethon.tl.types import DocumentAttributeVideo from telethon import events def thumbnail(sender): @@ -20,34 +15,42 @@ def thumbnail(sender): else: return None -async def get_msg(userbot, client, bot, sender, to, edit_id, msg_link, i): +def thumbnail(sender): + if os.path.exists(f'{sender}.jpg'): + return f'{sender}.jpg' + else: + return None + +async def get_msg(userbot, client, sender, edit_id, msg_link, i, bulk=False): edit = "" chat = "" - round_message = False - if "?single" in msg_link: - msg_link = msg_link.split("?single")[0] - msg_id = int(msg_link.split("/")[-1]) + int(i) - height, width, duration, thumb_path = 90, 90, 0, None - if 't.me/c/' in msg_link or 't.me/b/' in msg_link: - if 't.me/b/' in msg_link: - chat = str(msg_link.split("/")[-2]) + msg_id = 0 + try: + msg_id = int(msg_link.split("/")[-1]) + except ValueError: + if '?single' in msg_link: + link_ = msg_link.split("?single")[0] + msg_id = int(link_.split("/")[-1]) else: - chat = int('-100' + str(msg_link.split("/")[-2])) + await client.edit_message_text(sender, edit_id, "**Invalid Link!**") + return None + if 't.me/c/' in msg_link: + chat = int('-100' + str(msg_link.split("/")[-2])) file = "" try: msg = await userbot.get_messages(chat, msg_id) if msg.media: - if msg.media==MessageMediaType.WEB_PAGE: + if 'web_page' in msg.media: edit = await client.edit_message_text(sender, edit_id, "Cloning.") - await client.send_message(to, msg.text.markdown) + await client.send_message(sender, msg.text.markdown) await edit.delete() - return + return None if not msg.media: if msg.text: edit = await client.edit_message_text(sender, edit_id, "Cloning.") - await client.send_message(to, msg.text.markdown) + await client.send_message(sender, msg.text.markdown) await edit.delete() - return + return None edit = await client.edit_message_text(sender, edit_id, "Trying to Download.") file = await userbot.download_media( msg, @@ -59,49 +62,27 @@ async def get_msg(userbot, client, bot, sender, to, edit_id, msg_link, i): time.time() ) ) - print(file) await edit.edit('Preparing to Upload!') - caption = None + caption = str(file) if msg.caption is not None: caption = msg.caption - if msg.media==MessageMediaType.VIDEO_NOTE: - round_message = True - print("Trying to get metadata") + if str(file).split(".")[-1] in ['mkv', 'mp4', 'webm', 'mpe4', 'mpeg']: + if str(file).split(".")[-1] in ['webm', 'mkv', 'mpe4', 'mpeg']: + path = str(file).split(".")[0] + ".mp4" + os.rename(file, path) + file = str(file).split(".")[0] + ".mp4" data = video_metadata(file) - height, width, duration = data["height"], data["width"], data["duration"] - print(f'd: {duration}, w: {width}, h:{height}') - try: - thumb_path = await screenshot(file, duration, sender) - except Exception: - thumb_path = None - await client.send_video_note( - chat_id=to, - video_note=file, - length=height, duration=duration, - thumb=thumb_path, - progress=progress_for_pyrogram, - progress_args=( - client, - '**UPLOADING:**\n', - edit, - time.time() - ) - ) - elif msg.media==MessageMediaType.VIDEO and msg.video.mime_type in ["video/mp4", "video/x-matroska"]: - print("Trying to get metadata") - data = video_metadata(file) - height, width, duration = data["height"], data["width"], data["duration"] - print(f'd: {duration}, w: {width}, h:{height}') + duration = data["duration"] try: thumb_path = await screenshot(file, duration, sender) except Exception: thumb_path = None await client.send_video( - chat_id=to, + chat_id=sender, video=file, caption=caption, supports_streaming=True, - height=height, width=width, duration=duration, + duration=duration, thumb=thumb_path, progress=progress_for_pyrogram, progress_args=( @@ -111,14 +92,13 @@ async def get_msg(userbot, client, bot, sender, to, edit_id, msg_link, i): time.time() ) ) - - elif msg.media==MessageMediaType.PHOTO: + elif str(file).split(".")[-1] in ['jpg', 'jpeg', 'png', 'webp']: await edit.edit("Uploading photo.") - await bot.send_file(to, file, caption=caption) + await bot.send_file(sender, file, caption=caption) else: thumb_path=thumbnail(sender) await client.send_document( - to, + sender, file, caption=caption, thumb=thumb_path, @@ -130,93 +110,45 @@ async def get_msg(userbot, client, bot, sender, to, edit_id, msg_link, i): time.time() ) ) - try: - os.remove(file) - if os.path.isfile(file) == True: - os.remove(file) - except Exception as e: - print(e) + os.remove(file) await edit.delete() + return None except (ChannelBanned, ChannelInvalid, ChannelPrivate, ChatIdInvalid, ChatInvalid): await client.edit_message_text(sender, edit_id, "Have you joined the channel?") - return + return None + except FloodWait as fw: + print(fw) + if bulk is True: + return int(fw.x) + 5 + else: + await client.edit_message_text(sender, edit_id, f'Try again after {fw.x} seconds due to floodwait from telegram.') + return None except Exception as e: print(e) - if "messages.SendMedia" in str(e): - try: - if msg.media==MessageMediaType.VIDEO and msg.video.mime_type in ["video/mp4", "video/x-matroska"]: - UT = time.time() - uploader = await fast_upload(f'{file}', f'{file}', UT, bot, edit, '**UPLOADING:**') - attributes = [DocumentAttributeVideo(duration=duration, w=width, h=height, round_message=round_message, supports_streaming=True)] - await bot.send_file(to, uploader, caption=caption, thumb=thumb_path, attributes=attributes, force_document=False) - elif msg.media==MessageMediaType.VIDEO_NOTE: - uploader = await fast_upload(f'{file}', f'{file}', UT, bot, edit, '**UPLOADING:**') - attributes = [DocumentAttributeVideo(duration=duration, w=width, h=height, round_message=round_message, supports_streaming=True)] - await bot.send_file(to, uploader, caption=caption, thumb=thumb_path, attributes=attributes, force_document=False) - else: - UT = time.time() - uploader = await fast_upload(f'{file}', f'{file}', UT, bot, edit, '**UPLOADING:**') - await bot.send_file(to, uploader, caption=caption, thumb=thumb_path, force_document=True) - if os.path.isfile(file) == True: - os.remove(file) - except Exception as e: - print(e) - await client.edit_message_text(sender, edit_id, f'Failed to save: `{msg_link}`\n\nError: {str(e)}') - try: - os.remove(file) - except Exception: - return - return - elif "SaveBigFilePartRequest" in str(e): - try: - if msg.media==MessageMediaType.VIDEO and msg.video.mime_type in ["video/mp4", "video/x-matroska"]: - UT = time.time() - uploader = await fast_upload(f'{file}', f'{file}', UT, bot, edit, '**UPLOADING:**') - attributes = [DocumentAttributeVideo(duration=duration, w=width, h=height, round_message=round_message, supports_streaming=True)] - await bot.send_file(to, uploader, caption=caption, thumb=thumb_path, attributes=attributes, force_document=False) - elif msg.media==MessageMediaType.VIDEO_NOTE: - uploader = await fast_upload(f'{file}', f'{file}', UT, bot, edit, '**UPLOADING:**') - attributes = [DocumentAttributeVideo(duration=duration, w=width, h=height, round_message=round_message, supports_streaming=True)] - await bot.send_file(to, uploader, caption=caption, thumb=thumb_path, attributes=attributes, force_document=False) - else: - UT = time.time() - uploader = await fast_upload(f'{file}', f'{file}', UT, bot, edit, '**UPLOADING:**') - await bot.send_file(to, uploader, caption=caption, thumb=thumb_path, force_document=True) - if os.path.isfile(file) == True: - os.remove(file) - except Exception as e: - print("Telethon tried but failed!") - print(e) - await client.edit_message_text(sender, edit_id, f'Failed to save: `{msg_link}`\n\nError: {str(e)}') - try: - os.remove(file) - except Exception: - return - return - else: - await client.edit_message_text(sender, edit_id, f'Failed to save: `{msg_link}`\n\nError: {str(e)}') - try: - os.remove(file) - except Exception: - return - return - try: - os.remove(file) + await client.edit_message_text(sender, edit_id, f'Failed to save: `{msg_link}`') if os.path.isfile(file) == True: os.remove(file) - except Exception as e: - print(e) - await edit.delete() + return None else: edit = await client.edit_message_text(sender, edit_id, "Cloning.") chat = msg_link.split("/")[-2] try: - await client.copy_message(to, chat, msg_id) + await client.copy_message(int(sender), chat, msg_id) + except FloodWait as fw: + print(fw) + if bulk == True: + return int(fw.x) + 5 + else: + await client.edit_message_text(sender, edit_id, f'Try again after {fw.x} seconds due to floodwait from telegram.') + return None except Exception as e: print(e) - return await client.edit_message_text(sender, edit_id, f'Failed to save: `{msg_link}`\n\nError: {str(e)}') + await client.edit_message_text(sender, edit_id, f'Failed to save: `{msg_link}`\n**Error:** str(e)') + return None await edit.delete() - -async def get_bulk_msg(userbot, client, sender, chat, msg_link, i): + return None + +async def get_bulk_msg(userbot, client, sender, msg_link, i): x = await client.send_message(sender, "Processing!") - await get_msg(userbot, client, Drone, sender, chat, x.id, msg_link, i) + ok = await get_msg(userbot, client, sender, x.message_id, msg_link, i, bulk=True) + return ok From 991fa056a2880108c0bff0cde477a9601813057e Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sun, 28 May 2023 15:37:37 +0530 Subject: [PATCH 375/410] Update pyroplug.py --- main/plugins/pyroplug.py | 190 ++++++++++++++++++++++++++------------- 1 file changed, 129 insertions(+), 61 deletions(-) diff --git a/main/plugins/pyroplug.py b/main/plugins/pyroplug.py index 1ec3055bc..e44118891 100644 --- a/main/plugins/pyroplug.py +++ b/main/plugins/pyroplug.py @@ -1,12 +1,13 @@ import asyncio, time, os -from .. import Bot, bot from main.plugins.progress import progress_for_pyrogram -from main.plugins.helpers import screenshot from pyrogram import Client, filters -from pyrogram.errors import ChannelBanned, ChannelInvalid, ChannelPrivate, ChatIdInvalid, ChatInvalid, FloodWait +from pyrogram.errors import ChannelBanned, ChannelInvalid, ChannelPrivate, ChatIdInvalid, ChatInvalid +from pyrogram.enums import MessageMediaType from ethon.pyfunc import video_metadata +from ethon.telefunc import fast_upload +from telethon.tl.types import DocumentAttributeVideo from telethon import events def thumbnail(sender): @@ -15,42 +16,34 @@ def thumbnail(sender): else: return None -def thumbnail(sender): - if os.path.exists(f'{sender}.jpg'): - return f'{sender}.jpg' - else: - return None - -async def get_msg(userbot, client, sender, edit_id, msg_link, i, bulk=False): +async def get_msg(PyrogramUserBot, PyrogramBotClient, TelethonBotClient, sender, edit_id, msg_link, i): edit = "" chat = "" - msg_id = 0 - try: - msg_id = int(msg_link.split("/")[-1]) - except ValueError: - if '?single' in msg_link: - link_ = msg_link.split("?single")[0] - msg_id = int(link_.split("/")[-1]) + round_message = False + if "?single" in msg_link: + msg_link = msg_link.split("?single")[0] + msg_id = int(msg_link.split("/")[-1]) + int(i) + height, width, duration, thumb_path = 90, 90, 0, None + if 't.me/c/' in msg_link or 't.me/b/' in msg_link: + if 't.me/b/' in msg_link: + chat = str(msg_link.split("/")[-2]) else: - await client.edit_message_text(sender, edit_id, "**Invalid Link!**") - return None - if 't.me/c/' in msg_link: - chat = int('-100' + str(msg_link.split("/")[-2])) + chat = int('-100' + str(msg_link.split("/")[-2])) file = "" try: msg = await userbot.get_messages(chat, msg_id) if msg.media: - if 'web_page' in msg.media: + if msg.media==MessageMediaType.WEB_PAGE: edit = await client.edit_message_text(sender, edit_id, "Cloning.") await client.send_message(sender, msg.text.markdown) await edit.delete() - return None + return if not msg.media: if msg.text: edit = await client.edit_message_text(sender, edit_id, "Cloning.") await client.send_message(sender, msg.text.markdown) await edit.delete() - return None + return edit = await client.edit_message_text(sender, edit_id, "Trying to Download.") file = await userbot.download_media( msg, @@ -62,17 +55,39 @@ async def get_msg(userbot, client, sender, edit_id, msg_link, i, bulk=False): time.time() ) ) + print(file) await edit.edit('Preparing to Upload!') - caption = str(file) + caption = None if msg.caption is not None: caption = msg.caption - if str(file).split(".")[-1] in ['mkv', 'mp4', 'webm', 'mpe4', 'mpeg']: - if str(file).split(".")[-1] in ['webm', 'mkv', 'mpe4', 'mpeg']: - path = str(file).split(".")[0] + ".mp4" - os.rename(file, path) - file = str(file).split(".")[0] + ".mp4" + if msg.media==MessageMediaType.VIDEO_NOTE: + round_message = True + print("Trying to get metadata") data = video_metadata(file) - duration = data["duration"] + height, width, duration = data["height"], data["width"], data["duration"] + print(f'd: {duration}, w: {width}, h:{height}') + try: + thumb_path = await screenshot(file, duration, sender) + except Exception: + thumb_path = None + await client.send_video_note( + chat_id=sender, + video_note=file, + length=height, duration=duration, + thumb=thumb_path, + progress=progress_for_pyrogram, + progress_args=( + client, + '**UPLOADING:**\n', + edit, + time.time() + ) + ) + elif msg.media==MessageMediaType.VIDEO and msg.video.mime_type in ["video/mp4", "video/x-matroska"]: + print("Trying to get metadata") + data = video_metadata(file) + height, width, duration = data["height"], data["width"], data["duration"] + print(f'd: {duration}, w: {width}, h:{height}') try: thumb_path = await screenshot(file, duration, sender) except Exception: @@ -82,7 +97,7 @@ async def get_msg(userbot, client, sender, edit_id, msg_link, i, bulk=False): video=file, caption=caption, supports_streaming=True, - duration=duration, + height=height, width=width, duration=duration, thumb=thumb_path, progress=progress_for_pyrogram, progress_args=( @@ -92,7 +107,8 @@ async def get_msg(userbot, client, sender, edit_id, msg_link, i, bulk=False): time.time() ) ) - elif str(file).split(".")[-1] in ['jpg', 'jpeg', 'png', 'webp']: + + elif msg.media==MessageMediaType.PHOTO: await edit.edit("Uploading photo.") await bot.send_file(sender, file, caption=caption) else: @@ -110,45 +126,97 @@ async def get_msg(userbot, client, sender, edit_id, msg_link, i, bulk=False): time.time() ) ) - os.remove(file) + try: + os.remove(file) + if os.path.isfile(file) == True: + os.remove(file) + except Exception: + pass await edit.delete() - return None except (ChannelBanned, ChannelInvalid, ChannelPrivate, ChatIdInvalid, ChatInvalid): await client.edit_message_text(sender, edit_id, "Have you joined the channel?") - return None - except FloodWait as fw: - print(fw) - if bulk is True: - return int(fw.x) + 5 - else: - await client.edit_message_text(sender, edit_id, f'Try again after {fw.x} seconds due to floodwait from telegram.') - return None + return except Exception as e: print(e) - await client.edit_message_text(sender, edit_id, f'Failed to save: `{msg_link}`') + if "messages.SendMedia" in str(e): + try: + if msg.media==MessageMediaType.VIDEO and msg.video.mime_type in ["video/mp4", "video/x-matroska"]: + UT = time.time() + uploader = await fast_upload(f'{file}', f'{file}', UT, bot, edit, '**UPLOADING:**') + attributes = [DocumentAttributeVideo(duration=duration, w=width, h=height, round_message=round_message, supports_streaming=True)] + await bot.send_file(sender, uploader, caption=caption, thumb=thumb_path, attributes=attributes, force_document=False) + elif msg.media==MessageMediaType.VIDEO_NOTE: + uploader = await fast_upload(f'{file}', f'{file}', UT, bot, edit, '**UPLOADING:**') + attributes = [DocumentAttributeVideo(duration=duration, w=width, h=height, round_message=round_message, supports_streaming=True)] + await bot.send_file(sender, uploader, caption=caption, thumb=thumb_path, attributes=attributes, force_document=False) + else: + UT = time.time() + uploader = await fast_upload(f'{file}', f'{file}', UT, bot, edit, '**UPLOADING:**') + await bot.send_file(sender, uploader, caption=caption, thumb=thumb_path, force_document=True) + if os.path.isfile(file) == True: + os.remove(file) + except Exception as e: + print(e) + await client.edit_message_text(sender, edit_id, f'Failed to save: `{msg_link}`\n\nError: {str(e)}') + try: + os.remove(file) + except Exception: + return + return + elif "SaveBigFilePartRequest" in str(e): + try: + if msg.media==MessageMediaType.VIDEO and msg.video.mime_type in ["video/mp4", "video/x-matroska"]: + UT = time.time() + uploader = await fast_upload(f'{file}', f'{file}', UT, bot, edit, '**UPLOADING:**') + attributes = [DocumentAttributeVideo(duration=duration, w=width, h=height, round_message=round_message, supports_streaming=True)] + await bot.send_file(sender, uploader, caption=caption, thumb=thumb_path, attributes=attributes, force_document=False) + elif msg.media==MessageMediaType.VIDEO_NOTE: + uploader = await fast_upload(f'{file}', f'{file}', UT, bot, edit, '**UPLOADING:**') + attributes = [DocumentAttributeVideo(duration=duration, w=width, h=height, round_message=round_message, supports_streaming=True)] + await bot.send_file(sender, uploader, caption=caption, thumb=thumb_path, attributes=attributes, force_document=False) + else: + UT = time.time() + uploader = await fast_upload(f'{file}', f'{file}', UT, bot, edit, '**UPLOADING:**') + await bot.send_file(sender, uploader, caption=caption, thumb=thumb_path, force_document=True) + if os.path.isfile(file) == True: + os.remove(file) + except Exception as e: + print("Telethon tried but failed!") + print(e) + await client.edit_message_text(sender, edit_id, f'Failed to save: `{msg_link}`\n\nError: {str(e)}') + try: + os.remove(file) + except Exception: + return + return + else: + await client.edit_message_text(sender, edit_id, f'Failed to save: `{msg_link}`\n\nError: {str(e)}') + try: + os.remove(file) + except Exception: + return + return + try: + os.remove(file) if os.path.isfile(file) == True: os.remove(file) - return None + except Exception: + pass + await edit.delete() else: edit = await client.edit_message_text(sender, edit_id, "Cloning.") chat = msg_link.split("/")[-2] try: - await client.copy_message(int(sender), chat, msg_id) - except FloodWait as fw: - print(fw) - if bulk == True: - return int(fw.x) + 5 - else: - await client.edit_message_text(sender, edit_id, f'Try again after {fw.x} seconds due to floodwait from telegram.') - return None + await client.copy_message(sender, chat, msg_id) except Exception as e: - print(e) - await client.edit_message_text(sender, edit_id, f'Failed to save: `{msg_link}`\n**Error:** str(e)') - return None + if "Empty messages cannot be copied" in str(e): + group_link = f't.me/c/{int(msg.sender_chat.id)}/{int(msg.id)}' + return await get_msg(PyrogramUserBot, PyrogramBotClient, TelethonBotClient, sender, edit_id, msg_link, i) + else: + print(e) + return await client.edit_message_text(sender, edit_id, f'Failed to save: `{msg_link}`\n\nError: {str(e)}') await edit.delete() - return None - -async def get_bulk_msg(userbot, client, sender, msg_link, i): + +async def get_bulk_msg(userbot, client, sender, chat, msg_link, i): x = await client.send_message(sender, "Processing!") - ok = await get_msg(userbot, client, sender, x.message_id, msg_link, i, bulk=True) - return ok + await get_msg(userbot, client, Drone, sender, chat, x.id, msg_link, i) From c1ac732d58850ed87211fe6c180e5720aab9ee7c Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sun, 28 May 2023 15:44:24 +0530 Subject: [PATCH 376/410] Update pyroplug.py --- main/plugins/pyroplug.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/plugins/pyroplug.py b/main/plugins/pyroplug.py index e44118891..044a957a9 100644 --- a/main/plugins/pyroplug.py +++ b/main/plugins/pyroplug.py @@ -24,7 +24,7 @@ async def get_msg(PyrogramUserBot, PyrogramBotClient, TelethonBotClient, sender, msg_link = msg_link.split("?single")[0] msg_id = int(msg_link.split("/")[-1]) + int(i) height, width, duration, thumb_path = 90, 90, 0, None - if 't.me/c/' in msg_link or 't.me/b/' in msg_link: + if 't.me/c/' in msg_link: if 't.me/b/' in msg_link: chat = str(msg_link.split("/")[-2]) else: From 8102df2e327309c40ba5f2f7f8bcd0bf92cb4295 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sun, 28 May 2023 15:47:06 +0530 Subject: [PATCH 377/410] Update frontend.py --- main/plugins/frontend.py | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/main/plugins/frontend.py b/main/plugins/frontend.py index 153d5bccc..f12201cb8 100644 --- a/main/plugins/frontend.py +++ b/main/plugins/frontend.py @@ -16,14 +16,6 @@ ft = f"To use this bot you've to join @{fs}." message = "Send me the message link you want to start saving from, as a reply to this message." - -process=[] -timer=[] -user=[] - -# To-Do: -# Make these codes shorter and clean -# ofc will never do it. @Drone.on(events.NewMessage(incoming=True, func=lambda e: e.is_private)) async def clone(event): @@ -42,19 +34,15 @@ async def clone(event): await event.reply(r) return edit = await event.reply("Processing!") - if f'{int(event.sender_id)}' in user: - return await edit.edit("Please don't spam links, wait until ongoing process is done.") - user.append(f'{int(event.sender_id)}') try: if 't.me/+' in link: q = await join(userbot, link) await edit.edit(q) if 't.me/' in link: - await get_msg(userbot, Bot, event.sender_id, edit.id, link, 0) + await get_msg(userbot, Bot, Drone, event.sender_id, edit.id, link, 0) except FloodWait as fw: - await Drone.send_message(event.sender_id, f'Try again after {fw.x} seconds due to floodwait from telegram.') + return await Drone.send_message(event.sender_id, f'Try again after {fw.x} seconds due to floodwait from telegram.') except Exception as e: print(e) await Drone.send_message(event.sender_id, f"An error occurred during cloning of `{link}`\n\n**Error:** {str(e)}") - ind = user.index(f'{int(event.sender_id)}') - user.pop(int(ind)) + From 3656aaa03d734d509a64826c7442f250ffcdbde3 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sun, 28 May 2023 16:04:58 +0530 Subject: [PATCH 378/410] Update batch.py --- main/plugins/batch.py | 72 ++++++++++++++++++------------------------- 1 file changed, 30 insertions(+), 42 deletions(-) diff --git a/main/plugins/batch.py b/main/plugins/batch.py index b8a537bf5..34ebfa409 100644 --- a/main/plugins/batch.py +++ b/main/plugins/batch.py @@ -10,7 +10,7 @@ from .. import bot as Drone from .. import userbot, Bot, AUTH from .. import FORCESUB as fs -from main.plugins.pyroplug import check, get_bulk_msg +from main.plugins.pyroplug import get_bulk_msg from main.plugins.helpers import get_link, screenshot from telethon import events, Button, errors @@ -26,21 +26,15 @@ batch = [] -async def get_pvt_content(event, chat, id): - msg = await userbot.get_messages(chat, ids=id) - await event.client.send_message(event.chat_id, msg) - @Drone.on(events.NewMessage(incoming=True, from_users=AUTH, pattern='/batch')) async def _batch(event): if not event.is_private: return - # wtf is the use of fsub here if the command is meant for the owner? - # well am too lazy to clean s, r = await force_sub(event.client, fs, event.sender_id, ft) if s == True: await event.reply(r) return - if f'{event.sender_id}' in batch: + if event.sender_id in batch: return await event.reply("You've already started one batch, wait for it to complete you dumbfuck owner!") async with Drone.conversation(event.chat_id) as conv: if s != True: @@ -66,22 +60,17 @@ async def _batch(event): return await conv.send_message("You can only get upto 100 files in a single batch.") except ValueError: return await conv.send_message("Range must be an integer!") - if s != True: - await conv.send_message(r) - return - batch.append(f'{event.sender_id}') - cd = await conv.send_message("**Batch process ongoing.**\n\nProcess completed: ", - buttons=[[Button.inline("CANCEL❌", data="cancel")]]) - await run_batch(userbot, Bot, event.sender_id, value, cd, _link) + batch.append(event.sender_id) + await run_batch(userbot, Bot, event.sender_id, _link, value) conv.cancel() batch.clear() @Drone.on(events.callbackquery.CallbackQuery(data="cancel")) async def cancel(event): batch.clear() - -async def run_batch(userbot, client, sender, range_, countdown, link): - for i in range(range_ + 1): + +async def run_batch(userbot, client, sender, link, _range): + for i in range(_range): timer = 60 if i < 25: timer = 5 @@ -95,30 +84,29 @@ async def run_batch(userbot, client, sender, range_, countdown, link): else: timer = 3 try: - check_ = batch[0] - count_down = f"**Batch process ongoing.**\n\nProcess completed: {i+1}" - out = await get_bulk_msg(userbot, client, sender, link, i) - if out != None: - if out - 5 > 300: - await client.send_message(sender, f'You have floodwaits of {out - 5} seconds, cancelling batch') - batch.clear() - break - else: - fw_alert = await client.send_message(sender, f'Sleeping for {out} second(s) due to telegram flooodwait.') - await asyncio.sleep(out) - await fw_alert.delete() - await get_bulk_msg(userbot, client, sender, link, i) - protection = await client.send_message(sender, f"Sleeping for `{timer}` seconds to avoid Floodwaits and Protect account!") - await countdown.edit(count_down) - await asyncio.sleep(timer) - await protection.delete() - except IndexError: - await client.send_message(sender, "Batch successfully completed!") - await countdown.delete() + if not sender in batch: + await client.send_message(sender, "Batch completed.") + break + except Exception as e: + print(e) + await client.send_message(sender, "Batch completed.") break + try: + await userbot.start() except Exception as e: print(e) - if countdown.text != count_down: - await countdown.edit(count_down) - - + await client.send_message(sender, f'{errorC}\n\n**Error:** {str(e)}') + break + try: + await get_bulk_msg(userbot, client, sender, link, i) + except FloodWait as fw: + if int(fw.x) > 299: + await client.send_message(sender, "Cancelling batch since you have floodwait more than 5 minutes.") + break + await asyncio.sleep(fw.x + 5) + await get_bulk_msg(userbot, client, sender, link, i) + await userbot.stop() + protection = await client.send_message(sender, f"Sleeping for `{timer}` seconds to avoid Floodwaits and Protect account!") + await asyncio.sleep(timer) + await protection.delete() + From ab50b44801fb38378a4c0a12ecd63e6c425f78e4 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sun, 28 May 2023 16:07:11 +0530 Subject: [PATCH 379/410] Update pyroplug.py --- main/plugins/pyroplug.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/main/plugins/pyroplug.py b/main/plugins/pyroplug.py index 044a957a9..c5a724426 100644 --- a/main/plugins/pyroplug.py +++ b/main/plugins/pyroplug.py @@ -1,5 +1,6 @@ import asyncio, time, os +from .. import bot as Drone from main.plugins.progress import progress_for_pyrogram from pyrogram import Client, filters @@ -217,6 +218,6 @@ async def get_msg(PyrogramUserBot, PyrogramBotClient, TelethonBotClient, sender, return await client.edit_message_text(sender, edit_id, f'Failed to save: `{msg_link}`\n\nError: {str(e)}') await edit.delete() -async def get_bulk_msg(userbot, client, sender, chat, msg_link, i): +async def get_bulk_msg(userbot, client, sender, msg_link, i): x = await client.send_message(sender, "Processing!") - await get_msg(userbot, client, Drone, sender, chat, x.id, msg_link, i) + await get_msg(userbot, client, Drone, sender, x.id, msg_link, i) From c41653cd4728ce522bc57b66c4a07d548bfaa5df Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sun, 28 May 2023 16:11:33 +0530 Subject: [PATCH 380/410] Update __init__.py --- main/__init__.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/main/__init__.py b/main/__init__.py index 85aed9ced..f4f60cf34 100644 --- a/main/__init__.py +++ b/main/__init__.py @@ -21,10 +21,7 @@ bot = TelegramClient('bot', API_ID, API_HASH).start(bot_token=BOT_TOKEN) -userbot = Client( - session_name=SESSION, - api_hash=API_HASH, - api_id=API_ID) +userbot = Client("saverestricted", session_string=SESSION, api_hash=API_HASH, api_id=API_ID) try: userbot.start() From a07dcd6000b52ea128ec799c7c99791df4cf6fec Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sun, 28 May 2023 16:13:44 +0530 Subject: [PATCH 381/410] Update requirements.txt --- requirements.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/requirements.txt b/requirements.txt index 9498c4d79..57077157b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,7 +1,7 @@ #Github.com-Vasusen-code https://github.com/vasusen-code/Telethon/archive/refs/tags/v1.24.0.zip -ethon==0.1.2 +https://github.com/vasusen-code/ethon/archive/refs/tags/v0.1.4.zip cryptg tgcrypto -pyrogram==1.4.16 +pyrogram From 7016ac13c0ad175f5cecf18c394cca5612175c23 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sun, 28 May 2023 16:19:43 +0530 Subject: [PATCH 382/410] Update requirements.txt --- requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/requirements.txt b/requirements.txt index 57077157b..f3c32f613 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,3 +5,4 @@ https://github.com/vasusen-code/ethon/archive/refs/tags/v0.1.4.zip cryptg tgcrypto pyrogram +python-decouple From 5f2af1ccefef258c3aa99fd5635bf9a809b2f6e4 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sun, 28 May 2023 16:20:27 +0530 Subject: [PATCH 383/410] Update pyroplug.py --- main/plugins/pyroplug.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/main/plugins/pyroplug.py b/main/plugins/pyroplug.py index c5a724426..31cee782f 100644 --- a/main/plugins/pyroplug.py +++ b/main/plugins/pyroplug.py @@ -1,3 +1,5 @@ +#Github.com-Vasusen-code + import asyncio, time, os from .. import bot as Drone From 17a05b94da9c4987f6121bab986bcb9c6d2b4e5b Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sun, 28 May 2023 16:24:11 +0530 Subject: [PATCH 384/410] Update batch.py --- main/plugins/batch.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/main/plugins/batch.py b/main/plugins/batch.py index 34ebfa409..06d790ebf 100644 --- a/main/plugins/batch.py +++ b/main/plugins/batch.py @@ -26,6 +26,13 @@ batch = [] +@Drone.on(events.NewMessage(incoming=True, pattern='/cancel')) +async def cancel(event): + if not event.sender_id in batch: + return await event.reply("No batch active.") + batch.clear() + await event.reply("Done.") + @Drone.on(events.NewMessage(incoming=True, from_users=AUTH, pattern='/batch')) async def _batch(event): if not event.is_private: From c3c2b1f73dc8ae3179a7a50f64724c1535170576 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sun, 28 May 2023 16:25:09 +0530 Subject: [PATCH 385/410] Update batch.py --- main/plugins/batch.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/main/plugins/batch.py b/main/plugins/batch.py index 06d790ebf..395e15e9d 100644 --- a/main/plugins/batch.py +++ b/main/plugins/batch.py @@ -71,11 +71,7 @@ async def _batch(event): await run_batch(userbot, Bot, event.sender_id, _link, value) conv.cancel() batch.clear() - -@Drone.on(events.callbackquery.CallbackQuery(data="cancel")) -async def cancel(event): - batch.clear() - + async def run_batch(userbot, client, sender, link, _range): for i in range(_range): timer = 60 From fa131ea0c99a489d05099e2209dd28e39d609b8a Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sun, 28 May 2023 16:28:06 +0530 Subject: [PATCH 386/410] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 251d58852..5e631414e 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ A stable telegram bot to get restricted messages with custom thumbnail support , API: [API scrapper Bot](https://t.me/USETGSBOT) or [Telegram.org](https://my.telegram.org/auth) -PYROGRAM SESSION: [SessionGen Bot](https://t.me/SessionStringGeneratorZBot) or [![Run on Repl.it](https://replit.com/badge/github/vasusen-code/saverestrictedcontentbot)](https://replit.com/@dashezup/generate-pyrogram-session-string) +PYROGRAM SESSION: [SessionGen Bot](https://t.me/SessionStringGeneratorZBot) or [![Run on Repl.it](https://replit.com/badge/github/vasusen-code/saverestrictedcontentbot)](https://replit.com/@Itz-zaid/pyrogram-20#main.py) BOT TOKEN: @Botfather on telegram From b0fbb1fbb7fb84b11827a53e1a3a1ea036d0815a Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sun, 28 May 2023 16:31:43 +0530 Subject: [PATCH 387/410] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5e631414e..ae0f0d65e 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ A stable telegram bot to get restricted messages with custom thumbnail support , API: [API scrapper Bot](https://t.me/USETGSBOT) or [Telegram.org](https://my.telegram.org/auth) -PYROGRAM SESSION: [SessionGen Bot](https://t.me/SessionStringGeneratorZBot) or [![Run on Repl.it](https://replit.com/badge/github/vasusen-code/saverestrictedcontentbot)](https://replit.com/@Itz-zaid/pyrogram-20#main.py) +PYROGRAM SESSION: [SessionGen Bot](https://t.me/SessionStringGeneratorZBot) or [![Run on Repl.it](https://replit.com/badge/github/vasusen-code/saverestrictedcontentbot)](https://replit.com/@levinalab/Session-Generator#main.py) BOT TOKEN: @Botfather on telegram From a0cd424e72669201b24d6eb0bd4095ab0c6a2e58 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sun, 28 May 2023 16:38:29 +0530 Subject: [PATCH 388/410] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index ae0f0d65e..2753dc035 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,7 @@ A stable telegram bot to get restricted messages with custom thumbnail support , - Faster speed - Forcesubscribe available - `/batch` - (For owner only) Use this command to save upto 100 files from a pvt or public restricted channel at once. +- `/cancel` - Use this to stop batch - Time delay is added to avoid FloodWait and keep user account safe. # Variables From 19ac411bb50eaeedaab4249c16c0d9f5cacec3b6 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sun, 28 May 2023 16:40:35 +0530 Subject: [PATCH 389/410] Update batch.py --- main/plugins/batch.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/main/plugins/batch.py b/main/plugins/batch.py index 395e15e9d..cb0102f0b 100644 --- a/main/plugins/batch.py +++ b/main/plugins/batch.py @@ -26,7 +26,7 @@ batch = [] -@Drone.on(events.NewMessage(incoming=True, pattern='/cancel')) +@Drone.on(events.NewMessage(incoming=True, from_users=AUTH, pattern='/cancel')) async def cancel(event): if not event.sender_id in batch: return await event.reply("No batch active.") @@ -52,21 +52,26 @@ async def _batch(event): _link = get_link(link.text) except Exception: await conv.send_message("No link found.") + retrun conv.cancel() except Exception as e: print(e) - return await conv.send_message("Cannot wait more longer for your response!") + await conv.send_message("Cannot wait more longer for your response!") + retrun conv.cancel() await conv.send_message("Send me the number of files/range you want to save from the given message, as a reply to this message.", buttons=Button.force_reply()) try: _range = await conv.get_reply() except Exception as e: print(e) - return await conv.send_message("Cannot wait more longer for your response!") + await conv.send_message("Cannot wait more longer for your response!") + retrun conv.cancel() try: value = int(_range.text) if value > 100: - return await conv.send_message("You can only get upto 100 files in a single batch.") + await conv.send_message("You can only get upto 100 files in a single batch.") + retrun conv.cancel() except ValueError: - return await conv.send_message("Range must be an integer!") + await conv.send_message("Range must be an integer!") + retrun conv.cancel() batch.append(event.sender_id) await run_batch(userbot, Bot, event.sender_id, _link, value) conv.cancel() From 36c0f4fea93139b27636402ee46c120e280869df Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Mon, 29 May 2023 11:39:12 +0530 Subject: [PATCH 390/410] Update batch.py --- main/plugins/batch.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/plugins/batch.py b/main/plugins/batch.py index cb0102f0b..eb41efde4 100644 --- a/main/plugins/batch.py +++ b/main/plugins/batch.py @@ -41,7 +41,7 @@ async def _batch(event): if s == True: await event.reply(r) return - if event.sender_id in batch: + if event.sender_id in batch: return await event.reply("You've already started one batch, wait for it to complete you dumbfuck owner!") async with Drone.conversation(event.chat_id) as conv: if s != True: From f406048cbc60ffab6bcb4b637c19f3350ba843ee Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Mon, 29 May 2023 11:56:29 +0530 Subject: [PATCH 391/410] Update batch.py --- main/plugins/batch.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/main/plugins/batch.py b/main/plugins/batch.py index eb41efde4..cd36ca7f7 100644 --- a/main/plugins/batch.py +++ b/main/plugins/batch.py @@ -52,26 +52,26 @@ async def _batch(event): _link = get_link(link.text) except Exception: await conv.send_message("No link found.") - retrun conv.cancel() + return conv.cancel() except Exception as e: print(e) await conv.send_message("Cannot wait more longer for your response!") - retrun conv.cancel() + return conv.cancel() await conv.send_message("Send me the number of files/range you want to save from the given message, as a reply to this message.", buttons=Button.force_reply()) try: _range = await conv.get_reply() except Exception as e: print(e) await conv.send_message("Cannot wait more longer for your response!") - retrun conv.cancel() + return conv.cancel() try: value = int(_range.text) if value > 100: await conv.send_message("You can only get upto 100 files in a single batch.") - retrun conv.cancel() + return conv.cancel() except ValueError: await conv.send_message("Range must be an integer!") - retrun conv.cancel() + return conv.cancel() batch.append(event.sender_id) await run_batch(userbot, Bot, event.sender_id, _link, value) conv.cancel() From 406673857e1c8b9d6e070bb34fe95f02cd74b28d Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Mon, 29 May 2023 12:25:47 +0530 Subject: [PATCH 392/410] Update frontend.py --- main/plugins/frontend.py | 1 + 1 file changed, 1 insertion(+) diff --git a/main/plugins/frontend.py b/main/plugins/frontend.py index f12201cb8..90d04b9fa 100644 --- a/main/plugins/frontend.py +++ b/main/plugins/frontend.py @@ -38,6 +38,7 @@ async def clone(event): if 't.me/+' in link: q = await join(userbot, link) await edit.edit(q) + return if 't.me/' in link: await get_msg(userbot, Bot, Drone, event.sender_id, edit.id, link, 0) except FloodWait as fw: From 17d5b1a3098f957ff9bf317207b2c357aea9b429 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Mon, 29 May 2023 12:28:32 +0530 Subject: [PATCH 393/410] Update pyroplug.py --- main/plugins/pyroplug.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/main/plugins/pyroplug.py b/main/plugins/pyroplug.py index 31cee782f..8a503dee0 100644 --- a/main/plugins/pyroplug.py +++ b/main/plugins/pyroplug.py @@ -19,7 +19,12 @@ def thumbnail(sender): else: return None -async def get_msg(PyrogramUserBot, PyrogramBotClient, TelethonBotClient, sender, edit_id, msg_link, i): +async def get_msg(userbot, client, bot, sender, edit_id, msg_link, i): + + """ userbot: PyrogramUserBot + client: PyrogramBotClient + bot: TelethonBotClient """ + edit = "" chat = "" round_message = False From 2b6162dff68091a22ab2c715eb2e587be5fd044f Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Mon, 29 May 2023 17:48:51 +0530 Subject: [PATCH 394/410] Update batch.py --- main/plugins/batch.py | 7 ------- 1 file changed, 7 deletions(-) diff --git a/main/plugins/batch.py b/main/plugins/batch.py index cd36ca7f7..2bb76d965 100644 --- a/main/plugins/batch.py +++ b/main/plugins/batch.py @@ -99,12 +99,6 @@ async def run_batch(userbot, client, sender, link, _range): print(e) await client.send_message(sender, "Batch completed.") break - try: - await userbot.start() - except Exception as e: - print(e) - await client.send_message(sender, f'{errorC}\n\n**Error:** {str(e)}') - break try: await get_bulk_msg(userbot, client, sender, link, i) except FloodWait as fw: @@ -113,7 +107,6 @@ async def run_batch(userbot, client, sender, link, _range): break await asyncio.sleep(fw.x + 5) await get_bulk_msg(userbot, client, sender, link, i) - await userbot.stop() protection = await client.send_message(sender, f"Sleeping for `{timer}` seconds to avoid Floodwaits and Protect account!") await asyncio.sleep(timer) await protection.delete() From db3923a336bdcc4dd577d0d8a3188eba2f9c0b80 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Tue, 30 May 2023 14:12:18 +0530 Subject: [PATCH 395/410] Update pyroplug.py --- main/plugins/pyroplug.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/main/plugins/pyroplug.py b/main/plugins/pyroplug.py index 8a503dee0..1edb3b8b3 100644 --- a/main/plugins/pyroplug.py +++ b/main/plugins/pyroplug.py @@ -218,8 +218,9 @@ async def get_msg(userbot, client, bot, sender, edit_id, msg_link, i): await client.copy_message(sender, chat, msg_id) except Exception as e: if "Empty messages cannot be copied" in str(e): - group_link = f't.me/c/{int(msg.sender_chat.id)}/{int(msg.id)}' - return await get_msg(PyrogramUserBot, PyrogramBotClient, TelethonBotClient, sender, edit_id, msg_link, i) + group = await userbot.get_users(chat) + group_link = f't.me/c/{int(group.id)}/{int(msg_id)}' + return await get_msg(userbot, client, bot, sender, edit_id, msg_link, i) else: print(e) return await client.edit_message_text(sender, edit_id, f'Failed to save: `{msg_link}`\n\nError: {str(e)}') From f67de1329efe5e5c80072c059891c0e2e62a6c58 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Tue, 30 May 2023 14:13:51 +0530 Subject: [PATCH 396/410] Update pyroplug.py --- main/plugins/pyroplug.py | 1 + 1 file changed, 1 insertion(+) diff --git a/main/plugins/pyroplug.py b/main/plugins/pyroplug.py index 1edb3b8b3..a855fe321 100644 --- a/main/plugins/pyroplug.py +++ b/main/plugins/pyroplug.py @@ -218,6 +218,7 @@ async def get_msg(userbot, client, bot, sender, edit_id, msg_link, i): await client.copy_message(sender, chat, msg_id) except Exception as e: if "Empty messages cannot be copied" in str(e): + await edit.delete() group = await userbot.get_users(chat) group_link = f't.me/c/{int(group.id)}/{int(msg_id)}' return await get_msg(userbot, client, bot, sender, edit_id, msg_link, i) From 37b6db92a4a69767c83f36e9d3d1d329d5301091 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Tue, 30 May 2023 14:14:14 +0530 Subject: [PATCH 397/410] Update pyroplug.py --- main/plugins/pyroplug.py | 1 - 1 file changed, 1 deletion(-) diff --git a/main/plugins/pyroplug.py b/main/plugins/pyroplug.py index a855fe321..1edb3b8b3 100644 --- a/main/plugins/pyroplug.py +++ b/main/plugins/pyroplug.py @@ -218,7 +218,6 @@ async def get_msg(userbot, client, bot, sender, edit_id, msg_link, i): await client.copy_message(sender, chat, msg_id) except Exception as e: if "Empty messages cannot be copied" in str(e): - await edit.delete() group = await userbot.get_users(chat) group_link = f't.me/c/{int(group.id)}/{int(msg_id)}' return await get_msg(userbot, client, bot, sender, edit_id, msg_link, i) From 7da270f04f72926d7d9f8f520519177a28f75711 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sat, 10 Jun 2023 16:00:19 +0530 Subject: [PATCH 398/410] Update pyroplug.py --- main/plugins/pyroplug.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/main/plugins/pyroplug.py b/main/plugins/pyroplug.py index 1edb3b8b3..756e35600 100644 --- a/main/plugins/pyroplug.py +++ b/main/plugins/pyroplug.py @@ -171,7 +171,8 @@ async def get_msg(userbot, client, bot, sender, edit_id, msg_link, i): except Exception: return return - elif "SaveBigFilePartRequest" in str(e): + elif "SaveBigFilePartRequest" in str(e) or "SendMediaRequest" in str(e) \ + or str(e) == "File size equals to 0 B": try: if msg.media==MessageMediaType.VIDEO and msg.video.mime_type in ["video/mp4", "video/x-matroska"]: UT = time.time() @@ -215,15 +216,15 @@ async def get_msg(userbot, client, bot, sender, edit_id, msg_link, i): edit = await client.edit_message_text(sender, edit_id, "Cloning.") chat = msg_link.split("/")[-2] try: - await client.copy_message(sender, chat, msg_id) - except Exception as e: - if "Empty messages cannot be copied" in str(e): + if msg.empty: group = await userbot.get_users(chat) group_link = f't.me/c/{int(group.id)}/{int(msg_id)}' + #recurrsion return await get_msg(userbot, client, bot, sender, edit_id, msg_link, i) - else: - print(e) - return await client.edit_message_text(sender, edit_id, f'Failed to save: `{msg_link}`\n\nError: {str(e)}') + await client.copy_message(sender, chat, msg_id) + except Exception as e: + print(e) + return await client.edit_message_text(sender, edit_id, f'Failed to save: `{msg_link}`\n\nError: {str(e)}') await edit.delete() async def get_bulk_msg(userbot, client, sender, msg_link, i): From c8b139d4ff1c41d6ff838499e02c3a9a9a8e3486 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Mon, 12 Jun 2023 15:23:40 +0530 Subject: [PATCH 399/410] Update pyroplug.py --- main/plugins/pyroplug.py | 30 +++--------------------------- 1 file changed, 3 insertions(+), 27 deletions(-) diff --git a/main/plugins/pyroplug.py b/main/plugins/pyroplug.py index 756e35600..7bd064f70 100644 --- a/main/plugins/pyroplug.py +++ b/main/plugins/pyroplug.py @@ -146,32 +146,9 @@ async def get_msg(userbot, client, bot, sender, edit_id, msg_link, i): return except Exception as e: print(e) - if "messages.SendMedia" in str(e): - try: - if msg.media==MessageMediaType.VIDEO and msg.video.mime_type in ["video/mp4", "video/x-matroska"]: - UT = time.time() - uploader = await fast_upload(f'{file}', f'{file}', UT, bot, edit, '**UPLOADING:**') - attributes = [DocumentAttributeVideo(duration=duration, w=width, h=height, round_message=round_message, supports_streaming=True)] - await bot.send_file(sender, uploader, caption=caption, thumb=thumb_path, attributes=attributes, force_document=False) - elif msg.media==MessageMediaType.VIDEO_NOTE: - uploader = await fast_upload(f'{file}', f'{file}', UT, bot, edit, '**UPLOADING:**') - attributes = [DocumentAttributeVideo(duration=duration, w=width, h=height, round_message=round_message, supports_streaming=True)] - await bot.send_file(sender, uploader, caption=caption, thumb=thumb_path, attributes=attributes, force_document=False) - else: - UT = time.time() - uploader = await fast_upload(f'{file}', f'{file}', UT, bot, edit, '**UPLOADING:**') - await bot.send_file(sender, uploader, caption=caption, thumb=thumb_path, force_document=True) - if os.path.isfile(file) == True: - os.remove(file) - except Exception as e: - print(e) - await client.edit_message_text(sender, edit_id, f'Failed to save: `{msg_link}`\n\nError: {str(e)}') - try: - os.remove(file) - except Exception: - return - return - elif "SaveBigFilePartRequest" in str(e) or "SendMediaRequest" in str(e) \ + if "messages.SendMedia" in str(e) \ + or "SaveBigFilePartRequest" in str(e) \ + or "SendMediaRequest" in str(e) \ or str(e) == "File size equals to 0 B": try: if msg.media==MessageMediaType.VIDEO and msg.video.mime_type in ["video/mp4", "video/x-matroska"]: @@ -190,7 +167,6 @@ async def get_msg(userbot, client, bot, sender, edit_id, msg_link, i): if os.path.isfile(file) == True: os.remove(file) except Exception as e: - print("Telethon tried but failed!") print(e) await client.edit_message_text(sender, edit_id, f'Failed to save: `{msg_link}`\n\nError: {str(e)}') try: From f0725a28341df2d6cdd0fc067b4eecc79d9cbfcd Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Fri, 14 Jul 2023 13:34:11 +0530 Subject: [PATCH 400/410] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2753dc035..6d6173389 100644 --- a/README.md +++ b/README.md @@ -64,7 +64,7 @@ python3 -m main - if you want bot to be running in background then enter `screen -S srcb` before `python3 -m main` - after `python3 -m main`, click ctrl+A, ctrl+D -- if you want to stop bot, then enter `screen -r srcb` and click ctrl+A then press K and enter Y. +- if you want to stop bot, then enter `screen -r srcb` and to kill screen enter `screen -S srcb -X quit`. Deploy your bot on `Render` From 104ec21a2c4683d19798703e7afa022dddc3ff50 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sat, 7 Oct 2023 23:21:28 +0530 Subject: [PATCH 401/410] Update pyroplug.py --- main/plugins/pyroplug.py | 1 + 1 file changed, 1 insertion(+) diff --git a/main/plugins/pyroplug.py b/main/plugins/pyroplug.py index 7bd064f70..ffe3adaaf 100644 --- a/main/plugins/pyroplug.py +++ b/main/plugins/pyroplug.py @@ -4,6 +4,7 @@ from .. import bot as Drone from main.plugins.progress import progress_for_pyrogram +from main.plugins.helpers import screenshot from pyrogram import Client, filters from pyrogram.errors import ChannelBanned, ChannelInvalid, ChannelPrivate, ChatIdInvalid, ChatInvalid From f08e55f1510f37d4f784012a9447cf949c93bbfd Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sat, 7 Oct 2023 23:22:32 +0530 Subject: [PATCH 402/410] Update requirements.txt --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index f3c32f613..48fcbc6ff 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,7 +1,7 @@ #Github.com-Vasusen-code https://github.com/vasusen-code/Telethon/archive/refs/tags/v1.24.0.zip -https://github.com/vasusen-code/ethon/archive/refs/tags/v0.1.4.zip +https://github.com/vasusen-code/ethon/archive/refs/tags/v0.1.5.zip cryptg tgcrypto pyrogram From 25bf4758b0dd00e8dc7bbb840b91238b668581f1 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sat, 7 Oct 2023 23:55:54 +0530 Subject: [PATCH 403/410] Update pyroplug.py --- main/plugins/pyroplug.py | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/main/plugins/pyroplug.py b/main/plugins/pyroplug.py index ffe3adaaf..82c53efdf 100644 --- a/main/plugins/pyroplug.py +++ b/main/plugins/pyroplug.py @@ -33,7 +33,7 @@ async def get_msg(userbot, client, bot, sender, edit_id, msg_link, i): msg_link = msg_link.split("?single")[0] msg_id = int(msg_link.split("/")[-1]) + int(i) height, width, duration, thumb_path = 90, 90, 0, None - if 't.me/c/' in msg_link: + if 't.me/c/' or 't.me/b/' in msg_link: if 't.me/b/' in msg_link: chat = str(msg_link.split("/")[-2]) else: @@ -145,6 +145,14 @@ async def get_msg(userbot, client, bot, sender, edit_id, msg_link, i): except (ChannelBanned, ChannelInvalid, ChannelPrivate, ChatIdInvalid, ChatInvalid): await client.edit_message_text(sender, edit_id, "Have you joined the channel?") return + except PeerIdInvalid: + chat = int(msg_link.split("/")[-3]) + new_link = f"t.me/c/{chat}/{msg_id}" + try: + int(chat) + except ValueError: + new_link = f"t.me/b/{chat}/{msg_id}" + return await get_msg(userbot, client, bot, sender, to, edit_id, new_link, i) except Exception as e: print(e) if "messages.SendMedia" in str(e) \ @@ -193,12 +201,11 @@ async def get_msg(userbot, client, bot, sender, edit_id, msg_link, i): edit = await client.edit_message_text(sender, edit_id, "Cloning.") chat = msg_link.split("/")[-2] try: + msg = await client.copy_message(sender, chat, msg_id) if msg.empty: - group = await userbot.get_users(chat) - group_link = f't.me/c/{int(group.id)}/{int(msg_id)}' + new_link = f't.me/b/{chat}/{int(msg_id)}' #recurrsion - return await get_msg(userbot, client, bot, sender, edit_id, msg_link, i) - await client.copy_message(sender, chat, msg_id) + return await get_msg(userbot, client, bot, sender, edit_id, new_link, i) except Exception as e: print(e) return await client.edit_message_text(sender, edit_id, f'Failed to save: `{msg_link}`\n\nError: {str(e)}') From 1fb3f9a20f8cff0d908176b4829cd3b79c3cf188 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sun, 8 Oct 2023 00:03:12 +0530 Subject: [PATCH 404/410] Update README.md --- README.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 6d6173389..1ab46fef1 100644 --- a/README.md +++ b/README.md @@ -10,11 +10,12 @@ A stable telegram bot to get restricted messages with custom thumbnail support , - Custom thumbnail support for Pvt medias - supports text and webpage media messages - Faster speed -- Forcesubscribe available +- Forcesubscribe available +- To save from bots send link in this format : `t.me/b/bot_username/message_id` (use plus messenger for message_id) - `/batch` - (For owner only) Use this command to save upto 100 files from a pvt or public restricted channel at once. - `/cancel` - Use this to stop batch - Time delay is added to avoid FloodWait and keep user account safe. - + # Variables - `API_ID` @@ -28,7 +29,7 @@ A stable telegram bot to get restricted messages with custom thumbnail support , API: [API scrapper Bot](https://t.me/USETGSBOT) or [Telegram.org](https://my.telegram.org/auth) -PYROGRAM SESSION: [SessionGen Bot](https://t.me/SessionStringGeneratorZBot) or [![Run on Repl.it](https://replit.com/badge/github/vasusen-code/saverestrictedcontentbot)](https://replit.com/@levinalab/Session-Generator#main.py) +PYROGRAM SESSION: [SessionGen Bot](https://t.me/SessionStringGeneratorRobot) or [![Run on Repl.it](https://replit.com/badge/github/vasusen-code/saverestrictedcontentbot)](https://replit.com/@levinalab/Session-Generator#main.py) BOT TOKEN: @Botfather on telegram From 3198b49d31bc802ad819a69a19f793ef764a5446 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sun, 8 Oct 2023 00:07:54 +0530 Subject: [PATCH 405/410] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1ab46fef1..7b51f54c9 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ Contact: [Telegram](https://t.me/MaheshChauhan) A stable telegram bot to get restricted messages with custom thumbnail support , made by Mahesh Chauhan. -- works for both public and private channels +- works for both public and private chats - Custom thumbnail support for Pvt medias - supports text and webpage media messages - Faster speed From b1261427a682058bac5082fab1a5508a78b1bf0f Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Sun, 8 Oct 2023 10:56:28 +0530 Subject: [PATCH 406/410] Update frontend.py --- main/plugins/frontend.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/plugins/frontend.py b/main/plugins/frontend.py index 90d04b9fa..b35c84ea0 100644 --- a/main/plugins/frontend.py +++ b/main/plugins/frontend.py @@ -6,7 +6,7 @@ from .. import userbot, Bot from .. import FORCESUB as fs from main.plugins.pyroplug import get_msg -from main.plugins.helpers import get_link, join, screenshot +from main.plugins.helpers import get_link, join from telethon import events from pyrogram.errors import FloodWait From 57cb62d5766466903d375912910c9cc9671fc60e Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Wed, 11 Oct 2023 04:12:34 +0530 Subject: [PATCH 407/410] Update pyroplug.py --- main/plugins/pyroplug.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/main/plugins/pyroplug.py b/main/plugins/pyroplug.py index 82c53efdf..548b2545d 100644 --- a/main/plugins/pyroplug.py +++ b/main/plugins/pyroplug.py @@ -7,7 +7,7 @@ from main.plugins.helpers import screenshot from pyrogram import Client, filters -from pyrogram.errors import ChannelBanned, ChannelInvalid, ChannelPrivate, ChatIdInvalid, ChatInvalid +from pyrogram.errors import ChannelBanned, ChannelInvalid, ChannelPrivate, ChatIdInvalid, ChatInvalid, PeerIdInvalid from pyrogram.enums import MessageMediaType from ethon.pyfunc import video_metadata from ethon.telefunc import fast_upload @@ -146,10 +146,10 @@ async def get_msg(userbot, client, bot, sender, edit_id, msg_link, i): await client.edit_message_text(sender, edit_id, "Have you joined the channel?") return except PeerIdInvalid: - chat = int(msg_link.split("/")[-3]) - new_link = f"t.me/c/{chat}/{msg_id}" + chat = msg_link.split("/")[-3] try: int(chat) + new_link = f"t.me/c/{chat}/{msg_id}" except ValueError: new_link = f"t.me/b/{chat}/{msg_id}" return await get_msg(userbot, client, bot, sender, to, edit_id, new_link, i) @@ -199,7 +199,7 @@ async def get_msg(userbot, client, bot, sender, edit_id, msg_link, i): await edit.delete() else: edit = await client.edit_message_text(sender, edit_id, "Cloning.") - chat = msg_link.split("/")[-2] + chat = msg_link.split("t.me")[1].split("/")[1] try: msg = await client.copy_message(sender, chat, msg_id) if msg.empty: From 699326ff9e04fbbb93ff96b808b3e94e28be64a4 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Wed, 11 Oct 2023 23:15:34 +0530 Subject: [PATCH 408/410] Update pyroplug.py --- main/plugins/pyroplug.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main/plugins/pyroplug.py b/main/plugins/pyroplug.py index 548b2545d..b6ecf5c89 100644 --- a/main/plugins/pyroplug.py +++ b/main/plugins/pyroplug.py @@ -150,9 +150,9 @@ async def get_msg(userbot, client, bot, sender, edit_id, msg_link, i): try: int(chat) new_link = f"t.me/c/{chat}/{msg_id}" - except ValueError: + except: new_link = f"t.me/b/{chat}/{msg_id}" - return await get_msg(userbot, client, bot, sender, to, edit_id, new_link, i) + return await get_msg(userbot, client, bot, sender, edit_id, msg_link, i) except Exception as e: print(e) if "messages.SendMedia" in str(e) \ From d82f9163b4a5e8ae2cd5d1bcb2458cf03e91e81d Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Mon, 23 Oct 2023 16:34:16 +0530 Subject: [PATCH 409/410] Update pyroplug.py --- main/plugins/pyroplug.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/main/plugins/pyroplug.py b/main/plugins/pyroplug.py index b6ecf5c89..ce596618f 100644 --- a/main/plugins/pyroplug.py +++ b/main/plugins/pyroplug.py @@ -201,11 +201,12 @@ async def get_msg(userbot, client, bot, sender, edit_id, msg_link, i): edit = await client.edit_message_text(sender, edit_id, "Cloning.") chat = msg_link.split("t.me")[1].split("/")[1] try: - msg = await client.copy_message(sender, chat, msg_id) + msg = await client.get_messages(chat, msg_id) if msg.empty: new_link = f't.me/b/{chat}/{int(msg_id)}' #recurrsion return await get_msg(userbot, client, bot, sender, edit_id, new_link, i) + await client.copy_message(sender, chat, msg_id) except Exception as e: print(e) return await client.edit_message_text(sender, edit_id, f'Failed to save: `{msg_link}`\n\nError: {str(e)}') From 1671e47f410507d4bcd92cc25d2896bcbfb1ee98 Mon Sep 17 00:00:00 2001 From: Mahesh Chauhan <84653476+vasusen-code@users.noreply.github.com> Date: Mon, 27 Nov 2023 13:55:35 +0530 Subject: [PATCH 410/410] Update pyroplug.py --- main/plugins/pyroplug.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/plugins/pyroplug.py b/main/plugins/pyroplug.py index ce596618f..1e608e86a 100644 --- a/main/plugins/pyroplug.py +++ b/main/plugins/pyroplug.py @@ -206,7 +206,7 @@ async def get_msg(userbot, client, bot, sender, edit_id, msg_link, i): new_link = f't.me/b/{chat}/{int(msg_id)}' #recurrsion return await get_msg(userbot, client, bot, sender, edit_id, new_link, i) - await client.copy_message(sender, chat, msg_id) + await client.copy_message(sender, chat, msg_id) except Exception as e: print(e) return await client.edit_message_text(sender, edit_id, f'Failed to save: `{msg_link}`\n\nError: {str(e)}')