diff --git a/Dockerfile b/Dockerfile index 4aac024..2d40edc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,7 +3,7 @@ FROM anasty17/megasdk:latest WORKDIR /usr/src/app RUN chmod 777 /usr/src/app -RUN apt-get install -y xz-utils neofetch unzip && apt-get autoremove -y +RUN apt-get install -y wget xz-utils neofetch unzip && apt-get autoremove -y COPY requirements.txt . RUN pip3 install --no-cache-dir -r requirements.txt diff --git a/README.md b/README.md index 344fcf9..210978f 100644 --- a/README.md +++ b/README.md @@ -1,34 +1,32 @@ [![Slam](https://telegra.ph/file/db03910496f06094f1f7a.jpg)](https://youtu.be/Pk_TthHfLeE) -# Slam Aria Mirror Bot -![GitHub Repo stars](https://img.shields.io/github/stars/breakdowns/slam-aria-mirror-bot?color=blue&style=flat) -![GitHub forks](https://img.shields.io/github/forks/breakdowns/slam-aria-mirror-bot?color=green&style=flat) -![GitHub issues](https://img.shields.io/github/issues/breakdowns/slam-aria-mirror-bot) -![GitHub closed issues](https://img.shields.io/github/issues-closed/breakdowns/slam-aria-mirror-bot) -![GitHub pull requests](https://img.shields.io/github/issues-pr/breakdowns/slam-aria-mirror-bot) -![GitHub closed pull requests](https://img.shields.io/github/issues-pr-closed/breakdowns/slam-aria-mirror-bot) -![GitHub watchers](https://img.shields.io/github/watchers/breakdowns/slam-aria-mirror-bot) -![GitHub contributors](https://img.shields.io/github/contributors/breakdowns/slam-aria-mirror-bot?style=flat) -![GitHub repo size](https://img.shields.io/github/repo-size/breakdowns/slam-aria-mirror-bot?color=red) -![GitHub commit activity](https://img.shields.io/github/commit-activity/m/breakdowns/slam-aria-mirror-bot) -![GitHub](https://img.shields.io/github/license/breakdowns/slam-aria-mirror-bot) -![Maintenance](https://img.shields.io/badge/Maintained%3F-yes-green.svg) -![Docker Pulls](https://img.shields.io/docker/pulls/breakdowns/mega-sdk-python?label=Docker%20Pull) +# Slam Tg Mirror Bot +![GitHub Repo stars](https://img.shields.io/github/stars/breakdowns/slam-tg-mirror-bot?color=blue&style=flat) +![GitHub forks](https://img.shields.io/github/forks/breakdowns/slam-tg-mirror-bot?color=green&style=flat) +![GitHub issues](https://img.shields.io/github/issues/breakdowns/slam-tg-mirror-bot) +![GitHub closed issues](https://img.shields.io/github/issues-closed/breakdowns/slam-tg-mirror-bot) +![GitHub pull requests](https://img.shields.io/github/issues-pr/breakdowns/slam-tg-mirror-bot) +![GitHub closed pull requests](https://img.shields.io/github/issues-pr-closed/breakdowns/slam-tg-mirror-bot) +![GitHub watchers](https://img.shields.io/github/watchers/breakdowns/slam-tg-mirror-bot) +![GitHub contributors](https://img.shields.io/github/contributors/breakdowns/slam-tg-mirror-bot?style=flat) +![GitHub repo size](https://img.shields.io/github/repo-size/breakdowns/slam-tg-mirror-bot?color=red) +![GitHub commit activity](https://img.shields.io/github/commit-activity/m/breakdowns/slam-tg-mirror-bot) +![GitHub](https://img.shields.io/github/license/breakdowns/slam-tg-mirror-bot) [![Channel](https://img.shields.io/badge/Join%20Channel-!-red)](https://t.me/SlamMirrorUpdates) -**Slam Aria Mirror Bot** is a _multipurpose_ Telegram Bot writen in Python for mirroring files on the Internet to our beloved Google Drive. +**Slam Tg Mirror Bot** is a _multipurpose_ Telegram Bot writen in Python for mirroring files on the Internet to our beloved Google Drive. # Features supported:
Click Here For More Details ## Additional Features +- qBittorrent supported - Updater (**NOTE**: You must upload your **token.pickle** to Index and fill your **token.pickle** url to **TOKEN_PICKLE_URL**, because your **token.pickle** will deleted after update, for more info please check [Setting up config file](https://github.com/breakdowns/slam-aria-mirror-bot/tree/master#setting-up-config-file)) - Limiting size Torrent/Direct, Tar/Unzip, Mega, cloning Google Drive support - Stop duplicate cloning Google Drive & mirroring Mega support - Tar/Unzip Google Drive link support - Sudo with Database support -- Multiple Trackers support - Extracting **tar.xz** support - Counting Google Drive link - Heroku config support @@ -81,7 +79,7 @@ Deploying is pretty much straight forward and is divided into several steps as f - Clone this repo: ``` -git clone https://github.com/breakdowns/slam-aria-mirror-bot mirrorbot/ +git clone https://github.com/breakdowns/slam-tg-mirror-bot mirrorbot/ cd mirrorbot ``` @@ -140,16 +138,16 @@ Fill up rest of the fields. Meaning of each fields are discussed below: - **DOWNLOAD_DIR**: The path to the local folder where the downloads should be downloaded to - **DOWNLOAD_STATUS_UPDATE_INTERVAL**: A short interval of time in seconds after which the Mirror progress message is updated. (I recommend to keep it `5` seconds at least) - **AUTO_DELETE_MESSAGE_DURATION**: Interval of time (in seconds), after which the bot deletes it's message (and command message) which is expected to be viewed instantly. (**Note**: Set to `-1` to never automatically delete messages) -- **UPSTREAM_REPO**: Link for Bot Upstream Repo, if you want default update, fill `https://github.com/breakdowns/slam-aria-mirror-bot`. +- **UPSTREAM_REPO**: Link for Bot Upstream Repo, if you want default update, fill `https://github.com/breakdowns/slam-tg-mirror-bot`. - **UPSTREAM_BRANCH**: Branch name for Bot Upstream Repo, fill `master`. ### Optional Field - **ACCOUNTS_ZIP_URL**: Only if you want to load your Service Account externally from an Index Link. Archive your Service Account json files to a zip file directly (don't archive the accounts folder. Select all the jsons inside and zip them only instead. Name the zip file with whatever you want, it doesn't matter). Fill this with the direct link of that file. - **TOKEN_PICKLE_URL**: Only if you want to load your **token.pickle** externally from an Index Link. Fill this with the direct link of that file. -- **DATABASE_URL**: Your Database URL. See [Generate Database](https://github.com/breakdowns/slam-aria-mirror-bot/tree/master#generate-database) to generate database (**NOTE**: If you use database you can save your sudo id permanent using `/addsudo` command). +- **DATABASE_URL**: Your Database URL. See [Generate Database](https://github.com/breakdowns/slam-tg-mirror-bot/tree/master#generate-database) to generate database (**NOTE**: If you use database you can save your sudo id permanent using `/addsudo` command). - **AUTHORIZED_CHATS**: Fill user_id and chat_id (not username) of you want to authorize, Seprate them with space, Examples: `-0123456789 -1122334455 6915401739`. - **SUDO_USERS**: Fill user_id (not username) of you want to sudoers, Seprate them with space, Examples: `0123456789 1122334455 6915401739` (**NOTE**: If you want save sudo id permanent without database, you must fill your sudo id there). - **IS_TEAM_DRIVE**: Set to `True` if `GDRIVE_FOLDER_ID` is from a Team Drive else `False` or Leave it empty. -- **USE_SERVICE_ACCOUNTS**: (Leave empty if unsure) Whether to use Service Accounts or not. For this to work see [Using Service Accounts](https://github.com/breakdowns/slam-aria-mirror-bot#generate-service-accounts-what-is-service-account) section below. +- **USE_SERVICE_ACCOUNTS**: (Leave empty if unsure) Whether to use Service Accounts or not. For this to work see [Using Service Accounts](https://github.com/breakdowns/slam-tg-mirror-bot#generate-service-accounts-what-is-service-account) section below. - **INDEX_URL**: Refer to https://gitlab.com/ParveenBhadooOfficial/Google-Drive-Index The URL should not have any trailing '/' - **MEGA_API_KEY**: Mega.nz api key to mirror mega.nz links. Get it from [Mega SDK Page](https://mega.nz/sdk) - **MEGA_EMAIL_ID**: Your email id you used to sign up on mega.nz for using premium accounts (Leave th) @@ -167,6 +165,9 @@ Fill up rest of the fields. Meaning of each fields are discussed below: - **HEROKU_APP_NAME**: (Only if you deploying on Heroku) Your Heroku app name. - **IGNORE_PENDING_REQUESTS**: If you want the bot to ignore pending requests after it restarts, set this to `True`. - **STATUS_LIMIT**: Status limit with buttons (**NOTE**: Recommend limit status to `4` tasks max). +- **IS_VPS**: Set it to `True` if you use VPS. +- **SERVER_PORT**: For VPS +- **BASE_URL_OF_BOT**: Your app URL Examples: `https://yourappname.herokuapp.com` - **SHORTENER_API**: Fill your Shortener api key if you are using Shortener. - **SHORTENER**: if you want to use Shortener in Gdrive and index link, fill Shortener url here. Examples: ``` @@ -219,8 +220,8 @@ sudo docker run mirrorbot ## Deploying on Heroku -- Give stars and Fork this repo then upload **token.pickle** to your forks, or you can upload your **token.pickle** to your Index and put your **token.pickle** link to **TOKEN_PICKLE_URL** (**NOTE**: If you didn't upload **token.pickle** uploading will not work). How to generate **token.pickle**? [Read here](https://github.com/breakdowns/slam-aria-mirror-bot#getting-google-oauth-api-credential-file) -- Hit the **DEPLOY TO HEROKU** button and follow the further instructions in the screen (**NOTE**: If vars not coming, just change deploy link to your fork, Example: `https://dashboard.heroku.com/new?template=https://github.com/yourgithubname/slam-aria-mirror-bot`) +- Give stars and Fork this repo then upload **token.pickle** to your forks, or you can upload your **token.pickle** to your Index and put your **token.pickle** link to **TOKEN_PICKLE_URL** (**NOTE**: If you didn't upload **token.pickle** uploading will not work). How to generate **token.pickle**? [Read here](https://github.com/breakdowns/slam-tg-mirror-bot#getting-google-oauth-api-credential-file) +- Hit the **DEPLOY TO HEROKU** button and follow the further instructions in the screen (**NOTE**: If vars not coming, just change deploy link to your fork, Example: `https://dashboard.heroku.com/new?template=https://github.com/yourgithubname/slam-tg-mirror-bot`) - Recommended to use 1 App in 1 Heroku accounts

@@ -293,7 +294,7 @@ python3 gen_sa_accounts.py --download-keys project_id python3 add_to_team_drive.py -d SharedTeamDriveSrcID ``` -# Youtube-dl authentication using [.netrc](https://github.com/breakdowns/slam-aria-mirror-bot/blob/master/.netrc) file +# Youtube-dl authentication using [.netrc](https://github.com/breakdowns/slam-tg-mirror-bot/blob/master/.netrc) file For using your premium accounts in Youtube-dl or for protected Index Links, edit the netrc file according to following format: ``` machine host login username password my_youtube_password @@ -316,4 +317,4 @@ Thanks to: - [breakdowns](https://github.com/breakdowns) for slam-aria-mirror-bot - [zevtyardt](https://github.com/zevtyardt) for some direct links -And many more people who aren't mentioned here, but may be found in [Contributors](https://github.com/breakdowns/slam-aria-mirror-bot/graphs/contributors). +And many more people who aren't mentioned here, but may be found in [Contributors](https://github.com/breakdowns/slam-tg-mirror-bot/graphs/contributors). diff --git a/alive.py b/alive.py index ee1273a..0723cd0 100644 --- a/alive.py +++ b/alive.py @@ -1,3 +1,7 @@ +# Implement By - @anasty17 (https://github.com/breakdowns/slam-tg-mirror-bot/commit/0bfba523f095ab1dccad431d72561e0e002e7a59) +# (c) https://github.com/breakdowns/slam-aria-mirror-bot +# All rights reserved + import time import requests import os diff --git a/app.json b/app.json index 64ee9a2..2eddeff 100644 --- a/app.json +++ b/app.json @@ -1,5 +1,5 @@ { - "name": "slam-aria-mirror-bot", + "name": "slam-tg-mirror-bot", "description": "A Telegram bot for all your mirror needs", "logo": "https://telegra.ph/file/6507910fd06d18dfaba82.jpg", "keywords": [ @@ -7,8 +7,8 @@ "telegram", "python" ], - "repository": "https://github.com/breakdowns/slam-aria-mirror-bot", - "website": "https://github.com/breakdowns/slam-aria-mirror-bot", + "repository": "https://github.com/breakdowns/slam-tg-mirror-bot", + "website": "https://github.com/breakdowns/slam-tg-mirror-bot", "success_url": "https://t.me/SlamMirrorSupport", "stack": "container", "env": { @@ -183,7 +183,20 @@ }, "STATUS_LIMIT": { "description": "Status limit with buttons, Recommend limit status to 4 tasks max.", - "value": "", + "required": false + }, + "IS_VPS": { + "description": "Only for VPS, fill False.", + "value": "False", + "required": false + }, + "SERVER_PORT": { + "description": "Only for VPS, no need to fill it.", + "required": false + }, + "BASE_URL_OF_BOT": { + "description": "Heroku App name web url, Examples: https://yourappname.herokuapp.com", + "value": "False", "required": false } }, @@ -193,7 +206,7 @@ } ], "formation": { - "worker": { + "web": { "quantity": 1, "size": "free" } diff --git a/aria.sh b/aria.sh index 506ee19..0c2aa4f 100755 --- a/aria.sh +++ b/aria.sh @@ -7,4 +7,3 @@ aria2c --enable-rpc --check-certificate=false \ --disk-cache=64M --bt-enable-lpd=true --seed-time=0 --max-file-not-found=0 \ --max-tries=20 --auto-file-renaming=true --reuse-uri=true --http-accept-gzip=true \ --content-disposition-default-utf8=true --netrc-path=/usr/src/app/.netrc - diff --git a/bot/__main__.py b/bot/__main__.py index 0311e02..9d680ec 100644 --- a/bot/__main__.py +++ b/bot/__main__.py @@ -88,7 +88,7 @@ def bot_help(update, context): help_string_adm = f''' /{BotCommands.HelpCommand}: To get this message -/{BotCommands.MirrorCommand} [download_url][magnet_link]: Start mirroring the link to Google Drive +/{BotCommands.MirrorCommand} [download_url][magnet_link]: Start mirroring the link to Google Drive. Use /mirror qb to mirror with qBittorrent, and use /mirror qbs to select files before downloading /{BotCommands.TarMirrorCommand} [download_url][magnet_link]: Start mirroring and upload the archived (.tar) version of the download @@ -146,7 +146,7 @@ def bot_help(update, context): help_string = f''' /{BotCommands.HelpCommand}: To get this message -/{BotCommands.MirrorCommand} [download_url][magnet_link]: Start mirroring the link to Google Drive +/{BotCommands.MirrorCommand} [download_url][magnet_link]: Start mirroring the link to Google Drive. Use /mirror qb to mirror with qBittorrent, and use /mirror qbs to select files before downloading /{BotCommands.TarMirrorCommand} [download_url][magnet_link]: Start mirroring and upload the archived (.tar) version of the download diff --git a/bot/helper/mirror_utils/download_utils/qbit_downloader.py b/bot/helper/mirror_utils/download_utils/qbit_downloader.py index f1f6f41..10a0369 100644 --- a/bot/helper/mirror_utils/download_utils/qbit_downloader.py +++ b/bot/helper/mirror_utils/download_utils/qbit_downloader.py @@ -1,3 +1,7 @@ +# Implement By - @anasty17 (https://github.com/breakdowns/slam-tg-mirror-bot/commit/0bfba523f095ab1dccad431d72561e0e002e7a59) +# (c) https://github.com/breakdowns/slam-aria-mirror-bot +# All rights reserved + import os import random import string @@ -195,4 +199,3 @@ pin_handler = CallbackQueryHandler(get_confirm, pattern="pin", run_async=True) done_handler = CallbackQueryHandler(get_confirm, pattern="done", run_async=True) dispatcher.add_handler(pin_handler) dispatcher.add_handler(done_handler) - diff --git a/bot/helper/mirror_utils/status_utils/qbit_download_status.py b/bot/helper/mirror_utils/status_utils/qbit_download_status.py index 6a5c0eb..e443f0d 100644 --- a/bot/helper/mirror_utils/status_utils/qbit_download_status.py +++ b/bot/helper/mirror_utils/status_utils/qbit_download_status.py @@ -1,3 +1,7 @@ +# Implement By - @anasty17 (https://github.com/breakdowns/slam-tg-mirror-bot/commit/0bfba523f095ab1dccad431d72561e0e002e7a59) +# (c) https://github.com/breakdowns/slam-aria-mirror-bot +# All rights reserved + from bot import DOWNLOAD_DIR, LOGGER, get_client from bot.helper.ext_utils.bot_utils import MirrorStatus, get_readable_file_size, get_readable_time from .status import Status @@ -91,4 +95,3 @@ class QbDownloadStatus(Status): LOGGER.info(f"Cancelling Download: {self.name()}") self.__listener.onDownloadError('Download stopped by user!') self.__client.torrents_delete(torrent_hashes=self.__hash) - diff --git a/bot/helper/mirror_utils/upload_utils/gdriveTools.py b/bot/helper/mirror_utils/upload_utils/gdriveTools.py index f387473..ec61e02 100644 --- a/bot/helper/mirror_utils/upload_utils/gdriveTools.py +++ b/bot/helper/mirror_utils/upload_utils/gdriveTools.py @@ -96,7 +96,7 @@ class GoogleDriveHelper: regex = r"https://drive\.google\.com/(drive)?/?u?/?\d?/?(mobile)?/?(file)?(folders)?/?d?/([-\w]+)[?+]?/?(w+)?" res = re.search(regex,link) if res is None: - raise IndexError("GDrive ID not found.") + raise IndexError("G-Drive ID not found.") return res.group(5) parsed = urlparse.urlparse(link) return parse_qs(parsed.query)['id'][0] @@ -117,7 +117,7 @@ class GoogleDriveHelper: resumable=False) file_metadata = { 'name': file_name, - 'description': 'Uploaded using Slam Aria Mirror Bot', + 'description': 'Uploaded using Slam Tg Mirror Bot', 'mimeType': mime_type, } if parent_id is not None: @@ -171,7 +171,7 @@ class GoogleDriveHelper: # File body description file_metadata = { 'name': file_name, - 'description': 'Uploaded by Slam Aria Mirror Bot', + 'description': 'Uploaded by Slam Tg Mirror Bot', 'mimeType': mime_type, } try: @@ -363,7 +363,7 @@ class GoogleDriveHelper: try: file_id = self.getIdFromUrl(link) except (KeyError,IndexError): - msg = "Google drive ID could not be found in the provided link" + msg = "Google Drive ID could not be found in the provided link" return msg msg = "" LOGGER.info(f"File ID: {file_id}") @@ -492,7 +492,7 @@ class GoogleDriveHelper: file_id = file.get("id") if not IS_TEAM_DRIVE: self.__set_permission(file_id) - LOGGER.info("Created Google-Drive Folder:\nName: {}\nID: {} ".format(file.get("name"), file_id)) + LOGGER.info("Created G-Drive Folder:\nName: {}\nID: {} ".format(file.get("name"), file_id)) return file_id def upload_dir(self, input_directory, parent_id): @@ -557,9 +557,9 @@ class GoogleDriveHelper: content += f' | Next' nxt_page += 1 Telegraph(access_token=telegraph_token).edit_page(path = self.path[prev_page], - title = 'Slam Aria Mirror Bot Search', - author_name='Slam Aria Mirror Bot', - author_url='https://github.com/breakdowns/slam-aria-mirror-bot', + title = 'Slam Tg Mirror Bot Search', + author_name='Slam Tg Mirror Bot', + author_url='https://github.com/breakdowns/slam-tg-mirror-bot', html_content=content) return @@ -642,9 +642,9 @@ class GoogleDriveHelper: for content in self.telegraph_content : self.path.append(Telegraph(access_token=telegraph_token).create_page( - title = 'Slam Aria Mirror Bot Search', - author_name='Slam Aria Mirror Bot', - author_url='https://github.com/breakdowns/slam-aria-mirror-bot', + title = 'Slam Tg Mirror Bot Search', + author_name='Slam Tg Mirror Bot', + author_url='https://github.com/breakdowns/slam-tg-mirror-bot', html_content=content )['path']) @@ -665,7 +665,7 @@ class GoogleDriveHelper: try: file_id = self.getIdFromUrl(link) except (KeyError,IndexError): - msg = "Google drive ID could not be found in the provided link" + msg = "Google Drive ID could not be found in the provided link" return msg msg = "" LOGGER.info(f"File ID: {file_id}") @@ -728,7 +728,7 @@ class GoogleDriveHelper: try: file_id = self.getIdFromUrl(link) except (KeyError,IndexError): - msg = "Google drive ID could not be found in the provided link" + msg = "Google Drive ID could not be found in the provided link" return msg, "", "" LOGGER.info(f"File ID: {file_id}") try: diff --git a/bot/modules/count.py b/bot/modules/count.py index f24c82b..3e58c2a 100644 --- a/bot/modules/count.py +++ b/bot/modules/count.py @@ -1,4 +1,4 @@ -# Implement By - @anasty17 (https://github.com/breakdowns/slam-aria-mirror-bot/pull/111) +# Implement By - @anasty17 (https://github.com/breakdowns/slam-tg-mirror-bot/pull/111) # (c) https://github.com/breakdowns/slam-aria-mirror-bot # All rights reserved diff --git a/bot/modules/updates.py b/bot/modules/updates.py index 5d15cd0..79f67ad 100644 --- a/bot/modules/updates.py +++ b/bot/modules/updates.py @@ -57,7 +57,7 @@ async def update_it(client, message): ups_rem.pull(UPSTREAM_BRANCH) except GitCommandError: repo.git.reset("--hard", "FETCH_HEAD") - subprocess.run(["pip3", "install", "--no-cache-dir", "-r", "requirements"]) + subprocess.run(["pip3", "install", "--no-cache-dir", "-r", "requirements.txt"]) await msg_.edit("`Updated Sucessfully! Give Me Some Time To Restart!`") with open("./aria.sh", 'rb') as file: script = file.read() diff --git a/config_sample.env b/config_sample.env index 3d7f7e7..209405c 100644 --- a/config_sample.env +++ b/config_sample.env @@ -30,9 +30,9 @@ BLOCK_MEGA_LINKS = "" STOP_DUPLICATE = "" SHORTENER = "" SHORTENER_API = "" -#Qbittorrent +# qBittorrent IS_VPS = "" -SERVER_PORT = "80" #For VPS +SERVER_PORT = "80" # For VPS BASE_URL_OF_BOT = "" # If you want to use Credentials externally from Index Links, fill these vars with the direct links # These are optional, if you don't know, simply leave them, don't fill anything in them. diff --git a/nodes.py b/nodes.py index f4549a2..057fe26 100644 --- a/nodes.py +++ b/nodes.py @@ -137,4 +137,3 @@ def get_readable_file_size(size_in_bytes) -> str: return f'{round(size_in_bytes, 2)}{SIZE_UNITS[index]}' except IndexError: return 'File too large' - diff --git a/wserver.py b/wserver.py index 22d2917..a74a7a3 100644 --- a/wserver.py +++ b/wserver.py @@ -36,7 +36,7 @@ p { font-size: 12px; margin: 24px;} -

Slam-mirror-bot : Github

+

slam-tg-mirror-bot: Github

{My_content}