v4.8.5
- bot: Add config to handle pending requests when bot restarts - Add Video Tutorial by xgorn - Tidying up Co-authored-by: KenHV <yo@kenharris.xyz>
This commit is contained in:
parent
a57610f27e
commit
31c7246369
26
README.md
26
README.md
|
|
@ -21,7 +21,7 @@
|
|||
- Nyaa.si and Sukebei Torrent search
|
||||
- Speedtest with picture results
|
||||
- Stop duplicate cloning Google Drive & mirroring Mega support
|
||||
- Limiting size Torrent, Mega, cloning Google Drive support
|
||||
- Limiting size Torrent/Direct, Mega, cloning Google Drive support
|
||||
- Sudo with Database support
|
||||
- Multiple Trackers support
|
||||
- Check Heroku dynos stats
|
||||
|
|
@ -33,10 +33,10 @@
|
|||
- View Link button
|
||||
- Direct links supported:
|
||||
```
|
||||
Racaty.net, Hxfile.co, Anonfiles.com, Fembed.com, Femax20.com, Layarkacaxxi.icu,
|
||||
Naniplay.com, Naniplay.nanime.in, Naniplay.nanime.biz, Sbembed.com, Streamsb.net,
|
||||
Uptobox.com (Uptobox account must be premium),
|
||||
Onedrive/1drv.ms (Only works for file not folder or busines account)
|
||||
racaty.net, hxfile.co, anonfiles.com, fembed.com, femax20.com, layarkacaxxi.icu,
|
||||
naniplay.com, naniplay.nanime.in, naniplay.nanime.biz, sbembed.com, streamsb.net,
|
||||
uptobox.com (Uptobox account must be premium),
|
||||
1drv.ms (Only works for file not folder or busines account)
|
||||
```
|
||||
## From Original Repos
|
||||
- Mirroring direct download links, Torrent, and Telegram files to Google Drive
|
||||
|
|
@ -143,15 +143,15 @@ Fill up rest of the fields. Meaning of each fields are discussed below:
|
|||
- **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`.
|
||||
- **CLONE_LIMIT**: To limit cloning Google Drive (leave space between number and unit, Available units is (gb or GB, tb or TB).
|
||||
- **MEGA_LIMIT**: To limit downloading Mega (leave space between number and unit, Available units is (gb or GB, tb or TB).
|
||||
- **TORRENT_DIRECT_LIMIT**: To limit the Torrent/Direct mirror size, Leave space between number and unit. Available units is (gb or GB, tb or TB).
|
||||
- **IMAGE_URL**: Show Image/Logo in /start message. Fill value of image your link image, use telegra.ph or any direct link image.
|
||||
- **VIEW_LINK**: View Link button to open file Index Link in browser instead of direct download link, you can figure out if it's compatible with your Index code or not, open any video from you Index and check if the END of link from browser link bar is `?a=view`, if yes make it `True` it will work (Compatible with [Bhadoo Index](https://github.com/ParveenBhadooOfficial/Google-Drive-Index) Code)
|
||||
- **UPTOBOX_TOKEN**: Uptobox token to mirror uptobox links. Get it from [Uptobox Premium Account](https://uptobox.com/my_account).
|
||||
- **HEROKU_API_KEY**: (Only if you deploying on Heroku) Your Heroku API key, get it from https://dashboard.heroku.com/account.
|
||||
- **HEROKU_APP_NAME**: (Only if you deploying on Heroku) Your Heroku app name.
|
||||
- **IGNORE_PENDING_REQUESTS**: (Optional field) If you want the bot to ignore pending requests after it restarts, set this to `True`.
|
||||
- **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:
|
||||
```
|
||||
|
|
@ -206,13 +206,19 @@ sudo docker run mirrorbot
|
|||
|
||||
- Give stars and Fork this repo then upload **token.pickle** to your forks
|
||||
- Hit the **DEPLOY TO HEROKU** button and follow the further instructions in the screen
|
||||
- **NOTE**: If you didn't upload **token.pickle**, uploading will not work. How to generate **token.pickle**? [Read here](https://github.com/breakdowns/slam-mirrorbot#getting-google-oauth-api-credential-file)
|
||||
- Recommended to use 1 App in 1 Heroku accounts
|
||||
|
||||
**NOTE**: If you didn't upload **token.pickle**, uploading will not work. How to generate **token.pickle**? [Read here](https://github.com/breakdowns/slam-mirrorbot#getting-google-oauth-api-credential-file)
|
||||
<p><a href="https://heroku.com/deploy"> <img src="https://img.shields.io/badge/Deploy%20To%20Heroku-blueviolet?style=for-the-badge&logo=heroku" width="200""/></a></p>
|
||||
|
||||
## Deploying on Heroku with heroku-cli and Goorm IDE
|
||||
<p><a href="https://telegra.ph/How-to-Deploy-a-Mirror-Bot-to-Heroku-with-CLI-05-06"> <img src="https://img.shields.io/badge/see%20on%20telegraph-grey?style=for-the-badge" width="190""/></a></p>
|
||||
|
||||
## Video Tutorial
|
||||
<p><a href="https://www.youtube.com/watch?v=WIhL0TrisfQ&t=1s"> <img src="https://img.shields.io/badge/See%20On%20Youtube-black?style=for-the-badge&logo=youtube" width="200""/></a></p>
|
||||
|
||||
**NOTE**: Recommended to generate **token.pickle** manually. [Read here](https://github.com/breakdowns/slam-mirrorbot#getting-google-oauth-api-credential-file)
|
||||
|
||||
# Using Service Accounts for uploading to avoid user rate limit
|
||||
For Service Account to work, you must set **USE_SERVICE_ACCOUNTS=**"True" in config file or environment variables,
|
||||
Many thanks to [AutoRClone](https://github.com/xyou365/AutoRclone) for the scripts.
|
||||
|
|
|
|||
17
app.json
17
app.json
|
|
@ -98,22 +98,17 @@
|
|||
"description": "If you want to remove mega.nz mirror support, set it to True.",
|
||||
"required": false
|
||||
},
|
||||
"ENABLE_FILESIZE_LIMIT": {
|
||||
"description": "Set it to True if you want to use MAX_TORRENT_SIZE.",
|
||||
"value": "False",
|
||||
"required": false
|
||||
},
|
||||
"MAX_TORRENT_SIZE": {
|
||||
"description": "To limit the Torrent mirror size, Fill The amount you want to limit, examples: if you fill 15 it will limit 15gb.",
|
||||
"TORRENT_DIRECT_LIMIT": {
|
||||
"description": "To limit the Torrent/Direct mirror size, Leave space between number and unit. Available units is (gb or GB, tb or TB).",
|
||||
"value": "15",
|
||||
"required": false
|
||||
},
|
||||
"CLONE_LIMIT": {
|
||||
"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.",
|
||||
"description": "To limit cloning Google Drive (leave space between number and unit, Available units is (gb or GB, tb or TB).",
|
||||
"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.",
|
||||
"description": "To limit downloading Mega (leave space between number and unit, Available units is (gb or GB, tb or TB).",
|
||||
"required": false
|
||||
},
|
||||
"STOP_DUPLICATE_MIRROR": {
|
||||
|
|
@ -128,6 +123,10 @@
|
|||
"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
|
||||
},
|
||||
"IGNORE_PENDING_REQUESTS": {
|
||||
"description": "If you want the bot to ignore pending requests after it restarts, set this to True.",
|
||||
"required": false
|
||||
},
|
||||
"SHORTENER": {
|
||||
"description": "If you want to use shortener in Gdrive and index link.",
|
||||
"required": false
|
||||
|
|
|
|||
|
|
@ -290,6 +290,12 @@ try:
|
|||
except KeyError:
|
||||
IMAGE_URL = 'https://telegra.ph/file/db03910496f06094f1f7a.jpg'
|
||||
|
||||
IGNORE_PENDING_REQUESTS = False
|
||||
try:
|
||||
if getConfig("IGNORE_PENDING_REQUESTS").lower() == "true":
|
||||
IGNORE_PENDING_REQUESTS = True
|
||||
except KeyError:
|
||||
pass
|
||||
|
||||
updater = tg.Updater(token=BOT_TOKEN)
|
||||
bot = updater.bot
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ import time
|
|||
|
||||
from telegram import ParseMode, BotCommand
|
||||
from telegram.ext import CommandHandler
|
||||
from bot import bot, dispatcher, updater, botStartTime, IMAGE_URL
|
||||
from bot import bot, dispatcher, updater, botStartTime, IMAGE_URL, IGNORE_PENDING_REQUESTS
|
||||
from bot.helper.ext_utils import fs_utils
|
||||
from bot.helper.telegram_helper.bot_commands import BotCommands
|
||||
from bot.helper.telegram_helper.message_utils import *
|
||||
|
|
@ -232,7 +232,7 @@ def main():
|
|||
dispatcher.add_handler(help_handler)
|
||||
dispatcher.add_handler(stats_handler)
|
||||
dispatcher.add_handler(log_handler)
|
||||
updater.start_polling()
|
||||
updater.start_polling(drop_pending_updates=IGNORE_PENDING_REQUESTS)
|
||||
LOGGER.info("Bot Started!")
|
||||
signal.signal(signal.SIGINT, fs_utils.exit_clean_up)
|
||||
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ class AriaDownloadHelper(DownloadHelper):
|
|||
gdrive = GoogleDriveHelper(None)
|
||||
smsg, button = gdrive.drive_list(sname)
|
||||
if smsg:
|
||||
dl.getListener().onDownloadError(f'File is already available in Drive.\n\n')
|
||||
dl.getListener().onDownloadError(f'File/Folder is already available in Drive.\n\n')
|
||||
sendMarkup("Here are the search results:", dl.getListener().bot, dl.getListener().update, button)
|
||||
aria2.remove([download])
|
||||
return
|
||||
|
|
|
|||
|
|
@ -177,7 +177,7 @@ class MegaDownloadHelper:
|
|||
smsg, button = gd.drive_list(mname)
|
||||
if smsg:
|
||||
deleteMessage(listener.bot, msg)
|
||||
msg1 = "<b>File/Folder is already available in Drive.</b>\n<b>Here are the search results:</b>"
|
||||
msg1 = "File/Folder is already available in Drive.\nHere are the search results:"
|
||||
sendMarkup(msg1, listener.bot, listener.update, button)
|
||||
return
|
||||
else:
|
||||
|
|
@ -189,7 +189,7 @@ class MegaDownloadHelper:
|
|||
limit = MEGA_LIMIT
|
||||
limit = limit.split(' ', maxsplit=1)
|
||||
limitint = int(limit[0])
|
||||
msg3 = f'<b>Failed, Mega limit is {MEGA_LIMIT}.</b>\n<b>Your File/Folder size is {get_readable_file_size(api.getSize(node))}.</b>'
|
||||
msg3 = f'Failed, Mega limit is {MEGA_LIMIT}.\n<b>Your 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, msg)
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ def cloneNode(update, context):
|
|||
smsg, button = gd.drive_list(name)
|
||||
if smsg:
|
||||
deleteMessage(context.bot, msg1)
|
||||
msg3 = "<b>File/Folder is already available in Drive</b>.\n<b>Here are the search results:</b>"
|
||||
msg3 = "File/Folder is already available in Drive.\nHere are the search results:"
|
||||
sendMarkup(msg3, context.bot, update, button)
|
||||
return
|
||||
else:
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ TELEGRAM_HASH = ""
|
|||
DATABASE_URL = ""
|
||||
# Optional config
|
||||
AUTHORIZED_CHATS = ""
|
||||
IGNORE_PENDING_REQUESTS = ""
|
||||
USE_SERVICE_ACCOUNTS = ""
|
||||
INDEX_URL = ""
|
||||
UPTOBOX_TOKEN = ""
|
||||
|
|
@ -27,7 +28,7 @@ STOP_DUPLICATE_CLONE = ""
|
|||
STOP_DUPLICATE_MEGA = ""
|
||||
SHORTENER = ""
|
||||
SHORTENER_API = ""
|
||||
# To use limit leave space btw number and unit. Avialable units is (gb or GB, tb or TB)
|
||||
# To use limit leave space between number and unit. Available units is (gb or GB, tb or TB)
|
||||
TORRENT_DIRECT_LIMIT = ""
|
||||
CLONE_LIMIT = ""
|
||||
MEGA_LIMIT = ""
|
||||
|
|
|
|||
Loading…
Reference in New Issue