Little bit change

Signed-off-by: breakdowns <hafitz666@outlook.co.id>
This commit is contained in:
Hafitz Setya 2021-08-09 08:48:51 +07:00 committed by GitHub
parent 43f125418e
commit 3237a5f438
Signed by untrusted user: GitHub
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 45 additions and 49 deletions

View File

@ -3,17 +3,11 @@
# Slam Tg Mirror Bot
![GitHub Repo stars](https://img.shields.io/github/stars/breakdowns/slam-tg-mirror-bot?color=blue&style=flat)
![GitHub forks](https://img.shields.io/github/forks/breakdowns/slam-tg-mirror-bot?color=green&style=flat)
![GitHub issues](https://img.shields.io/github/issues/breakdowns/slam-tg-mirror-bot)
![GitHub closed issues](https://img.shields.io/github/issues-closed/breakdowns/slam-tg-mirror-bot)
![GitHub pull requests](https://img.shields.io/github/issues-pr/breakdowns/slam-tg-mirror-bot)
![GitHub closed pull requests](https://img.shields.io/github/issues-pr-closed/breakdowns/slam-tg-mirror-bot)
![GitHub watchers](https://img.shields.io/github/watchers/breakdowns/slam-tg-mirror-bot)
![GitHub contributors](https://img.shields.io/github/contributors/breakdowns/slam-tg-mirror-bot?style=flat)
![GitHub repo size](https://img.shields.io/github/repo-size/breakdowns/slam-tg-mirror-bot?color=red)
![GitHub commit activity](https://img.shields.io/github/commit-activity/m/breakdowns/slam-tg-mirror-bot)
![GitHub](https://img.shields.io/github/license/breakdowns/slam-tg-mirror-bot)
[![Channel](https://img.shields.io/badge/Join%20Channel-!-red)](https://t.me/SlamMirrorUpdates)
![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 Tg Mirror Bot** is a _multipurpose_ Telegram Bot writen in Python for mirroring files on the Internet to our beloved Google Drive.
@ -27,6 +21,7 @@
- Limiting size Torrent/Direct, Tar/Unzip, Mega, cloning Google Drive support
- Stop duplicate cloning Google Drive & mirroring Mega support
- Tar/Unzip Google Drive link support
- Select files before downloading
- Sudo with Database support
- Extracting **tar.xz** support
- Counting Google Drive link
@ -48,6 +43,7 @@ streamtape.com, streamsb.net, feurl.com, pixeldrain.com, racaty.net,
1fichier.com, 1drv.ms (Only works for file not folder or business account),
uptobox.com (Uptobox account must be premium), solidfiles.com
```
## From Original Repos
- Mirroring direct download links, Torrent, and Telegram files to Google Drive
- Mirroring Mega.nz links to Google Drive (If your Mega account not premium, it will limit 5GB/6 hours)
@ -166,9 +162,9 @@ Fill up rest of the fields. Meaning of each fields are discussed below:
- **HEROKU_APP_NAME**: (Only if you deploying on Heroku) Your Heroku app name.
- **IGNORE_PENDING_REQUESTS**: If you want the bot to ignore pending requests after it restarts, set this to `True`.
- **STATUS_LIMIT**: Status limit with buttons (**NOTE**: Recommend limit status to `4` tasks max).
- **IS_VPS**: Set it to `True` if you use VPS
- **SERVER_PORT**: Your VPS port
- **BASE_URL_OF_BOT**: Valid BASE URL of where the bot is deploy. Ip/domain of your bot like `http://myip` or if you have chosen other port then `80` then `http://myip:port`. No slash at the end, for Heroku fill `https://yourappname.herokuapp.com`.
- **IS_VPS**: (Only for VPS) Set it to `True` if you use VPS
- **SERVER_PORT**: (Only for VPS) Your VPS port
- **BASE_URL_OF_BOT**: (Required for Heroku) Valid BASE URL of where the bot is deploy. Ip/domain of your bot like `http://myip` or if you have chosen other port then `80` then `http://myip:port`, for Heroku fill `https://yourappname.herokuapp.com` (**NOTE**: No slash at the end)
- **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:
```

View File

@ -206,7 +206,7 @@ except KeyError:
try:
UPTOBOX_TOKEN = getConfig('UPTOBOX_TOKEN')
except KeyError:
logging.info('UPTOBOX_TOKEN not provided!')
logging.warning('UPTOBOX_TOKEN not provided!')
UPTOBOX_TOKEN = None
try:
INDEX_URL = getConfig('INDEX_URL')

View File

@ -31,15 +31,15 @@ def stats(update, context):
cpuUsage = psutil.cpu_percent(interval=0.5)
memory = psutil.virtual_memory().percent
disk = psutil.disk_usage('/').percent
stats = f'<b>Bot Uptime:</b> {currentTime}\n' \
f'<b>Total Disk Space:</b> {total}\n' \
f'<b>Used:</b> {used} ' \
f'<b>Free:</b> {free}\n\n' \
f'📊Data Usage📊\n<b>Upload:</b> {sent}\n' \
f'<b>Download:</b> {recv}\n\n' \
f'<b>CPU:</b> {cpuUsage}%\n' \
f'<b>RAM:</b> {memory}%\n' \
f'<b>DISK:</b> {disk}%'
stats = f'<b>Bot Uptime:</b> <code>{currentTime}</code>\n' \
f'<b>Total Disk Space:</b> <code>{total}</code>\n' \
f'<b>Used:</b> <code>{used}</code> ' \
f'<b>Free:</b> <code>{free}</code>\n\n' \
f'<b>Upload:</b> <code>{sent}</code>\n' \
f'<b>Download:</b> <code>{recv}</code>\n\n' \
f'<b>CPU:</b> <code>{cpuUsage}%</code> ' \
f'<b>RAM:</b> <code>{memory}%</code> ' \
f'<b>DISK:</b> <code>{disk}%</code>'
sendMessage(stats, context.bot, update)
@ -50,7 +50,7 @@ Type /{BotCommands.HelpCommand} to get a list of available commands
'''
buttons = button_build.ButtonMaker()
buttons.buildbutton("Repo", "https://github.com/breakdowns/slam-tg-mirror-bot")
buttons.buildbutton("Support Group", "https://t.me/SlamMirrorSupport")
buttons.buildbutton("Channel", "https://t.me/SlamMirrorUpdates")
reply_markup = InlineKeyboardMarkup(buttons.build_menu(2))
LOGGER.info('UID: {} - UN: {} - MSG: {}'.format(update.message.chat.id, update.message.chat.username, update.message.text))
uptime = get_readable_time((time.time() - botStartTime))

View File

@ -124,22 +124,22 @@ def get_readable_message():
if download.status() != MirrorStatus.STATUS_ARCHIVING and download.status() != MirrorStatus.STATUS_EXTRACTING:
msg += f"\n<code>{get_progress_bar_string(download)} {download.progress()}</code>"
if download.status() == MirrorStatus.STATUS_CLONING:
msg += f"\n<b>Cloned:</b> {get_readable_file_size(download.processed_bytes())} of {download.size()}"
msg += f"\n<b>Cloned:</b> <code>{get_readable_file_size(download.processed_bytes())}</code> of <code>{download.size()}</code>"
elif download.status() == MirrorStatus.STATUS_UPLOADING:
msg += f"\n<b>Uploaded:</b> {get_readable_file_size(download.processed_bytes())} of {download.size()}"
msg += f"\n<b>Uploaded:</b> <code>{get_readable_file_size(download.processed_bytes())}</code> of <code>{download.size()}</code>"
else:
msg += f"\n<b>Downloaded:</b> {get_readable_file_size(download.processed_bytes())} of {download.size()}"
msg += f"\n<b>Speed:</b> {download.speed()}" \
f", <b>ETA:</b> {download.eta()} "
msg += f"\n<b>Downloaded:</b> <code>{get_readable_file_size(download.processed_bytes())}</code> of <code>{download.size()}</code>"
msg += f"\n<b>Speed:</b> <code>{download.speed()}</code>" \
f", <b>ETA:</b> <code>{download.eta()}</code> "
# if hasattr(download, 'is_torrent'):
try:
msg += f"\n<b>Seeders:</b> {download.aria_download().num_seeders}" \
f" | <b>Peers:</b> {download.aria_download().connections}"
msg += f"\n<b>Seeders:</b> <code>{download.aria_download().num_seeders}</code>" \
f" | <b>Peers:</b> <code>{download.aria_download().connections}</code>"
except:
pass
try:
msg += f"\n<b>Seeders:</b> {download.torrent_info().num_seeds}" \
f" | <b>Leechers:</b> {download.torrent_info().num_leechs}"
msg += f"\n<b>Seeders:</b> <code>{download.torrent_info().num_seeds}</code>" \
f" | <b>Leechers:</b> <code>{download.torrent_info().num_leechs}</code>"
except:
pass
msg += f"\n<b>To Stop:</b> <code>/{BotCommands.CancelMirror} {download.gid()}</code>"
@ -151,7 +151,7 @@ def get_readable_message():
if INDEX > COUNT + STATUS_LIMIT:
return None, None
if dick_no > STATUS_LIMIT:
msg += f"Page: {PAGE_NO}/{pages} | Tasks: {dick_no}\n"
msg += f"Page: <code>{PAGE_NO}/{pages}</code> | <code>Tasks: {dick_no}</code>\n"
buttons = button_build.ButtonMaker()
buttons.sbutton("Previous", "pre")
buttons.sbutton("Next", "nex")

View File

@ -653,7 +653,7 @@ class GoogleDriveHelper:
if self.num_of_path > 1:
self.edit_telegraph()
msg = f"<b>Found {len(response['files'])} results for <i>{fileName}</i></b>"
msg = f"<b>Found <code>{len(response['files'])}</code> results for <code>{fileName}</code></b>"
buttons = button_build.ButtonMaker()
buttons.buildbutton("🔎 VIEW", f"https://telegra.ph/{self.path[0]}")

View File

@ -73,9 +73,9 @@ def update_all_messages():
msg, buttons = get_readable_message()
if msg is None:
return
msg += f"<b>CPU:</b> {psutil.cpu_percent()}%" \
f" <b>RAM:</b> {psutil.virtual_memory().percent}%" \
f" <b>DISK:</b> {psutil.disk_usage('/').percent}%"
msg += f"<b>CPU:</b> <code>{psutil.cpu_percent()}%</code>" \
f" <b>RAM:</b> <code>{psutil.virtual_memory().percent}%</code>" \
f" <b>DISK:</b> <code>{psutil.disk_usage('/').percent}%</code>"
with download_dict_lock:
dlspeed_bytes = 0
uldl_bytes = 0
@ -93,7 +93,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"\n<b>FREE:</b> {free} | <b>UPTIME:</b> {currentTime}\n<b>DL:</b> {dlspeed}/s 🔻 | <b>UL:</b> {ulspeed}/s 🔺\n"
msg += f"\n<b>FREE:</b> <code>{free}</code> | <b>UPTIME:</b> <code>{currentTime}</code>\n<b>DL:</b> <code>{dlspeed}/s</code> 🔻 | <b>UL:</b> <code>{ulspeed}/s</code> 🔺\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:
@ -116,9 +116,9 @@ def sendStatusMessage(msg, bot):
progress, buttons = get_readable_message()
if progress is None:
progress, buttons = get_readable_message()
progress += f"<b>CPU:</b> {psutil.cpu_percent()}%" \
f" <b>RAM:</b> {psutil.virtual_memory().percent}%" \
f" <b>DISK:</b> {psutil.disk_usage('/').percent}%"
progress += f"<b>CPU:</b> <code>{psutil.cpu_percent()}%</code>" \
f" <b>RAM:</b> <code>{psutil.virtual_memory().percent}%</code>" \
f" <b>DISK:</b> <code>{psutil.disk_usage('/').percent}%</code>"
with download_dict_lock:
dlspeed_bytes = 0
uldl_bytes = 0
@ -136,7 +136,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"\n<b>FREE:</b> {free} | <b>UPTIME:</b> {currentTime}\n<b>DL:</b> {dlspeed}/s 🔻 | <b>UL:</b> {ulspeed}/s 🔺\n"
progress += f"\n<b>FREE:</b> <code>{free}</code> | <b>UPTIME:</b> <code>{currentTime}</code>\n<b>DL:</b> <code>{dlspeed}/s</code> 🔻 | <b>UL:</b> <code>{ulspeed}/s</code> 🔺\n"
with status_reply_dict_lock:
if msg.message.chat.id in list(status_reply_dict.keys()):
try:

View File

@ -18,7 +18,7 @@ def list_drive(update, context):
if button:
editMessage(msg, reply, button)
else:
editMessage(f'No result found for <b>{search}</b>', reply, button)
editMessage(f'No result found for <code>{search}</code>', reply, button)
except IndexError:
sendMessage('Send a search key along with command', context.bot, update)

View File

@ -15,12 +15,12 @@ UPSTREAM_REPO = "https://github.com/breakdowns/slam-aria-mirror-bot"
UPSTREAM_BRANCH = "master"
# OPTIONAL CONFIG
DATABASE_URL = ""
AUTHORIZED_CHATS = "" # Split by space
SUDO_USERS = "" # Split by space
AUTHORIZED_CHATS = "" # Split by space
SUDO_USERS = "" # Split by space
IGNORE_PENDING_REQUESTS = ""
USE_SERVICE_ACCOUNTS = ""
INDEX_URL = ""
STATUS_LIMIT = "" # Recommend limit status to 4 tasks max
STATUS_LIMIT = "" # Recommend limit status to 4 tasks max
UPTOBOX_TOKEN = ""
MEGA_API_KEY = ""
MEGA_EMAIL_ID = ""
@ -32,8 +32,8 @@ SHORTENER = ""
SHORTENER_API = ""
# qBittorrent
IS_VPS = ""
SERVER_PORT = "80" # For VPS
BASE_URL_OF_BOT = "" #required for heroku
SERVER_PORT = "80" # Only for VPS
BASE_URL_OF_BOT = "" # Required for Heroku
# If you want to use Credentials externally from Index Links, fill these vars with the direct links
# These are optional, if you don't know, simply leave them, don't fill anything in them.
ACCOUNTS_ZIP_URL = ""

View File

@ -28,5 +28,5 @@ telegraph
tenacity
TgCrypto
torrentool
youtube_dl
urllib3
youtube_dl

View File

@ -286,11 +286,11 @@ async def e404_middleware(app, handler):
try:
response = await handler(request)
if response.status == 404:
return web.Response(text="<h1>404: Page not found</h2><br><h3>Slam</h3>",content_type="text/html")
return web.Response(text="<h1>404: Page not found</h2><br><h3>slam-tg-mirror-bot</h3>",content_type="text/html")
return response
except web.HTTPException as ex:
if ex.status == 404:
return web.Response(text="<h1>404: Page not found</h2><br><h3>Slam</h3>",content_type="text/html")
return web.Response(text="<h1>404: Page not found</h2><br><h3>slam-tg-mirror-bot</h3>",content_type="text/html")
raise
return middleware_handler