Skip to content

A stable telegram bot to get restricted messages with custom thumbnail support , made by TEAM SPY This bot can run in channels directly + YouTube video downloading support along with 30+ more sites

Notifications You must be signed in to change notification settings

devgaganin/Save-Restricted-Content-Bot-V2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

V3 branch | Summer Release V2

Telegram | See Recent Updates

๐Ÿ“š About This Branch

This branch is based on Pyrogram V2 offering enhanced stability and a forced login feature. Users must log in to use the bot. For no-login usage, consider the v4 branch.

โš ๏ธ Must Do: Secure Your Sensitive Variables

Do not expose sensitive variables (e.g., API_ID, API_HASH, BOT_TOKEN) on GitHub. Use environment variables to keep them secure.

Configuring Variables Securely:

  • On VPS or Local Machine:

    • Use a text editor to edit config.py:
      nano config.py
    • Alternatively, export as environment variables:
      export API_ID=your_api_id
      export API_HASH=your_api_hash
      export BOT_TOKEN=your_bot_token
  • For Cloud Platforms (Heroku, Railway, etc.):

    • Set environment variables directly in your platformโ€™s dashboard.
  • Using .env File:

    • Create a .env file and add your credentials:
      API_ID=your_api_id
      API_HASH=your_api_hash
      BOT_TOKEN=your_bot_token
      
    • Make sure to add .env to .gitignore to prevent it from being pushed to GitHub.

Why This is Important? Your credentials can be stolen if pushed to a public repository. Always keep them secure by using environment variables or local configuration files.


โšก Commands

  • start: ๐Ÿš€ Start the bot.
  • batch: ๐Ÿซ  Extract in bulk.
  • login: ๐Ÿ”‘ Get into the bot.
  • logout: ๐Ÿšช Get out of the bot.
  • token: ๐ŸŽฒ Get 3 hours of free access.
  • adl: ๐Ÿ‘ป Download audio from 30+ sites.
  • dl: ๐Ÿ’€ Download videos from 30+ sites.
  • transfer: ๐Ÿ’˜ Gift premium to others.
  • myplan: โŒ› Get your plan details.
  • add: โž• Add user to premium.
  • rem: โž– Remove user from premium.
  • session: ๐Ÿงต Generate Pyrogramv2 session.
  • settings: โš™๏ธ Personalize settings.
  • stats: ๐Ÿ“Š Get stats of the bot.
  • plan: ๐Ÿ—“๏ธ Check our premium plans.
  • terms: ๐Ÿฅบ Terms and conditions.
  • speedtest: ๐Ÿš… Check the server speed.
  • get: ๐Ÿ—„๏ธ Get all user IDs.
  • lock: ๐Ÿ”’ Protect channel from extraction.
  • gcast: โšก Broadcast message to bot users.
  • help: โ“ Help if you're new.
  • cancel: ๐Ÿšซ Cancel batch process.

๐Ÿ”ง Features

  • Extract content from both public and private channels/groups.
  • Rename and forward content to other channels or users.
  • Custom captions and thumbnails.
  • Auto-remove default video thumbnails.
  • Delete or replace words in filenames and captions.
  • Auto-pin messages if enabled.
  • download yt/insta normal ytdlp supported sites that supports best format
  • Login via phone number.
  • Supports 4GB file uploads: The bot can handle large file uploads, up to 4GB in size.
  • Enhanced Timer: Distinct timers for free and paid users to limit usage and improve service.
  • Improved Looping: Optimized looping for processing multiple files or links, reducing delays and enhancing performance.
  • Premium Access: Premium users enjoy faster processing speeds and priority queue management.

โš™๏ธ Required Variables

Click to view required variables

To run the bot, you'll need to configure a few sensitive variables. Here's how to set them up securely:

  • API_ID: Your API ID from telegram.org.
  • API_HASH: Your API Hash from telegram.org.
  • BOT_TOKEN: Get your bot token from @BotFather.
  • OWNER_ID: Use @missrose_bot to get your user ID by sending /info.
  • CHANNEL_ID: The ID of the channel for forced subscription.
  • LOG_GROUP: A group or channel where the bot logs messages. Forward a message to @userinfobot to get your channel/group ID.
  • MONGO_DB: A MongoDB URL for storing session data (recommended for security).

Additional Configuration Options:

  • STRING: (Optional) Add your premium account session string here to allow 4GB file uploads. This is optional and can be left empty if not used.
  • FREEMIUM_LIMIT: Default is 0. Set this to any value you want to allow free users to extract content. If set to 0, free users will not have access to any extraction features.
  • PREMIUM_LIMIT: Default is 500. This is the batch limit for premium users. You can customize this to allow premium users to process more links/files in one batch.
  • YT_COOKIES: Yt cookies for downloading yt videos
  • INSTA_COOKIES: If you want to enable instagram downloading fill cookiesn

** How to get cookies ??** : use mozila firfox if on android or use chrome on desktop and download extension get this cookie or any Netscape Cookies (HTTP Cookies) extractor and use that

Monetization (Optional):

  • WEBSITE_URL: (Optional) This is the domain for your monetization short link service. Provide the shortener's domain name, for example: upshrink.com. Do not include www or https://. The default link shortener is already set.
  • AD_API: (Optional) The API key from your link shortener service (e.g., Upshrink, AdFly, etc.) to monetize links. Enter the API provided by your shortener.

Important: Always keep your credentials secure! Never hard-code them in the repository. Use environment variables or a .env file.


๐Ÿš€ Deployment Guide

Deploy on VPS
  1. Fork the repo.
  2. Update config.py with your values.
  3. Run the following:
    sudo apt update
    sudo apt install ffmpeg git python3-pip
    git clone your_repo_link
    cd your_repo_name
    pip3 install -r requirements.txt
    python3 -m devgagan
  • To run the bot in the background:
    screen -S gagan
    python3 -m devgagan
    • Detach: Ctrl + A, then Ctrl + D
    • To stop: screen -r gagan and screen -S gagan -X quit
Deploy on Heroku
  1. Fork and Star the repo.
  2. Click Deploy on Heroku.
  3. Enter required variables and click deploy โœ….
Deploy on Render
  1. Fork and star the repo.
  2. Edit config.py or set environment variables on Render.
  3. Go to render.com, sign up/log in.
  4. Create a new web service, select the free plan.
  5. Connect your GitHub repo and deploy โœ….
Deploy on Koyeb
  1. Fork and star the repo.
  2. Edit config.py or set environment variables on Koyeb.
  3. Create a new service, select Dockerfile as build type.
  4. Connect your GitHub repo and deploy โœ….

Updates

Update: 24 DEC 2024

1. 4GB Upload Support

  • New feature: The bot now supports uploading files as large as 4GB. This is particularly useful for users working with larger media content.
  • How to enable: To allow 4GB file uploads, you must add your premium session string in the STRING variable in the config.py file. This session string is only required for premium users.

2. New Upload Method

  • A new, optimized upload method has been added for handling large file uploads more efficiently.
  • What changed: Previously, large files could cause slow uploads or issues. This method helps avoid those problems and ensures smoother processing.
  • Note: The upload method now handles large files seamlessly, reducing upload time and improving performance.

3. Fixed Blocking Issue

  • Resolved blocking issues: We identified and fixed an issue that caused the bot to get blocked during the extraction or upload process, particularly when processing certain content.
  • How it works now: The bot will continue to process and extract content without interruptions or blocks, improving reliability and reducing downtime.

4. Added /token Method

  • New command: A new /token method has been added for short link functionality. This command generates a token for using monetization features.
  • Configuration:
    • To use this feature, you must configure the API key and URL for your short link provider.
    • Fill in the AD_API (API key) and WEBSITE_URL (short link service domain) in the config.py.
    • Note: This feature is optional and only needed if you plan to use the bot for monetizing links.

5. Spylib Integration

  • Spylib added: We have integrated Spylib functionality to enhance certain features. Spylib helps improve the botโ€™s ability to extract and handle content.
  • How to set up: For details on how to configure Spylib, refer to the Spylib Code Section in the README for a step-by-step guide.

