From 81f7a29ea7c2db6c9923c6ebaaaee4afebe93eae Mon Sep 17 00:00:00 2001
From: Hafitz Setya <71178188+breakdowns@users.noreply.github.com>
Date: Thu, 10 Jun 2021 09:09:40 +0700
Subject: [PATCH] Add new vars
---
README.md | 18 ++++++++++++------
app.json | 8 ++++++++
.../download_utils/mega_downloader.py | 2 +-
.../mirror_utils/upload_utils/gdriveTools.py | 4 ++--
config_sample.env | 4 ++--
5 files changed, 25 insertions(+), 11 deletions(-)
diff --git a/README.md b/README.md
index efb8ad7..97e5002 100644
--- a/README.md
+++ b/README.md
@@ -10,18 +10,21 @@



+
[](https://t.me/SlamMirrorSupport)
-**Slam Mirror Bot** is a multipurpose Telegram Bot writen in Python for mirroring files on the Internet to our beloved Google Drive.
+**Slam 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
- Get detailed info about replied media (Only for Telegram file)
- Nyaa.si and Sukebei Torrent search
- Speedtest with picture results
-- Stop duplicate clone Google Drive support
-- Limiting cloning Google Drive support
-- Limiting Torrent size support
+- Stop duplicate cloneing Google Drive & mirroring Mega support
+- Limiting size Torrent, Mega, cloning Google Drive support
- Sudo with Database support
- Multiple Trackers support
- Check Heroku dynos stats
@@ -61,6 +64,7 @@ APM, ARJ, CHM, CPIO, CramFS, DEB, DMG, FAT,
HFS, LZH, LZMA, LZMA2, MBR, MSI, MSLZ, NSIS,
NTFS, RPM, SquashFS, UDF, VHD, XAR, Z.
```
+
# How to deploy?
Deploying is pretty much straight forward and is divided into several steps as follows:
@@ -140,9 +144,11 @@ Fill up rest of the fields. Meaning of each fields are discussed below:
- **MEGA_PASSWORD**: Your password for your mega.nz account
- **BLOCK_MEGA_FOLDER**: If you want to remove mega.nz folder support, set it to `True`.
- **BLOCK_MEGA_LINKS**: If you want to remove mega.nz mirror support, set it to `True`.
-- **STOP_DUPLICATE_MIRROR**: (Leave empty if unsure) if this field is set to `True`, bot will check file in drive, if it is present in Drive, downloading will be stopped. (**Note**: File will be checked using filename, not using filehash, so this feature is not perfect yet)
-- **STOP_DUPLICATE_CLONE**: (Leave empty if unsure) if this field is set to `True`, bot will check file in drive, if it is present in Drive, cloning will be stopped.
+- **STOP_DUPLICATE_MIRROR**: (Leave empty if unsure) if this field is set to `True`, bot will check file in Drive, if it is present in Drive, downloading will be stopped. (**Note**: File will be checked using filename, not using filehash, so this feature is not perfect yet)
+- **STOP_DUPLICATE_MEGA**: (Leave empty if unsure) if this field is set to `True`, bot will check file in Drive, if it is present in Drive, downloading Mega will be stopped.
+- **STOP_DUPLICATE_CLONE**: (Leave empty if unsure) if this field is set to `True`, bot will check file in Drive, if it is present in Drive, cloning will be stopped.
- **CLONE_LIMIT**: To limit cloning Google Drive (leave space between number and unit, **TB or GB only**), examples: if you fill `1 GB` it will limit `1GB`.
+- **MEGA_LIMIT**: To limit downloading Mega (leave space between number and unit, **TB or GB only**), examples: if you fill `1 GB` it will limit `1GB`.
- **ENABLE_FILESIZE_LIMIT**: Set it to `True` if you want to use `MAX_TORRENT_SIZE`.
- **MAX_TORRENT_SIZE**: To limit the Torrent mirror size, Fill The amount you want to limit, examples: if you fill `15` it will limit `15gb`.
- **IMAGE_URL**: Show Image/Logo in /start message. Fill value of image your link image, use telegra.ph or any direct link image.
diff --git a/app.json b/app.json
index 7bf885a..d0b5751 100644
--- a/app.json
+++ b/app.json
@@ -112,10 +112,18 @@
"description": "To limit cloning Google Drive (leave space between number and unit, TB or GB only), examples: if you fill 1 GB it will limit 1GB.",
"required": false
},
+ "MEGA_LIMIT": {
+ "description": "To limit mirroring Mega (leave space between number and unit, TB or GB only), examples: if you fill 1 GB it will limit 1GB.",
+ "required": false
+ },
"STOP_DUPLICATE_MIRROR": {
"description": "If this field is set to True, bot will check file in Drive, if it is present in Drive, downloading will be stopped.",
"required": false
},
+ "STOP_DUPLICATE_MEGA": {
+ "description": "If this field is set to True, bot will check file in Drive, if it is present in Drive, downloading Mega will be stopped.",
+ "required": false
+ },
"STOP_DUPLICATE_CLONE": {
"description": "If this field is set to True, bot will check file in Drive, if it is present in Drive, cloning will be stopped.",
"required": false
diff --git a/bot/helper/mirror_utils/download_utils/mega_downloader.py b/bot/helper/mirror_utils/download_utils/mega_downloader.py
index 322bfcf..e902565 100644
--- a/bot/helper/mirror_utils/download_utils/mega_downloader.py
+++ b/bot/helper/mirror_utils/download_utils/mega_downloader.py
@@ -188,7 +188,7 @@ class MegaDownloadHelper:
limit = MEGA_LIMIT
limit = limit.split(' ', maxsplit=1)
limitint = int(limit[0])
- msg3 = f'Failed, Mega limit is {MEGA_LIMIT}.\n\nYour File/Folder size is {get_readable_file_size(api.getSize(node))}.'
+ msg3 = f'Failed, Mega limit is {MEGA_LIMIT}.\nYour File/Folder size is {get_readable_file_size(api.getSize(node))}.'
if 'GB' in limit or 'gb' in limit:
if api.getSize(node) > limitint * 1024**3:
deleteMessage(listener.bot, msg2)
diff --git a/bot/helper/mirror_utils/upload_utils/gdriveTools.py b/bot/helper/mirror_utils/upload_utils/gdriveTools.py
index e88a23a..561952d 100644
--- a/bot/helper/mirror_utils/upload_utils/gdriveTools.py
+++ b/bot/helper/mirror_utils/upload_utils/gdriveTools.py
@@ -551,7 +551,7 @@ class GoogleDriveHelper:
for file in response.get('files', []):
if file.get('mimeType') == "application/vnd.google-apps.folder": # Detect Whether Current Entity is a Folder or File.
furl = f"https://drive.google.com/drive/folders/{file.get('id')}"
- msg += f"⁍{file.get('name')}
(folder)📁
"
+ msg += f"📁 {file.get('name')}
(folder)
"
if SHORTENER is not None and SHORTENER_API is not None:
sfurl = requests.get(f'https://{SHORTENER}/api?api={SHORTENER_API}&url={furl}&format=text').text
msg += f"Drive Link"
@@ -571,7 +571,7 @@ class GoogleDriveHelper:
# Excluded index link as indexes cant download or open these shortcuts
else:
furl = f"https://drive.google.com/uc?id={file.get('id')}&export=download"
- msg += f"⁍{file.get('name')}
({get_readable_file_size(int(file.get('size')))})📄
"
+ msg += f"📄 {file.get('name')}
({get_readable_file_size(int(file.get('size')))})
"
if SHORTENER is not None and SHORTENER_API is not None:
sfurl = requests.get(f'https://{SHORTENER}/api?api={SHORTENER_API}&url={furl}&format=text').text
msg += f"Drive Link"
diff --git a/config_sample.env b/config_sample.env
index 0880d87..ad897ee 100644
--- a/config_sample.env
+++ b/config_sample.env
@@ -23,11 +23,11 @@ MEGA_PASSWORD = ""
BLOCK_MEGA_FOLDER = ""
BLOCK_MEGA_LINKS = ""
STOP_DUPLICATE_MIRROR = ""
-STOP_DUPLICATE_MEGA = ""
STOP_DUPLICATE_CLONE = ""
+STOP_DUPLICATE_MEGA = ""
SHORTENER = ""
SHORTENER_API = ""
-CLONE_LIMIT = "" #leave space between number and unit (TB or GB only)
+CLONE_LIMIT = "" # leave space between number and unit (TB or GB only)
MEGA_LIMIT = ""
IMAGE_URL = "https://telegra.ph/file/db03910496f06094f1f7a.jpg"
# Change ENABLE_FILESIZE_LIMIT = True if you want to use MAX_TORRENT_SIZE