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

Commit

Permalink
Repo name changed again
Browse files Browse the repository at this point in the history
Signed-off-by: breakdowns <[email protected]>
  • Loading branch information
Hafitz Setya authored Aug 7, 2021
1 parent 0bfba52 commit f62ce1c
Show file tree
Hide file tree
Showing 14 changed files with 76 additions and 54 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ FROM anasty17/megasdk:latest
WORKDIR /usr/src/app
RUN chmod 777 /usr/src/app

RUN apt-get install -y xz-utils neofetch unzip && apt-get autoremove -y
RUN apt-get install -y wget xz-utils neofetch unzip && apt-get autoremove -y

COPY requirements.txt .
RUN pip3 install --no-cache-dir -r requirements.txt
Expand Down
49 changes: 25 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,34 +1,32 @@
[![Slam](https://telegra.ph/file/db03910496f06094f1f7a.jpg)](https://youtu.be/Pk_TthHfLeE)

# Slam Aria Mirror Bot
![GitHub Repo stars](https://img.shields.io/github/stars/breakdowns/slam-aria-mirror-bot?color=blue&style=flat)
![GitHub forks](https://img.shields.io/github/forks/breakdowns/slam-aria-mirror-bot?color=green&style=flat)
![GitHub issues](https://img.shields.io/github/issues/breakdowns/slam-aria-mirror-bot)
![GitHub closed issues](https://img.shields.io/github/issues-closed/breakdowns/slam-aria-mirror-bot)
![GitHub pull requests](https://img.shields.io/github/issues-pr/breakdowns/slam-aria-mirror-bot)
![GitHub closed pull requests](https://img.shields.io/github/issues-pr-closed/breakdowns/slam-aria-mirror-bot)
![GitHub watchers](https://img.shields.io/github/watchers/breakdowns/slam-aria-mirror-bot)
![GitHub contributors](https://img.shields.io/github/contributors/breakdowns/slam-aria-mirror-bot?style=flat)
![GitHub repo size](https://img.shields.io/github/repo-size/breakdowns/slam-aria-mirror-bot?color=red)
![GitHub commit activity](https://img.shields.io/github/commit-activity/m/breakdowns/slam-aria-mirror-bot)
![GitHub](https://img.shields.io/github/license/breakdowns/slam-aria-mirror-bot)
![Maintenance](https://img.shields.io/badge/Maintained%3F-yes-green.svg)
![Docker Pulls](https://img.shields.io/docker/pulls/breakdowns/mega-sdk-python?label=Docker%20Pull)
# 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)

**Slam Aria Mirror Bot** is a _multipurpose_ Telegram Bot writen in Python for mirroring files on the Internet to our beloved Google Drive.
**Slam Tg 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
- qBittorrent supported
- Updater (**NOTE**: You must upload your **token.pickle** to Index and fill your **token.pickle** url to **TOKEN_PICKLE_URL**, because your **token.pickle** will deleted after update, for more info please check [Setting up config file](https://github.com/breakdowns/slam-aria-mirror-bot/tree/master#setting-up-config-file))
- 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
- Sudo with Database support
- Multiple Trackers support
- Extracting **tar.xz** support
- Counting Google Drive link
- Heroku config support
Expand Down Expand Up @@ -81,7 +79,7 @@ Deploying is pretty much straight forward and is divided into several steps as f

- Clone this repo:
```
git clone https://github.com/breakdowns/slam-aria-mirror-bot mirrorbot/
git clone https://github.com/breakdowns/slam-tg-mirror-bot mirrorbot/
cd mirrorbot
```

Expand Down Expand Up @@ -140,16 +138,16 @@ Fill up rest of the fields. Meaning of each fields are discussed below:
- **DOWNLOAD_DIR**: The path to the local folder where the downloads should be downloaded to
- **DOWNLOAD_STATUS_UPDATE_INTERVAL**: A short interval of time in seconds after which the Mirror progress message is updated. (I recommend to keep it `5` seconds at least)
- **AUTO_DELETE_MESSAGE_DURATION**: Interval of time (in seconds), after which the bot deletes it's message (and command message) which is expected to be viewed instantly. (**Note**: Set to `-1` to never automatically delete messages)
- **UPSTREAM_REPO**: Link for Bot Upstream Repo, if you want default update, fill `https://github.com/breakdowns/slam-aria-mirror-bot`.
- **UPSTREAM_REPO**: Link for Bot Upstream Repo, if you want default update, fill `https://github.com/breakdowns/slam-tg-mirror-bot`.
- **UPSTREAM_BRANCH**: Branch name for Bot Upstream Repo, fill `master`.
### Optional Field
- **ACCOUNTS_ZIP_URL**: Only if you want to load your Service Account externally from an Index Link. Archive your Service Account json files to a zip file directly (don't archive the accounts folder. Select all the jsons inside and zip them only instead. Name the zip file with whatever you want, it doesn't matter). Fill this with the direct link of that file.
- **TOKEN_PICKLE_URL**: Only if you want to load your **token.pickle** externally from an Index Link. Fill this with the direct link of that file.
- **DATABASE_URL**: Your Database URL. See [Generate Database](https://github.com/breakdowns/slam-aria-mirror-bot/tree/master#generate-database) to generate database (**NOTE**: If you use database you can save your sudo id permanent using `/addsudo` command).
- **DATABASE_URL**: Your Database URL. See [Generate Database](https://github.com/breakdowns/slam-tg-mirror-bot/tree/master#generate-database) to generate database (**NOTE**: If you use database you can save your sudo id permanent using `/addsudo` command).
- **AUTHORIZED_CHATS**: Fill user_id and chat_id (not username) of you want to authorize, Seprate them with space, Examples: `-0123456789 -1122334455 6915401739`.
- **SUDO_USERS**: Fill user_id (not username) of you want to sudoers, Seprate them with space, Examples: `0123456789 1122334455 6915401739` (**NOTE**: If you want save sudo id permanent without database, you must fill your sudo id there).
- **IS_TEAM_DRIVE**: Set to `True` if `GDRIVE_FOLDER_ID` is from a Team Drive else `False` or Leave it empty.
- **USE_SERVICE_ACCOUNTS**: (Leave empty if unsure) Whether to use Service Accounts or not. For this to work see [Using Service Accounts](https://github.com/breakdowns/slam-aria-mirror-bot#generate-service-accounts-what-is-service-account) section below.
- **USE_SERVICE_ACCOUNTS**: (Leave empty if unsure) Whether to use Service Accounts or not. For this to work see [Using Service Accounts](https://github.com/breakdowns/slam-tg-mirror-bot#generate-service-accounts-what-is-service-account) section below.
- **INDEX_URL**: Refer to https://gitlab.com/ParveenBhadooOfficial/Google-Drive-Index The URL should not have any trailing '/'
- **MEGA_API_KEY**: Mega.nz api key to mirror mega.nz links. Get it from [Mega SDK Page](https://mega.nz/sdk)
- **MEGA_EMAIL_ID**: Your email id you used to sign up on mega.nz for using premium accounts (Leave th)
Expand All @@ -167,6 +165,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**: For VPS
- **BASE_URL_OF_BOT**: Your app URL Examples: `https://yourappname.herokuapp.com`
- **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:
```
Expand Down Expand Up @@ -219,8 +220,8 @@ sudo docker run mirrorbot

## Deploying on Heroku

- Give stars and Fork this repo then upload **token.pickle** to your forks, or you can upload your **token.pickle** to your Index and put your **token.pickle** link to **TOKEN_PICKLE_URL** (**NOTE**: If you didn't upload **token.pickle** uploading will not work). How to generate **token.pickle**? [Read here](https://github.com/breakdowns/slam-aria-mirror-bot#getting-google-oauth-api-credential-file)
- Hit the **DEPLOY TO HEROKU** button and follow the further instructions in the screen (**NOTE**: If vars not coming, just change deploy link to your fork, Example: `https://dashboard.heroku.com/new?template=https://github.com/yourgithubname/slam-aria-mirror-bot`)
- Give stars and Fork this repo then upload **token.pickle** to your forks, or you can upload your **token.pickle** to your Index and put your **token.pickle** link to **TOKEN_PICKLE_URL** (**NOTE**: If you didn't upload **token.pickle** uploading will not work). How to generate **token.pickle**? [Read here](https://github.com/breakdowns/slam-tg-mirror-bot#getting-google-oauth-api-credential-file)
- Hit the **DEPLOY TO HEROKU** button and follow the further instructions in the screen (**NOTE**: If vars not coming, just change deploy link to your fork, Example: `https://dashboard.heroku.com/new?template=https://github.com/yourgithubname/slam-tg-mirror-bot`)
- Recommended to use 1 App in 1 Heroku accounts

<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>
Expand Down Expand Up @@ -293,7 +294,7 @@ python3 gen_sa_accounts.py --download-keys project_id
python3 add_to_team_drive.py -d SharedTeamDriveSrcID
```

# Youtube-dl authentication using [.netrc](https://github.com/breakdowns/slam-aria-mirror-bot/blob/master/.netrc) file
# Youtube-dl authentication using [.netrc](https://github.com/breakdowns/slam-tg-mirror-bot/blob/master/.netrc) file
For using your premium accounts in Youtube-dl or for protected Index Links, edit the netrc file according to following format:
```
machine host login username password my_youtube_password
Expand All @@ -316,4 +317,4 @@ Thanks to:
- [breakdowns](https://github.com/breakdowns) for slam-aria-mirror-bot
- [zevtyardt](https://github.com/zevtyardt) for some direct links

And many more people who aren't mentioned here, but may be found in [Contributors](https://github.com/breakdowns/slam-aria-mirror-bot/graphs/contributors).
And many more people who aren't mentioned here, but may be found in [Contributors](https://github.com/breakdowns/slam-tg-mirror-bot/graphs/contributors).
4 changes: 4 additions & 0 deletions alive.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Implement By - @anasty17 (https://github.com/breakdowns/slam-tg-mirror-bot/commit/0bfba523f095ab1dccad431d72561e0e002e7a59)
# (c) https://github.com/breakdowns/slam-aria-mirror-bot
# All rights reserved

import time
import requests
import os
Expand Down
23 changes: 18 additions & 5 deletions app.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"name": "slam-aria-mirror-bot",
"name": "slam-tg-mirror-bot",
"description": "A Telegram bot for all your mirror needs",
"logo": "https://telegra.ph/file/6507910fd06d18dfaba82.jpg",
"keywords": [
"bot",
"telegram",
"python"
],
"repository": "https://github.com/breakdowns/slam-aria-mirror-bot",
"website": "https://github.com/breakdowns/slam-aria-mirror-bot",
"repository": "https://github.com/breakdowns/slam-tg-mirror-bot",
"website": "https://github.com/breakdowns/slam-tg-mirror-bot",
"success_url": "https://t.me/SlamMirrorSupport",
"stack": "container",
"env": {
Expand Down Expand Up @@ -183,7 +183,20 @@
},
"STATUS_LIMIT": {
"description": "Status limit with buttons, Recommend limit status to 4 tasks max.",
"value": "",
"required": false
},
"IS_VPS": {
"description": "Only for VPS, fill False.",
"value": "False",
"required": false
},
"SERVER_PORT": {
"description": "Only for VPS, no need to fill it.",
"required": false
},
"BASE_URL_OF_BOT": {
"description": "Heroku App name web url, Examples: https://yourappname.herokuapp.com",
"value": "False",
"required": false
}
},
Expand All @@ -193,7 +206,7 @@
}
],
"formation": {
"worker": {
"web": {
"quantity": 1,
"size": "free"
}
Expand Down
1 change: 0 additions & 1 deletion aria.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,3 @@ aria2c --enable-rpc --check-certificate=false \
--disk-cache=64M --bt-enable-lpd=true --seed-time=0 --max-file-not-found=0 \
--max-tries=20 --auto-file-renaming=true --reuse-uri=true --http-accept-gzip=true \
--content-disposition-default-utf8=true --netrc-path=/usr/src/app/.netrc

4 changes: 2 additions & 2 deletions bot/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def bot_help(update, context):
help_string_adm = f'''
/{BotCommands.HelpCommand}: To get this message
/{BotCommands.MirrorCommand} [download_url][magnet_link]: Start mirroring the link to Google Drive
/{BotCommands.MirrorCommand} [download_url][magnet_link]: Start mirroring the link to Google Drive. Use /mirror qb to mirror with qBittorrent, and use /mirror qbs to select files before downloading
/{BotCommands.TarMirrorCommand} [download_url][magnet_link]: Start mirroring and upload the archived (.tar) version of the download
Expand Down Expand Up @@ -146,7 +146,7 @@ def bot_help(update, context):
help_string = f'''
/{BotCommands.HelpCommand}: To get this message
/{BotCommands.MirrorCommand} [download_url][magnet_link]: Start mirroring the link to Google Drive
/{BotCommands.MirrorCommand} [download_url][magnet_link]: Start mirroring the link to Google Drive. Use /mirror qb to mirror with qBittorrent, and use /mirror qbs to select files before downloading
/{BotCommands.TarMirrorCommand} [download_url][magnet_link]: Start mirroring and upload the archived (.tar) version of the download
Expand Down
5 changes: 4 additions & 1 deletion bot/helper/mirror_utils/download_utils/qbit_downloader.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Implement By - @anasty17 (https://github.com/breakdowns/slam-tg-mirror-bot/commit/0bfba523f095ab1dccad431d72561e0e002e7a59)
# (c) https://github.com/breakdowns/slam-aria-mirror-bot
# All rights reserved

import os
import random
import string
Expand Down Expand Up @@ -195,4 +199,3 @@ def get_hash_file(path):
done_handler = CallbackQueryHandler(get_confirm, pattern="done", run_async=True)
dispatcher.add_handler(pin_handler)
dispatcher.add_handler(done_handler)

5 changes: 4 additions & 1 deletion bot/helper/mirror_utils/status_utils/qbit_download_status.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Implement By - @anasty17 (https://github.com/breakdowns/slam-tg-mirror-bot/commit/0bfba523f095ab1dccad431d72561e0e002e7a59)
# (c) https://github.com/breakdowns/slam-aria-mirror-bot
# All rights reserved

from bot import DOWNLOAD_DIR, LOGGER, get_client
from bot.helper.ext_utils.bot_utils import MirrorStatus, get_readable_file_size, get_readable_time
from .status import Status
Expand Down Expand Up @@ -91,4 +95,3 @@ def cancel_download(self):
LOGGER.info(f"Cancelling Download: {self.name()}")
self.__listener.onDownloadError('Download stopped by user!')
self.__client.torrents_delete(torrent_hashes=self.__hash)

26 changes: 13 additions & 13 deletions bot/helper/mirror_utils/upload_utils/gdriveTools.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def getIdFromUrl(link: str):
regex = r"https://drive\.google\.com/(drive)?/?u?/?\d?/?(mobile)?/?(file)?(folders)?/?d?/([-\w]+)[?+]?/?(w+)?"
res = re.search(regex,link)
if res is None:
raise IndexError("GDrive ID not found.")
raise IndexError("G-Drive ID not found.")
return res.group(5)
parsed = urlparse.urlparse(link)
return parse_qs(parsed.query)['id'][0]
Expand All @@ -117,7 +117,7 @@ def __upload_empty_file(self, path, file_name, mime_type, parent_id=None):
resumable=False)
file_metadata = {
'name': file_name,
'description': 'Uploaded using Slam Aria Mirror Bot',
'description': 'Uploaded using Slam Tg Mirror Bot',
'mimeType': mime_type,
}
if parent_id is not None:
Expand Down Expand Up @@ -171,7 +171,7 @@ def upload_file(self, file_path, file_name, mime_type, parent_id):
# File body description
file_metadata = {
'name': file_name,
'description': 'Uploaded by Slam Aria Mirror Bot',
'description': 'Uploaded by Slam Tg Mirror Bot',
'mimeType': mime_type,
}
try:
Expand Down Expand Up @@ -363,7 +363,7 @@ def clone(self, link):
try:
file_id = self.getIdFromUrl(link)
except (KeyError,IndexError):
msg = "Google drive ID could not be found in the provided link"
msg = "Google Drive ID could not be found in the provided link"
return msg
msg = ""
LOGGER.info(f"File ID: {file_id}")
Expand Down Expand Up @@ -492,7 +492,7 @@ def create_directory(self, directory_name, parent_id):
file_id = file.get("id")
if not IS_TEAM_DRIVE:
self.__set_permission(file_id)
LOGGER.info("Created Google-Drive Folder:\nName: {}\nID: {} ".format(file.get("name"), file_id))
LOGGER.info("Created G-Drive Folder:\nName: {}\nID: {} ".format(file.get("name"), file_id))
return file_id

def upload_dir(self, input_directory, parent_id):
Expand Down Expand Up @@ -557,9 +557,9 @@ def edit_telegraph(self):
content += f'<b> | <a href="https://telegra.ph/{self.path[nxt_page]}">Next</a></b>'
nxt_page += 1
Telegraph(access_token=telegraph_token).edit_page(path = self.path[prev_page],
title = 'Slam Aria Mirror Bot Search',
author_name='Slam Aria Mirror Bot',
author_url='https://github.com/breakdowns/slam-aria-mirror-bot',
title = 'Slam Tg Mirror Bot Search',
author_name='Slam Tg Mirror Bot',
author_url='https://github.com/breakdowns/slam-tg-mirror-bot',
html_content=content)
return

Expand Down Expand Up @@ -642,9 +642,9 @@ def drive_list(self, fileName):

for content in self.telegraph_content :
self.path.append(Telegraph(access_token=telegraph_token).create_page(
title = 'Slam Aria Mirror Bot Search',
author_name='Slam Aria Mirror Bot',
author_url='https://github.com/breakdowns/slam-aria-mirror-bot',
title = 'Slam Tg Mirror Bot Search',
author_name='Slam Tg Mirror Bot',
author_url='https://github.com/breakdowns/slam-tg-mirror-bot',
html_content=content
)['path'])

Expand All @@ -665,7 +665,7 @@ def count(self, link):
try:
file_id = self.getIdFromUrl(link)
except (KeyError,IndexError):
msg = "Google drive ID could not be found in the provided link"
msg = "Google Drive ID could not be found in the provided link"
return msg
msg = ""
LOGGER.info(f"File ID: {file_id}")
Expand Down Expand Up @@ -728,7 +728,7 @@ def clonehelper(self, link):
try:
file_id = self.getIdFromUrl(link)
except (KeyError,IndexError):
msg = "Google drive ID could not be found in the provided link"
msg = "Google Drive ID could not be found in the provided link"
return msg, "", ""
LOGGER.info(f"File ID: {file_id}")
try:
Expand Down
2 changes: 1 addition & 1 deletion bot/modules/count.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Implement By - @anasty17 (https://github.com/breakdowns/slam-aria-mirror-bot/pull/111)
# Implement By - @anasty17 (https://github.com/breakdowns/slam-tg-mirror-bot/pull/111)
# (c) https://github.com/breakdowns/slam-aria-mirror-bot
# All rights reserved

Expand Down
Loading

0 comments on commit f62ce1c

Please sign in to comment.