From 11ce564932ef67dde4320dbacacfa28963971be4 Mon Sep 17 00:00:00 2001 From: Hafitz Setya Date: Wed, 22 Sep 2021 08:35:42 +0700 Subject: [PATCH] Minor Change - Change logo, thanks to instagram.com/by__faqih for logo - Add copyright - Add new command in help Signed-off-by: breakdowns --- .github/workflows/deploy.yml | 2 +- README.md | 8 ++++-- bot/__main__.py | 26 +++++++++++++++++++ bot/helper/ext_utils/bot_utils.py | 18 ++++++------- .../mirror_utils/status_utils/split_status.py | 4 +++ .../status_utils/tg_upload_status.py | 4 +++ .../upload_utils/pyrogramEngine.py | 6 +++-- bot/helper/telegram_helper/message_utils.py | 16 ++++++------ bot/modules/leech_settings.py | 4 +++ config_sample.env | 3 ++- 10 files changed, 68 insertions(+), 23 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 67ffaf92cd4..d5bfcf70f9a 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -15,6 +15,6 @@ jobs: usedocker: true docker_heroku_process_type: web stack: "container" - region: "us" + region: "eu" env: HD_CONFIG_FILE_URL: ${{secrets.CONFIG_FILE_URL}} diff --git a/README.md b/README.md index 67f1c54842c..6d4eaaf1e6b 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![Slam](https://telegra.ph/file/db03910496f06094f1f7a.jpg)](https://youtu.be/Pk_TthHfLeE) +[![SlamDevs](https://telegra.ph/file/143032e96542e7534f073.jpg)](https://t.me/SlamDevs) # Slam Mirror Bot ![GitHub Repo stars](https://img.shields.io/github/stars/SlamDevs/slam-mirrorbot?color=blue&style=flat) @@ -8,7 +8,7 @@ ![Docker Pulls](https://img.shields.io/docker/pulls/breakdowns/mega-sdk-python?label=Docker%20Pull) [![Channel](https://img.shields.io/badge/Join%20Channel-!-red)](https://t.me/SlamMirrorUpdates) -**Slam Mirror Bot** is a _multipurpose_ Telegram Bot written in Python for mirroring files on the Internet to our beloved Google Drive. Based on [python-aria-mirror-bot](https://github.com/lzzy12/python-aria-mirror-bot) +**Slam Mirror Bot** is a _multipurpose_ Telegram Bot written in Python for mirroring/leeching files on the Internet to our beloved Google Drive. Based on [python-aria-mirror-bot](https://github.com/lzzy12/python-aria-mirror-bot) # Features:
@@ -16,6 +16,8 @@ ## By Slam Devs - qBittorrent +- Leach supported +- Thumbnail supported - Size limiting for Torrent/Direct, Tar/Unzip, Mega and clone - Stop duplicates for all tasks except for qBittorrent and youtube-dl tasks - Tar/Unzip G-Drive link @@ -169,6 +171,8 @@ Fill up rest of the fields. Meaning of each field is discussed below: - `SERVER_PORT`: Only For VPS even if `IS_VPS` is `False` --> Base URL Port - `BASE_URL_OF_BOT`: (Required for Heroku to avoid sleep/idling) Valid BASE URL of app where the bot is deployed. Format of URL should be `http://myip` (where `myip` is the IP/Domain of your bot) or if you have chosen other port than `80` then fill in this format `http://myip:port`, for Heroku fill `https://yourappname.herokuapp.com` (**NOTE**: Do not put slash at the end), still got idling? You can use http://cron-job.org to ping your Heroku app. - `RECURSIVE_SEARCH`: Set this to `True` to search in sub-folders with `/list` (**NOTE**: This will only work with shared-drive ID or fill `root` for main drive. Folder IDs are not compatible with it.) +- `TG_SPLIT_SIZE`: Size Telegram split, leave it empty for max size `2GB` +- `AS_DOCUMENT`: Should all the upload to telegram be forced as documents or not, set it `True` or `False` - `SHORTENER_API`: Fill your Shortener API key if you are using Shortener. - `SHORTENER`: if you want to use Shortener in G-Drive and index link, fill Shortener URL here. Examples: ``` diff --git a/bot/__main__.py b/bot/__main__.py index 2710cb47521..f2cbbd545ea 100644 --- a/bot/__main__.py +++ b/bot/__main__.py @@ -105,6 +105,22 @@ def log(update, context):

/{BotCommands.QbUnzipMirrorCommand} [magnet_link]: Starts mirroring using qBittorrent and if downloaded file is any archive, extracts it to Google Drive

+/{BotCommands.LeechCommand} This command should be used as reply to Magnet link, Torrent link, or Direct link. [this command will SPAM the chat and send the downloads a seperate files, if there is more than one file, in the specified Torrent] +

+/{BotCommands.TarLeechCommand} This command should be used as reply to Magnet link, Torrent link, or Direct link and upload it as (.tar). [this command will SPAM the chat and send the downloads a seperate files, if there is more than one file, in the specified Torrent] +

+/{BotCommands.ZipLeechCommand} This command should be used as reply to Magnet link, Torrent link, or Direct link and upload it as (.zip). [this command will SPAM the chat and send the downloads a seperate files, if there is more than one file, in the specified Torrent] +

+/{BotCommands.UnzipLeechCommand} This command should be used as reply to Magnet link, Torrent link, or Direct link and if file is any archive, extracts it. [this command will SPAM the chat and send the downloads a seperate files, if there is more than one file, in the specified Torrent] +

+/{BotCommands.QbLeechCommand} This command should be used as reply to Magnet link, Torrent link, or Direct link using qBittorrent. [this command will SPAM the chat and send the downloads a seperate files, if there is more than one file, in the specified Torrent] +

+/{BotCommands.QbTarLeechCommand} This command should be used as reply to Magnet link, Torrent link, or Direct link and upload it as (.tar) using qBittorrent. [this command will SPAM the chat and send the downloads a seperate files, if there is more than one file, in the specified Torrent] +

+/{BotCommands.QbZipLeechCommand} This command should be used as reply to Magnet link, Torrent link, or Direct link and upload it as (.zip) using qBittorrent. [this command will SPAM the chat and send the downloads a seperate files, if there is more than one file, in the specified Torrent] +

+/{BotCommands.QbUnzipLeechCommand} This command should be used as reply to Magnet link, Torrent link, or Direct link and if file is any archive, extracts it using qBittorrent. [this command will SPAM the chat and send the downloads a seperate files, if there is more than one file, in the specified Torrent] +

/{BotCommands.CloneCommand} [drive_url]: Copy file/folder to Google Drive

/{BotCommands.CountCommand} [drive_url]: Count file/folder of Google Drive Links @@ -117,6 +133,16 @@ def log(update, context):

/{BotCommands.ZipWatchCommand} [youtube-dl supported link]: Mirror through youtube-dl and zip before uploading

+/{BotCommands.LeechWatchCommand} Leech through youtube-dl +

+/{BotCommands.LeechTarWatchCommand} Leech through youtube-dl and tar before uploading +

+/{BotCommands.LeechTarWatchCommand} Leech through youtube-dl and zip before uploading +

+/{BotCommands.LeechSetCommand} Leech Settings +

+/{BotCommands.SetThumbCommand} Reply to photo to set it as thumbnail for next uploads +

/{BotCommands.CancelMirror}: Reply to the message by which the download was initiated and that download will be cancelled

/{BotCommands.CancelAllCommand}: Cancel all running tasks diff --git a/bot/helper/ext_utils/bot_utils.py b/bot/helper/ext_utils/bot_utils.py index 6a86a42e7ee..283dafac6b4 100644 --- a/bot/helper/ext_utils/bot_utils.py +++ b/bot/helper/ext_utils/bot_utils.py @@ -137,20 +137,20 @@ def get_readable_message(): ]: msg += f"\n{get_progress_bar_string(download)} {download.progress()}" if download.status() == MirrorStatus.STATUS_CLONING: - msg += f"\nCloned: {get_readable_file_size(download.processed_bytes())} of {download.size()}" + msg += f"\nCloned: {get_readable_file_size(download.processed_bytes())} of {download.size()}" elif download.status() == MirrorStatus.STATUS_UPLOADING: - msg += f"\nUploaded: {get_readable_file_size(download.processed_bytes())} of {download.size()}" + msg += f"\nUploaded: {get_readable_file_size(download.processed_bytes())} of {download.size()}" else: - msg += f"\nDownloaded: {get_readable_file_size(download.processed_bytes())} of {download.size()}" - msg += f"\nSpeed: {download.speed()} ETA: {download.eta()}" + msg += f"\nDownloaded: {get_readable_file_size(download.processed_bytes())} of {download.size()}" + msg += f"\nSpeed: {download.speed()} ETA: {download.eta()}" try: - msg += f"\nSeeders: {download.aria_download().num_seeders}" \ - f" | Peers: {download.aria_download().connections}" + msg += f"\nSeeders: {download.aria_download().num_seeders}" \ + f" | Peers: {download.aria_download().connections}" except: pass try: - msg += f"\nSeeders: {download.torrent_info().num_seeds}" \ - f" | Leechers: {download.torrent_info().num_leechs}" + msg += f"\nSeeders: {download.torrent_info().num_seeds}" \ + f" | Leechers: {download.torrent_info().num_leechs}" except: pass msg += f"\nTo Stop: /{BotCommands.CancelMirror} {download.gid()}" @@ -159,7 +159,7 @@ def get_readable_message(): break if STATUS_LIMIT is not None: if dick_no > STATUS_LIMIT: - msg += f"Page: {PAGE_NO}/{pages} | Tasks: {dick_no}\n" + msg += f"Page: {PAGE_NO}/{pages} | Tasks: {dick_no}\n" buttons = button_build.ButtonMaker() buttons.sbutton("Previous", "pre") buttons.sbutton("Next", "nex") diff --git a/bot/helper/mirror_utils/status_utils/split_status.py b/bot/helper/mirror_utils/status_utils/split_status.py index 54432971663..09734ee6e80 100644 --- a/bot/helper/mirror_utils/status_utils/split_status.py +++ b/bot/helper/mirror_utils/status_utils/split_status.py @@ -1,3 +1,7 @@ +# Implement By - @anasty17 (https://github.com/SlamDevs/slam-mirrorbot/commit/d888a1e7237f4633c066f7c2bbfba030b83ad616) +# (c) https://github.com/SlamDevs/slam-mirrorbot +# All rights reserved + from .status import Status from bot.helper.ext_utils.bot_utils import get_readable_file_size, MirrorStatus diff --git a/bot/helper/mirror_utils/status_utils/tg_upload_status.py b/bot/helper/mirror_utils/status_utils/tg_upload_status.py index a6e2d280488..912fb008106 100644 --- a/bot/helper/mirror_utils/status_utils/tg_upload_status.py +++ b/bot/helper/mirror_utils/status_utils/tg_upload_status.py @@ -1,3 +1,7 @@ +# Implement By - @anasty17 (https://github.com/SlamDevs/slam-mirrorbot/commit/d888a1e7237f4633c066f7c2bbfba030b83ad616) +# (c) https://github.com/SlamDevs/slam-mirrorbot +# All rights reserved + from .status import Status from bot.helper.ext_utils.bot_utils import MirrorStatus, get_readable_file_size, get_readable_time from bot import DOWNLOAD_DIR diff --git a/bot/helper/mirror_utils/upload_utils/pyrogramEngine.py b/bot/helper/mirror_utils/upload_utils/pyrogramEngine.py index 4087c2e575d..0b36162c346 100644 --- a/bot/helper/mirror_utils/upload_utils/pyrogramEngine.py +++ b/bot/helper/mirror_utils/upload_utils/pyrogramEngine.py @@ -1,3 +1,7 @@ +# Implement By - @anasty17 (https://github.com/SlamDevs/slam-mirrorbot/commit/d888a1e7237f4633c066f7c2bbfba030b83ad616) +# (c) https://github.com/SlamDevs/slam-mirrorbot +# All rights reserved + import os import logging import time @@ -146,5 +150,3 @@ def cancel_download(self): self.is_cancelled = True LOGGER.info(f"Cancelling Upload: {self.name}") self.__listener.onUploadError('your upload has been stopped!') - - diff --git a/bot/helper/telegram_helper/message_utils.py b/bot/helper/telegram_helper/message_utils.py index bcb415f4cfb..8239118fde4 100644 --- a/bot/helper/telegram_helper/message_utils.py +++ b/bot/helper/telegram_helper/message_utils.py @@ -71,9 +71,9 @@ def update_all_messages(): free = get_readable_file_size(free) currentTime = get_readable_time(time.time() - botStartTime) msg, buttons = get_readable_message() - msg += f"CPU: {psutil.cpu_percent()}%" \ - f" RAM: {psutil.virtual_memory().percent}%" \ - f" DISK: {psutil.disk_usage('/').percent}%" + msg += f"CPU: {psutil.cpu_percent()}%" \ + f" RAM: {psutil.virtual_memory().percent}%" \ + f" DISK: {psutil.disk_usage('/').percent}%" with download_dict_lock: dlspeed_bytes = 0 uldl_bytes = 0 @@ -91,7 +91,7 @@ def update_all_messages(): uldl_bytes += float(speedy.split('M')[0]) * 1048576 dlspeed = get_readable_file_size(dlspeed_bytes) ulspeed = get_readable_file_size(uldl_bytes) - msg += f"\nFREE: {free} | UPTIME: {currentTime}\nDL: {dlspeed}/s 🔻 | UL: {ulspeed}/s 🔺\n" + msg += f"\nFREE: {free} | UPTIME: {currentTime}\nDL: {dlspeed}/s 🔻 | UL: {ulspeed}/s 🔺\n" with status_reply_dict_lock: for chat_id in list(status_reply_dict.keys()): if status_reply_dict[chat_id] and msg != status_reply_dict[chat_id].text: @@ -112,9 +112,9 @@ def sendStatusMessage(msg, bot): free = get_readable_file_size(free) currentTime = get_readable_time(time.time() - botStartTime) progress, buttons = get_readable_message() - progress += f"CPU: {psutil.cpu_percent()}%" \ - f" RAM: {psutil.virtual_memory().percent}%" \ - f" DISK: {psutil.disk_usage('/').percent}%" + progress += f"CPU: {psutil.cpu_percent()}%" \ + f" RAM: {psutil.virtual_memory().percent}%" \ + f" DISK: {psutil.disk_usage('/').percent}%" with download_dict_lock: dlspeed_bytes = 0 uldl_bytes = 0 @@ -132,7 +132,7 @@ def sendStatusMessage(msg, bot): uldl_bytes += float(speedy.split('M')[0]) * 1048576 dlspeed = get_readable_file_size(dlspeed_bytes) ulspeed = get_readable_file_size(uldl_bytes) - progress += f"\nFREE: {free} | UPTIME: {currentTime}\nDL: {dlspeed}/s 🔻 | UL: {ulspeed}/s 🔺\n" + progress += f"\nFREE: {free} | UPTIME: {currentTime}\nDL: {dlspeed}/s 🔻 | UL: {ulspeed}/s 🔺\n" with status_reply_dict_lock: if msg.message.chat.id in list(status_reply_dict.keys()): try: diff --git a/bot/modules/leech_settings.py b/bot/modules/leech_settings.py index 729a152e4de..e6f7792c12d 100644 --- a/bot/modules/leech_settings.py +++ b/bot/modules/leech_settings.py @@ -1,3 +1,7 @@ +# Implement By - @anasty17 (https://github.com/SlamDevs/slam-mirrorbot/commit/d888a1e7237f4633c066f7c2bbfba030b83ad616) +# (c) https://github.com/SlamDevs/slam-mirrorbot +# All rights reserved + import os import threading diff --git a/config_sample.env b/config_sample.env index d105d8d1f61..689dabbd8e5 100644 --- a/config_sample.env +++ b/config_sample.env @@ -19,7 +19,8 @@ IGNORE_PENDING_REQUESTS = "" USE_SERVICE_ACCOUNTS = "" INDEX_URL = "" STATUS_LIMIT = "" # Recommend limit status to 4 tasks -TG_SPLIT_SIZE = "" # leave it empty for max size(2GB) +# Leech +TG_SPLIT_SIZE = "" # leave it empty for max size (2GB) AS_DOCUMENT = "" UPTOBOX_TOKEN = "" MEGA_API_KEY = ""