From f5da47fc2da0c0ff09a8cbda2aaf57195f29b68d Mon Sep 17 00:00:00 2001 From: nileshya <72087983+nileshya@users.noreply.github.com> Date: Sat, 19 Aug 2023 00:02:51 +0530 Subject: [PATCH 01/13] Update requirements.txt --- requirements.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/requirements.txt b/requirements.txt index f3c32f613..cc9119254 100644 --- a/requirements.txt +++ b/requirements.txt @@ -6,3 +6,6 @@ cryptg tgcrypto pyrogram python-decouple +Flask==2.2.2 +gunicorn==20.1.0 +aiohttp==3.8.1 From 006418e3e9cec032397bf916838fffdee6990b1b Mon Sep 17 00:00:00 2001 From: nileshya <72087983+nileshya@users.noreply.github.com> Date: Sat, 19 Aug 2023 00:07:26 +0530 Subject: [PATCH 02/13] Add files via upload --- app.py | 10 ++++++++++ run cmd.txt | 1 + 2 files changed, 11 insertions(+) create mode 100644 app.py create mode 100644 run cmd.txt diff --git a/app.py b/app.py new file mode 100644 index 000000000..a926a9617 --- /dev/null +++ b/app.py @@ -0,0 +1,10 @@ +from flask import Flask +app = Flask(__name__) + +@app.route('/') +def hello_world(): + return 'GreyMatters' + + +if __name__ == "__main__": + app.run() diff --git a/run cmd.txt b/run cmd.txt new file mode 100644 index 000000000..dc874b6b7 --- /dev/null +++ b/run cmd.txt @@ -0,0 +1 @@ +gunicorn app:app & python -m main From 43768558af70eb00265d927ffd6500337f79410b Mon Sep 17 00:00:00 2001 From: nileshya <72087983+nileshya@users.noreply.github.com> Date: Sat, 19 Aug 2023 07:00:05 +0530 Subject: [PATCH 03/13] Update app.json --- app.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app.json b/app.json index 3252378af..87bcac672 100644 --- a/app.json +++ b/app.json @@ -7,9 +7,9 @@ "Save restricted content", "bot" ], - "repository": "https://github.com/vasusen-code/SaveRestrictedContentBot", + "repository": "https://github.com/nileshya/SaveRestrictedContentBot", "website": "", - "success_url": "https://t.me/DroneBots", + "success_url": "https://t.me/tdbuf3", "env": { "API_HASH": { "description": "Your API HASH from my.telegram.org", From 927a0d31973260ad34706cb418f60b15e00ceb35 Mon Sep 17 00:00:00 2001 From: nileshya <72087983+nileshya@users.noreply.github.com> Date: Sat, 19 Aug 2023 09:14:34 +0530 Subject: [PATCH 04/13] Delete README.md --- README.md | 98 ------------------------------------------------------- 1 file changed, 98 deletions(-) delete mode 100644 README.md diff --git a/README.md b/README.md deleted file mode 100644 index 6d6173389..000000000 --- a/README.md +++ /dev/null @@ -1,98 +0,0 @@ -

- Save restricted content Bot -

- -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 -- Custom thumbnail support for Pvt medias -- 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 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` -- `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 & PYROGRAM string session from: - -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) - -BOT TOKEN: @Botfather on telegram - -# Deploy - -Deploy on `VPS` - -Easy Method: - -- 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 -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 in this [picture](https://t.me/MaheshChauhan/36) -- 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, ctrl+D -- 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` - -Tutorial - [Click here](https://telegra.ph/SRCB-on-Render-05-17) - -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 -- add buildpacks -- connect to github and deploy -- turn on dynos - -Buildpacks for manual deploy: - -- `heroku/python` -- `https://github.com/jonathanong/heroku-buildpack-ffmpeg-latest.git` - -Deploy your bot on `Okteto` [Useless] - -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 1ec813f008662b559a57801537ef22dd85636c18 Mon Sep 17 00:00:00 2001 From: nileshya <72087983+nileshya@users.noreply.github.com> Date: Tue, 29 Aug 2023 12:45:27 +0530 Subject: [PATCH 05/13] Update requirements.txt --- requirements.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/requirements.txt b/requirements.txt index cc9119254..979a68cc5 100644 --- a/requirements.txt +++ b/requirements.txt @@ -6,6 +6,6 @@ cryptg tgcrypto pyrogram python-decouple -Flask==2.2.2 +Flask==2.2.5 gunicorn==20.1.0 -aiohttp==3.8.1 +aiohttp==3.8.5 From e94198e63604ad3db3f9f458600e7a9c059e6918 Mon Sep 17 00:00:00 2001 From: nileshya <72087983+nileshya@users.noreply.github.com> Date: Tue, 29 Aug 2023 12:48:35 +0530 Subject: [PATCH 06/13] Update requirements.txt --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 979a68cc5..268ee880b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -7,5 +7,5 @@ tgcrypto pyrogram python-decouple Flask==2.2.5 -gunicorn==20.1.0 +gunicorn==21.2.0 aiohttp==3.8.5 From 99ebe9b806c8f7a285e21515542c1400e7aa5eb4 Mon Sep 17 00:00:00 2001 From: nileshya <72087983+nileshya@users.noreply.github.com> Date: Sat, 3 Feb 2024 08:35:26 +0530 Subject: [PATCH 07/13] Add files via upload --- gitignore.txt | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 gitignore.txt diff --git a/gitignore.txt b/gitignore.txt new file mode 100644 index 000000000..fd4f2b066 --- /dev/null +++ b/gitignore.txt @@ -0,0 +1,2 @@ +node_modules +.DS_Store From fef67c185318d235e2a1792d4771592682b2411b Mon Sep 17 00:00:00 2001 From: nileshya <72087983+nileshya@users.noreply.github.com> Date: Sat, 3 Feb 2024 08:38:07 +0530 Subject: [PATCH 08/13] Rename gitignore.txt to .gitignore --- gitignore.txt => .gitignore | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename gitignore.txt => .gitignore (100%) diff --git a/gitignore.txt b/.gitignore similarity index 100% rename from gitignore.txt rename to .gitignore From 8142574b3189d55220dd3235aff8598110ad8bf4 Mon Sep 17 00:00:00 2001 From: nileshya <72087983+nileshya@users.noreply.github.com> Date: Fri, 23 Feb 2024 16:08:13 +0530 Subject: [PATCH 09/13] 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 fbe02c4a8dd0dfefc898c40eb216afa0645a4a02 Mon Sep 17 00:00:00 2001 From: nileshya <72087983+nileshya@users.noreply.github.com> Date: Fri, 23 Feb 2024 16:11:59 +0530 Subject: [PATCH 10/13] pyroplug.py --- main/plugins/pyroplug.py | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/main/plugins/pyroplug.py b/main/plugins/pyroplug.py index 7bd064f70..1e608e86a 100644 --- a/main/plugins/pyroplug.py +++ b/main/plugins/pyroplug.py @@ -4,9 +4,10 @@ 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 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 @@ -32,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: @@ -144,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 = msg_link.split("/")[-3] + try: + int(chat) + new_link = f"t.me/c/{chat}/{msg_id}" + except: + new_link = f"t.me/b/{chat}/{msg_id}" + 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) \ @@ -190,13 +199,13 @@ 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.get_messages(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) + 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) From 952522d061954ccd9eda2b991d5e1551ac54ba82 Mon Sep 17 00:00:00 2001 From: nileshya <72087983+nileshya@users.noreply.github.com> Date: Fri, 23 Feb 2024 16:15:16 +0530 Subject: [PATCH 11/13] requirements.txt --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 268ee880b..d7ffda53d 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 bd98fd6323b60ec6ad6212e8135ff7a6634331bb Mon Sep 17 00:00:00 2001 From: nileshya <72087983+nileshya@users.noreply.github.com> Date: Fri, 23 Feb 2024 16:16:36 +0530 Subject: [PATCH 12/13] Add files via upload --- README.md | 99 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 000000000..7b51f54c9 --- /dev/null +++ b/README.md @@ -0,0 +1,99 @@ +

+ Save restricted content Bot +

+ +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 chats +- Custom thumbnail support for Pvt medias +- supports text and webpage media messages +- Faster speed +- 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` +- `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 & PYROGRAM string session from: + +API: [API scrapper Bot](https://t.me/USETGSBOT) or [Telegram.org](https://my.telegram.org/auth) + +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 + +# Deploy + +Deploy on `VPS` + +Easy Method: + +- 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 +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 in this [picture](https://t.me/MaheshChauhan/36) +- 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, ctrl+D +- 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` + +Tutorial - [Click here](https://telegra.ph/SRCB-on-Render-05-17) + +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 +- add buildpacks +- connect to github and deploy +- turn on dynos + +Buildpacks for manual deploy: + +- `heroku/python` +- `https://github.com/jonathanong/heroku-buildpack-ffmpeg-latest.git` + +Deploy your bot on `Okteto` [Useless] + +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 7df6c647b1734f52a0615fc700a93d3a750c8749 Mon Sep 17 00:00:00 2001 From: nileshya <72087983+nileshya@users.noreply.github.com> Date: Sun, 26 Jan 2025 20:21:21 +0530 Subject: [PATCH 13/13] 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 1e608e86a..8110a8184 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/' or 't.me/b/' in msg_link: + 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: