Add new vars

This commit is contained in:
Hafitz Setya 2021-06-10 09:09:40 +07:00 committed by GitHub
parent 170e3a4f8b
commit 81f7a29ea7
Signed by untrusted user: GitHub
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 25 additions and 11 deletions

View File

@ -10,18 +10,21 @@
![GitHub contributors](https://img.shields.io/github/contributors/breakdowns/slam-mirrorbot?style=flat)
![GitHub repo size](https://img.shields.io/github/repo-size/breakdowns/slam-mirrorbot?color=red)
![GitHub commit activity](https://img.shields.io/github/commit-activity/m/breakdowns/slam-mirrorbot)
![GitHub](https://img.shields.io/github/license/breakdowns/slam-mirrorbot)
[![Slam Mirror Support](https://img.shields.io/badge/slam%20mirror%20bot-support%20group-blue)](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:
<details>
<summary><b>Click here for more details</b></summary>
## 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.
```
</details>
# 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.

View File

@ -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

View File

@ -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)

View File

@ -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"<code>{file.get('name')}<br>(folder)📁</code><br>"
msg += f"📁 <code>{file.get('name')}<br>(folder)</code><br>"
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"<b><a href={sfurl}>Drive Link</a></b>"
@ -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"<code>{file.get('name')}<br>({get_readable_file_size(int(file.get('size')))})📄</code><br>"
msg += f"📄 <code>{file.get('name')}<br>({get_readable_file_size(int(file.get('size')))})</code><br>"
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"<b><a href={sfurl}>Drive Link</a></b>"

View File

@ -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