diff --git a/Dockerfile b/Dockerfile
index 626df92..4045683 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -20,7 +20,6 @@ ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8
COPY . .
-COPY .netrc /root/.netrc
RUN chmod +x aria.sh
CMD ["bash","start.sh"]
diff --git a/README.md b/README.md
index 1f9550b..a0520f6 100644
--- a/README.md
+++ b/README.md
@@ -33,13 +33,12 @@ Fork this repo, than upload credentials.json and token.pickle to your forks
## Features supported:
- Mirroring direct download links to Google Drive
- Mirroring Mega.nz links to google drive (In development stage)
-- Download progress
-- Upload progress
+- Copy files/folder from someone's drive to your drive
+- Download/upload progress
- Download/upload speeds and ETAs
- Docker support
- Uploading To Team Drives.
- Index Link support
-- Copy files/folder from someone's drive to your drive
- Service account support
- Mirror all youtube-dl supported links
- Mirror telegram files
@@ -48,6 +47,7 @@ Fork this repo, than upload credentials.json and token.pickle to your forks
- Nyaa.si and Sukebei Torrent search
- Shell and Executor
- Shortener support
+- Custom Buttons
- Speedtest with picture results
- Extract these filetypes and uploads to google drive
> ZIP, RAR, TAR, 7z, ISO, WIM, CAB, GZIP, BZIP2,
diff --git a/app.json b/app.json
index a8b5fc0..93a5826 100644
--- a/app.json
+++ b/app.json
@@ -47,11 +47,11 @@
"required": false
},
"USE_SERVICE_ACCOUNTS": {
- "description": "Whether to use service accounts or not. For this to work see 'Using service accounts' section below.",
+ "description": "Whether to use service accounts or not. For this to work see 'Using service accounts' in repo.",
"required": false
},
"AUTHORIZED_CHATS": {
- "description": "Put User ID and Chat ID of you want to authorize.",
+ "description": "Fill User ID and Chat ID of you want to authorize.",
"required": false
},
"INDEX_URL": {
@@ -83,12 +83,36 @@
"required": false
},
"SHORTENER": {
- "description": "if you want to use shortener in Gdrive and index link.",
+ "description": "If you want to use shortener in Gdrive and index link.",
"required": false
},
"SHORTENER_API": {
"description": "Fill your shortener api key if you are using shortener.",
"required": false
+ },
+ "BUTTON_THREE_NAME": {
+ "description": "Extra buttons (optional).",
+ "required": false
+ },
+ "BUTTON_THREE_URL": {
+ "description": "Fill your URL if you are using extra buttons.",
+ "required": false
+ },
+ "BUTTON_FOUR_NAME": {
+ "description": "Extra buttons (optional).",
+ "required": false
+ },
+ "BUTTON_FOUR_URL": {
+ "description": "Fill your URL if you are using extra buttons.",
+ "required": false
+ },
+ "BUTTON_FIVE_NAME": {
+ "description": "Extra buttons (optional).",
+ "required": false
+ },
+ "BUTTON_FIVE_URL": {
+ "description": "Fill your URL if you are using extra buttons.",
+ "required": false
}
}
}
diff --git a/bot/__init__.py b/bot/__init__.py
index 4d453aa..49c4ba9 100644
--- a/bot/__init__.py
+++ b/bot/__init__.py
@@ -136,6 +136,30 @@ try:
INDEX_URL = None
except KeyError:
INDEX_URL = None
+try:
+ BUTTON_THREE_NAME = getConfig('BUTTON_THREE_NAME')
+ BUTTON_THREE_URL = getConfig('BUTTON_THREE_URL')
+ if len(BUTTON_THREE_NAME) == 0 or len(BUTTON_THREE_URL) == 0:
+ raise KeyError
+except KeyError:
+ BUTTON_THREE_NAME = None
+ BUTTON_THREE_URL = None
+try:
+ BUTTON_FOUR_NAME = getConfig('BUTTON_FOUR_NAME')
+ BUTTON_FOUR_URL = getConfig('BUTTON_FOUR_URL')
+ if len(BUTTON_FOUR_NAME) == 0 or len(BUTTON_FOUR_URL) == 0:
+ raise KeyError
+except KeyError:
+ BUTTON_FOUR_NAME = None
+ BUTTON_FOUR_URL = None
+try:
+ BUTTON_FIVE_NAME = getConfig('BUTTON_FIVE_NAME')
+ BUTTON_FIVE_URL = getConfig('BUTTON_FIVE_URL')
+ if len(BUTTON_FIVE_NAME) == 0 or len(BUTTON_FIVE_URL) == 0:
+ raise KeyError
+except KeyError:
+ BUTTON_FIVE_NAME = None
+ BUTTON_FIVE_URL = None
try:
IS_TEAM_DRIVE = getConfig('IS_TEAM_DRIVE')
if IS_TEAM_DRIVE.lower() == 'true':
@@ -144,7 +168,6 @@ try:
IS_TEAM_DRIVE = False
except KeyError:
IS_TEAM_DRIVE = False
-
try:
USE_SERVICE_ACCOUNTS = getConfig('USE_SERVICE_ACCOUNTS')
if USE_SERVICE_ACCOUNTS.lower() == 'true':
@@ -153,7 +176,6 @@ try:
USE_SERVICE_ACCOUNTS = False
except KeyError:
USE_SERVICE_ACCOUNTS = False
-
try:
BLOCK_MEGA_LINKS = getConfig('BLOCK_MEGA_LINKS')
if BLOCK_MEGA_LINKS.lower() == 'true':
@@ -162,7 +184,6 @@ try:
BLOCK_MEGA_LINKS = False
except KeyError:
BLOCK_MEGA_LINKS = False
-
try:
SHORTENER = getConfig('SHORTENER')
SHORTENER_API = getConfig('SHORTENER_API')
diff --git a/bot/__main__.py b/bot/__main__.py
index 49519bb..166d650 100644
--- a/bot/__main__.py
+++ b/bot/__main__.py
@@ -33,10 +33,10 @@ def stats(update, context):
f'Total disk space: {total}\n' \
f'Used: {used} ' \
f'Free: {free}\n\n' \
- f'Data Usage\nUpload: {sent}\n' \
+ f'📊Data Usage📊\nUpload: {sent}\n' \
f'Down: {recv}\n\n' \
- f'CPU: {cpuUsage}%\n' \
- f'RAM: {memory}%\n' \
+ f'CPU: {cpuUsage}% ' \
+ f'RAM: {memory}% ' \
f'Disk: {disk}%'
sendMessage(stats, context.bot, update)
diff --git a/bot/helper/mirror_utils/upload_utils/gdriveTools.py b/bot/helper/mirror_utils/upload_utils/gdriveTools.py
index 28b9c40..d7fedfb 100644
--- a/bot/helper/mirror_utils/upload_utils/gdriveTools.py
+++ b/bot/helper/mirror_utils/upload_utils/gdriveTools.py
@@ -20,7 +20,7 @@ from telegram import InlineKeyboardMarkup
from bot.helper.telegram_helper import button_build
from telegraph import Telegraph
from bot import parent_id, DOWNLOAD_DIR, IS_TEAM_DRIVE, INDEX_URL, \
- USE_SERVICE_ACCOUNTS, download_dict, telegraph_token, SHORTENER, SHORTENER_API
+ USE_SERVICE_ACCOUNTS, download_dict, telegraph_token, BUTTON_THREE_NAME, BUTTON_THREE_URL, BUTTON_FOUR_NAME, BUTTON_FOUR_URL, BUTTON_FIVE_NAME, BUTTON_FIVE_URL, SHORTENER, SHORTENER_API
from bot.helper.ext_utils.bot_utils import *
from bot.helper.ext_utils.fs_utils import get_mime_type, get_path_size
@@ -322,16 +322,22 @@ class GoogleDriveHelper:
buttons = button_build.ButtonMaker()
if SHORTENER is not None and SHORTENER_API is not None:
surl = requests.get('https://{}/api?api={}&url={}&format=text'.format(SHORTENER, SHORTENER_API, durl)).text
- buttons.buildbutton("✨Drive Link✨", surl)
+ buttons.buildbutton("Drive Link", surl)
else:
- buttons.buildbutton("✨Drive Link✨", durl)
+ buttons.buildbutton("Drive Link", durl)
if INDEX_URL is not None:
url = requests.utils.requote_uri(f'{INDEX_URL}/{meta.get("name")}/')
if SHORTENER is not None and SHORTENER_API is not None:
siurl = requests.get('https://{}/api?api={}&url={}&format=text'.format(SHORTENER, SHORTENER_API, url)).text
- buttons.buildbutton("⚡Index Link⚡", siurl)
+ buttons.buildbutton("Index Link", siurl)
else:
- buttons.buildbutton("⚡Index Link⚡", url)
+ buttons.buildbutton("Index Link", url)
+ if BUTTON_THREE_NAME is not None and BUTTON_THREE_URL is not None:
+ buttons.buildbutton(f"{BUTTON_THREE_NAME}", f"{BUTTON_THREE_URL}")
+ if BUTTON_FOUR_NAME is not None and BUTTON_FOUR_URL is not None:
+ buttons.buildbutton(f"{BUTTON_FOUR_NAME}", f"{BUTTON_FOUR_URL}")
+ if BUTTON_FIVE_NAME is not None and BUTTON_FIVE_URL is not None:
+ buttons.buildbutton(f"{BUTTON_FIVE_NAME}", f"{BUTTON_FIVE_URL}")
else:
file = self.copyFile(meta.get('id'), parent_id)
msg += f'Filename : {file.get("name")}'
@@ -339,9 +345,9 @@ class GoogleDriveHelper:
buttons = button_build.ButtonMaker()
if SHORTENER is not None and SHORTENER_API is not None:
surl = requests.get('https://{}/api?api={}&url={}&format=text'.format(SHORTENER, SHORTENER_API, durl)).text
- buttons.buildbutton("✨Drive Link ✨", surl)
+ buttons.buildbutton("Drive Link ", surl)
else:
- buttons.buildbutton("✨Drive Link✨", durl)
+ buttons.buildbutton("Drive Link", durl)
try:
msg += f'\nSize : {get_readable_file_size(int(meta.get("size")))}'
except TypeError:
@@ -350,9 +356,15 @@ class GoogleDriveHelper:
url = requests.utils.requote_uri(f'{INDEX_URL}/{file.get("name")}')
if SHORTENER is not None and SHORTENER_API is not None:
siurl = requests.get('https://{}/api?api={}&url={}&format=text'.format(SHORTENER, SHORTENER_API, url)).text
- buttons.buildbutton("⚡Index Link⚡", siurl)
+ buttons.buildbutton("Index Link", siurl)
else:
- buttons.buildbutton("⚡Index Link⚡", url)
+ buttons.buildbutton("Index Link", url)
+ if BUTTON_THREE_NAME is not None and BUTTON_THREE_URL is not None:
+ buttons.buildbutton(f"{BUTTON_THREE_NAME}", f"{BUTTON_THREE_URL}")
+ if BUTTON_FOUR_NAME is not None and BUTTON_FOUR_URL is not None:
+ buttons.buildbutton(f"{BUTTON_FOUR_NAME}", f"{BUTTON_FOUR_URL}")
+ if BUTTON_FIVE_NAME is not None and BUTTON_FIVE_URL is not None:
+ buttons.buildbutton(f"{BUTTON_FIVE_NAME}", f"{BUTTON_FIVE_URL}")
except Exception as err:
if isinstance(err, RetryError):
LOGGER.info(f"Total Attempts: {err.last_attempt.attempt_number}")
diff --git a/bot/modules/mirror.py b/bot/modules/mirror.py
index 376021a..84547e9 100644
--- a/bot/modules/mirror.py
+++ b/bot/modules/mirror.py
@@ -2,7 +2,7 @@ import requests
from telegram.ext import CommandHandler, run_async
from telegram import InlineKeyboardMarkup
-from bot import Interval, INDEX_URL, BLOCK_MEGA_LINKS
+from bot import Interval, INDEX_URL, BUTTON_THREE_NAME, BUTTON_THREE_URL, BUTTON_FOUR_NAME, BUTTON_FOUR_URL, BUTTON_FIVE_NAME, BUTTON_FIVE_URL, BLOCK_MEGA_LINKS
from bot import dispatcher, DOWNLOAD_DIR, DOWNLOAD_STATUS_UPDATE_INTERVAL, download_dict, download_dict_lock, SHORTENER, SHORTENER_API
from bot.helper.ext_utils import fs_utils, bot_utils
from bot.helper.ext_utils.bot_utils import setInterval
@@ -143,9 +143,9 @@ class MirrorListener(listeners.MirrorListeners):
buttons = button_build.ButtonMaker()
if SHORTENER is not None and SHORTENER_API is not None:
surl = requests.get('https://{}/api?api={}&url={}&format=text'.format(SHORTENER, SHORTENER_API, link)).text
- buttons.buildbutton("✨Drive Link✨", surl)
+ buttons.buildbutton("Drive Link", surl)
else:
- buttons.buildbutton("✨Drive Link✨", link)
+ buttons.buildbutton("Drive Link", link)
LOGGER.info(f'Done Uploading {download_dict[self.uid].name()}')
if INDEX_URL is not None:
share_url = requests.utils.requote_uri(f'{INDEX_URL}/{download_dict[self.uid].name()}')
@@ -153,9 +153,15 @@ class MirrorListener(listeners.MirrorListeners):
share_url += '/'
if SHORTENER is not None and SHORTENER_API is not None:
siurl = requests.get('https://{}/api?api={}&url={}&format=text'.format(SHORTENER, SHORTENER_API, share_url)).text
- buttons.buildbutton("⚡Index Link⚡", siurl)
+ buttons.buildbutton("Index Link", siurl)
else:
- buttons.buildbutton("⚡Index Link⚡", share_url)
+ buttons.buildbutton("Index Link", share_url)
+ if BUTTON_THREE_NAME is not None and BUTTON_THREE_URL is not None:
+ buttons.buildbutton(f"{BUTTON_THREE_NAME}", f"{BUTTON_THREE_URL}")
+ if BUTTON_FOUR_NAME is not None and BUTTON_FOUR_URL is not None:
+ buttons.buildbutton(f"{BUTTON_FOUR_NAME}", f"{BUTTON_FOUR_URL}")
+ if BUTTON_FIVE_NAME is not None and BUTTON_FIVE_URL is not None:
+ buttons.buildbutton(f"{BUTTON_FIVE_NAME}", f"{BUTTON_FIVE_URL}")
if self.message.from_user.username:
uname = f"@{self.message.from_user.username}"
else:
diff --git a/config_sample.env b/config_sample.env
index d006b44..36b0c12 100644
--- a/config_sample.env
+++ b/config_sample.env
@@ -21,3 +21,11 @@ MEGA_PASSWORD = ""
BLOCK_MEGA_LINKS = ""
SHORTENER = ""
SHORTENER_API = ""
+# Add more buttons (two buttons are already added of file link and index link, you can add extra buttons too, these are optional)
+# If you don't know what are below entries, simply leave them, Don't fill anything in them.
+BUTTON_THREE_NAME = ""
+BUTTON_THREE_URL = ""
+BUTTON_FOUR_NAME = ""
+BUTTON_FOUR_URL = ""
+BUTTON_FIVE_NAME = ""
+BUTTON_FIVE_URL = ""