Skip to content
This repository has been archived by the owner on Dec 4, 2023. It is now read-only.

Commit

Permalink
Minor Change
Browse files Browse the repository at this point in the history
- Change logo, thanks to instagram.com/by__faqih for logo
- Add copyright
- Add new command in help

Signed-off-by: breakdowns <[email protected]>
  • Loading branch information
Hafitz Setya authored Sep 22, 2021
1 parent 452eb36 commit 11ce564
Show file tree
Hide file tree
Showing 10 changed files with 68 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ jobs:
usedocker: true
docker_heroku_process_type: web
stack: "container"
region: "us"
region: "eu"
env:
HD_CONFIG_FILE_URL: ${{secrets.CONFIG_FILE_URL}}
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![Slam](https://telegra.ph/file/db03910496f06094f1f7a.jpg)](https://youtu.be/Pk_TthHfLeE)
[![SlamDevs](https://telegra.ph/file/143032e96542e7534f073.jpg)](https://t.me/SlamDevs)

# Slam Mirror Bot
![GitHub Repo stars](https://img.shields.io/github/stars/SlamDevs/slam-mirrorbot?color=blue&style=flat)
Expand All @@ -8,14 +8,16 @@
![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 Mirror Bot** is a _multipurpose_ Telegram Bot written in Python for mirroring files on the Internet to our beloved Google Drive. Based on [python-aria-mirror-bot](https://github.com/lzzy12/python-aria-mirror-bot)
**Slam Mirror Bot** is a _multipurpose_ Telegram Bot written in Python for mirroring/leeching files on the Internet to our beloved Google Drive. Based on [python-aria-mirror-bot](https://github.com/lzzy12/python-aria-mirror-bot)

# Features:
<details>
<summary><b>Click Here For More Details</b></summary>

## By Slam Devs
- qBittorrent
- Leach supported
- Thumbnail supported
- Size limiting for Torrent/Direct, Tar/Unzip, Mega and clone
- Stop duplicates for all tasks except for qBittorrent and youtube-dl tasks
- Tar/Unzip G-Drive link
Expand Down Expand Up @@ -169,6 +171,8 @@ Fill up rest of the fields. Meaning of each field is discussed below:
- `SERVER_PORT`: Only For VPS even if `IS_VPS` is `False` --> Base URL Port
- `BASE_URL_OF_BOT`: (Required for Heroku to avoid sleep/idling) Valid BASE URL of app where the bot is deployed. Format of URL should be `http://myip` (where `myip` is the IP/Domain of your bot) or if you have chosen other port than `80` then fill in this format `http://myip:port`, for Heroku fill `https://yourappname.herokuapp.com` (**NOTE**: Do not put slash at the end), still got idling? You can use http://cron-job.org to ping your Heroku app.
- `RECURSIVE_SEARCH`: Set this to `True` to search in sub-folders with `/list` (**NOTE**: This will only work with shared-drive ID or fill `root` for main drive. Folder IDs are not compatible with it.)
- `TG_SPLIT_SIZE`: Size Telegram split, leave it empty for max size `2GB`
- `AS_DOCUMENT`: Should all the upload to telegram be forced as documents or not, set it `True` or `False`
- `SHORTENER_API`: Fill your Shortener API key if you are using Shortener.
- `SHORTENER`: if you want to use Shortener in G-Drive and index link, fill Shortener URL here. Examples:
```
Expand Down
26 changes: 26 additions & 0 deletions bot/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,22 @@ def log(update, context):
<br><br>
<b>/{BotCommands.QbUnzipMirrorCommand}</b> [magnet_link]: Starts mirroring using qBittorrent and if downloaded file is any archive, extracts it to Google Drive
<br><br>
<b>/{BotCommands.LeechCommand}</b> This command should be used as reply to Magnet link, Torrent link, or Direct link. [this command will SPAM the chat and send the downloads a seperate files, if there is more than one file, in the specified Torrent]
<br><br>
<b>/{BotCommands.TarLeechCommand}</b> This command should be used as reply to Magnet link, Torrent link, or Direct link and upload it as (.tar). [this command will SPAM the chat and send the downloads a seperate files, if there is more than one file, in the specified Torrent]
<br><br>
<b>/{BotCommands.ZipLeechCommand}</b> This command should be used as reply to Magnet link, Torrent link, or Direct link and upload it as (.zip). [this command will SPAM the chat and send the downloads a seperate files, if there is more than one file, in the specified Torrent]
<br><br>
<b>/{BotCommands.UnzipLeechCommand}</b> This command should be used as reply to Magnet link, Torrent link, or Direct link and if file is any archive, extracts it. [this command will SPAM the chat and send the downloads a seperate files, if there is more than one file, in the specified Torrent]
<br><br>
<b>/{BotCommands.QbLeechCommand}</b> This command should be used as reply to Magnet link, Torrent link, or Direct link using qBittorrent. [this command will SPAM the chat and send the downloads a seperate files, if there is more than one file, in the specified Torrent]
<br><br>
<b>/{BotCommands.QbTarLeechCommand}</b> This command should be used as reply to Magnet link, Torrent link, or Direct link and upload it as (.tar) using qBittorrent. [this command will SPAM the chat and send the downloads a seperate files, if there is more than one file, in the specified Torrent]
<br><br>
<b>/{BotCommands.QbZipLeechCommand}</b> This command should be used as reply to Magnet link, Torrent link, or Direct link and upload it as (.zip) using qBittorrent. [this command will SPAM the chat and send the downloads a seperate files, if there is more than one file, in the specified Torrent]
<br><br>
<b>/{BotCommands.QbUnzipLeechCommand}</b> This command should be used as reply to Magnet link, Torrent link, or Direct link and if file is any archive, extracts it using qBittorrent. [this command will SPAM the chat and send the downloads a seperate files, if there is more than one file, in the specified Torrent]
<br><br>
<b>/{BotCommands.CloneCommand}</b> [drive_url]: Copy file/folder to Google Drive
<br><br>
<b>/{BotCommands.CountCommand}</b> [drive_url]: Count file/folder of Google Drive Links
Expand All @@ -117,6 +133,16 @@ def log(update, context):
<br><br>
<b>/{BotCommands.ZipWatchCommand}</b> [youtube-dl supported link]: Mirror through youtube-dl and zip before uploading
<br><br>
<b>/{BotCommands.LeechWatchCommand}</b> Leech through youtube-dl
<br><br>
<b>/{BotCommands.LeechTarWatchCommand}</b> Leech through youtube-dl and tar before uploading
<br><br>
<b>/{BotCommands.LeechTarWatchCommand}</b> Leech through youtube-dl and zip before uploading
<br><br>
<b>/{BotCommands.LeechSetCommand}</b> Leech Settings
<br><br>
<b>/{BotCommands.SetThumbCommand}</b> Reply to photo to set it as thumbnail for next uploads
<br><br>
<b>/{BotCommands.CancelMirror}</b>: Reply to the message by which the download was initiated and that download will be cancelled
<br><br>
<b>/{BotCommands.CancelAllCommand}</b>: Cancel all running tasks
Expand Down
18 changes: 9 additions & 9 deletions bot/helper/ext_utils/bot_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,20 +137,20 @@ def get_readable_message():
]:
msg += f"\n<code>{get_progress_bar_string(download)}</code> {download.progress()}"
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()} <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> <b>ETA:</b> <code>{download.eta()}</code>"
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>"
Expand All @@ -159,7 +159,7 @@ def get_readable_message():
break
if STATUS_LIMIT is not None:
if dick_no > STATUS_LIMIT:
msg += f"<b>Page:</b> {PAGE_NO}/{pages} | <b>Tasks:</b> {dick_no}\n"
msg += f"<b>Page:</b> <code>{PAGE_NO}</code>/<code>{pages}</code> | <b>Tasks:</b> <code>{dick_no}</code>\n"
buttons = button_build.ButtonMaker()
buttons.sbutton("Previous", "pre")
buttons.sbutton("Next", "nex")
Expand Down
4 changes: 4 additions & 0 deletions bot/helper/mirror_utils/status_utils/split_status.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Implement By - @anasty17 (https://github.com/SlamDevs/slam-mirrorbot/commit/d888a1e7237f4633c066f7c2bbfba030b83ad616)
# (c) https://github.com/SlamDevs/slam-mirrorbot
# All rights reserved

from .status import Status
from bot.helper.ext_utils.bot_utils import get_readable_file_size, MirrorStatus

Expand Down
4 changes: 4 additions & 0 deletions bot/helper/mirror_utils/status_utils/tg_upload_status.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Implement By - @anasty17 (https://github.com/SlamDevs/slam-mirrorbot/commit/d888a1e7237f4633c066f7c2bbfba030b83ad616)
# (c) https://github.com/SlamDevs/slam-mirrorbot
# All rights reserved

from .status import Status
from bot.helper.ext_utils.bot_utils import MirrorStatus, get_readable_file_size, get_readable_time
from bot import DOWNLOAD_DIR
Expand Down
6 changes: 4 additions & 2 deletions bot/helper/mirror_utils/upload_utils/pyrogramEngine.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Implement By - @anasty17 (https://github.com/SlamDevs/slam-mirrorbot/commit/d888a1e7237f4633c066f7c2bbfba030b83ad616)
# (c) https://github.com/SlamDevs/slam-mirrorbot
# All rights reserved

import os
import logging
import time
Expand Down Expand Up @@ -146,5 +150,3 @@ def cancel_download(self):
self.is_cancelled = True
LOGGER.info(f"Cancelling Upload: {self.name}")
self.__listener.onUploadError('your upload has been stopped!')


16 changes: 8 additions & 8 deletions bot/helper/telegram_helper/message_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@ def update_all_messages():
free = get_readable_file_size(free)
currentTime = get_readable_time(time.time() - botStartTime)
msg, buttons = get_readable_message()
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
Expand All @@ -91,7 +91,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:
Expand All @@ -112,9 +112,9 @@ def sendStatusMessage(msg, bot):
free = get_readable_file_size(free)
currentTime = get_readable_time(time.time() - botStartTime)
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
Expand All @@ -132,7 +132,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:
Expand Down
4 changes: 4 additions & 0 deletions bot/modules/leech_settings.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Implement By - @anasty17 (https://github.com/SlamDevs/slam-mirrorbot/commit/d888a1e7237f4633c066f7c2bbfba030b83ad616)
# (c) https://github.com/SlamDevs/slam-mirrorbot
# All rights reserved

import os
import threading

Expand Down
3 changes: 2 additions & 1 deletion config_sample.env
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ IGNORE_PENDING_REQUESTS = ""
USE_SERVICE_ACCOUNTS = ""
INDEX_URL = ""
STATUS_LIMIT = "" # Recommend limit status to 4 tasks
TG_SPLIT_SIZE = "" # leave it empty for max size(2GB)
# Leech
TG_SPLIT_SIZE = "" # leave it empty for max size (2GB)
AS_DOCUMENT = ""
UPTOBOX_TOKEN = ""
MEGA_API_KEY = ""
Expand Down

0 comments on commit 11ce564

Please sign in to comment.