6. Fixed Button Issues

  • Fixed broken button functionality: There were issues where the botโ€™s buttons were not responding or clicking properly. This has been resolved, and now the buttons will work as expected.
  • Whatโ€™s fixed: Buttons for commands like /start, /help, /cancel, and others should now work smoothly. 7. Added ytdlp back in this version:
  • You can use command /dl or /adl for enabling this fill up ytdlp vars i.e. YT_COOKIES and INSTA_COOKIES

๐Ÿ›  Important Changes and Notes

1. Filename Deletion Behavior

  • Delete Word Behavior:

    • If a word is added to the "delete words list", it will not be used in the filename. This ensures that unwanted words are completely excluded from the filenames.
    • Example: If the word deleteword is added to the list, it will not appear in the filename under any circumstances.
  • Whatโ€™s the catch:

    • The delete word functionality now applies specifically to filenames only.
    • For captions, you should use the replacement method (using spaces as a separator).

2. Deleting Words in Captions

  • How to delete words in captions:
    • If you want to delete words from captions, you should use the replacement method, where the word will be replaced with a space (<space>).
    • This will ensure that words are replaced or deleted from captions but not filenames.
    • Example:
      • If you have the word deleteword in the caption, you can configure it in the replacement list like:
        • 'deleteword' '<space>'.
      • This will replace deleteword with an empty space in the caption.

3. More About the /token Method

  • How to use:
    • After configuring the AD_API and WEBSITE_URL in the config.py file, use the /token command to generate short links.
    • This allows you to generate monetized links for users, where you can set up a link shortener (e.g., UpShrink, AdFly) and monetize the botโ€™s links.
  • Why use it: This is helpful for people who want to earn revenue from the links processed by the bot. It's fully configurable, and you can integrate it with any supported short link provider.

4. Other Fixes and Improvements

  • Improved handling for batch processes: The bot now handles batch processes more effectively and allows users to process multiple links at once.
  • Bug fixes: Several minor bugs related to session management and batch cancellations have been addressed, ensuring a smoother user experience.

โš™๏ธ How to Configure</summary

  • Set up STRING for 4GB Upload:

    • If you want to upload large files (up to 4GB), make sure to add your premium session string(PYROGRAM V2) in the STRING variable in config.py. This is optional and only needed for premium owner who want to allow 4GB upload.
  • Set up AD_API and WEBSITE_URL for Monetization:

    • To use the link shortener service for monetization, collect the API key and website URL from your shortener provider (e.g., UpShrink, AdFly) and add them to the AD_API and WEBSITE_URL variables in config.py.
  • Delete Word Configuration:

    • If you wish to configure words to be deleted from filenames, list them in the delete word list.
    • For captions, use the replacement method where words will be replaced with <space>.
Update: 21 NOV 2024
  • Public Channels: Removed login requirement for processing links from public channels.
  • Batch Size Limits: New variables FREEMIUM_LIMIT and PREMIUM_LIMIT to manage batch sizes based on user type.
  • Important Note: Set FREEMIUM_LIMIT to 0 to restrict link extraction.
Update: 20 NOV 2024
  • Batch Processing: Prevents overlapping batch processes.
  • UserBot Management: Safely stops userbot after all processes.
  • Bug Fixes: Fixed issues with userbot stopping and overlapping processes.
Update: 16 NOV 2024
  • Fixed issues with .MOV file handling and file renaming.
  • Improved caption formatting.
Update: 15 NOV 2024
  • Fixed reset button.
  • Added support for topic-based groups.
Update: 16 AUG 2024
  • Added /logout command to clear session data.
  • Fixed premium membership expiration.
Update: 7 JULY 2024
  • Introduced /login via phone number.
  • Added auto-pinning of messages and other improvements.

๐Ÿ› ๏ธ Terms of Use

Visit the Terms of Use page to review and accept the guidelines.

Important Note

Note: Changing the terms and commands doesn't magically make you a developer. Real development involves understanding the code, writing new functionalities, and debugging issues, not just renaming things. If only it were that easy!

Contributers

My group members contact... Join @save_restricted_content_bots to know them.

Thanks!

About

A stable telegram bot to get restricted messages with custom thumbnail support , made by TEAM SPY This bot can run in channels directly + YouTube video downloading support along with 30+ more sites

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages