Add guide to deploying on Heroku with Github Workflow

Signed-off-by: breakdowns <hafitz666@outlook.co.id>
This commit is contained in:
Hafitz Setya 2021-08-13 15:07:59 +07:00 committed by GitHub
parent c9354a8114
commit 6190a443f3
Signed by untrusted user: GitHub
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 150 additions and 261 deletions

30
.github/workflows/deploy.yml vendored Normal file
View File

@ -0,0 +1,30 @@
name: Manually Deploy to Heroku
on: workflow_dispatch
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: akhileshns/heroku-deploy@v3.12.12
with:
heroku_api_key: ${{secrets.HEROKU_API_KEY}}
heroku_app_name: ${{secrets.HEROKU_APP_NAME}}
heroku_email: ${{secrets.HEROKU_EMAIL}}
usedocker: true
docker_heroku_process_type: web
stack: "container"
region: "us"
env:
HD_AUTO_DELETE_MESSAGE_DURATION: ${{secrets.AUTO_DELETE_MESSAGE_DURATION}}
HD_BASE_URL_OF_BOT: ${{secrets.BASE_URL_OF_BOT}}
HD_BOT_TOKEN: ${{secrets.BOT_TOKEN}}
HD_DOWNLOAD_DIR: ${{secrets.DOWNLOAD_DIR}}
HD_DOWNLOAD_STATUS_UPDATE_INTERVAL: ${{secrets.DOWNLOAD_STATUS_UPDATE_INTERVAL}}
HD_IS_TEAM_DRIVE: ${{secrets.IS_TEAM_DRIVE}}
HD_OWNER_ID: ${{secrets.OWNER_ID}}
HD_TELEGRAM_API: ${{secrets.TELEGRAM_API}}
HD_TELEGRAM_HASH: ${{secrets.TELEGRAM_HASH}}
HD_UPSTREAM_REPO: ${{secrets.UPSTREAM_REPO}}
HD_UPSTREAM_BRANCH: ${{secrets.UPSTREAM_BRANCH}}

View File

@ -1,14 +1,14 @@
[![Slam](https://telegra.ph/file/db03910496f06094f1f7a.jpg)](https://youtu.be/Pk_TthHfLeE)
# 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 contributors](https://img.shields.io/github/contributors/breakdowns/slam-tg-mirror-bot?style=flat)
![GitHub watchers](https://img.shields.io/github/watchers/breakdowns/slam-tg-mirror-bot)
# Slam Mirror Bot
![GitHub Repo stars](https://img.shields.io/github/stars/breakdowns/slam-mirrorbot?color=blue&style=flat)
![GitHub forks](https://img.shields.io/github/forks/breakdowns/slam-mirrorbot?color=green&style=flat)
![GitHub contributors](https://img.shields.io/github/contributors/breakdowns/slam-mirrorbot?style=flat)
![GitHub watchers](https://img.shields.io/github/watchers/breakdowns/slam-mirrorbot)
![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.
**Slam Mirror Bot** is a _multipurpose_ Telegram Bot writen in Python for mirroring files on the Internet to our beloved Google Drive.
# Features supported:
<details>
@ -16,7 +16,7 @@
## 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-tg-mirror-bot/tree/master#setting-up-config-file))
- 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-mirrorbot/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
@ -75,7 +75,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-tg-mirror-bot mirrorbot/
git clone https://github.com/breakdowns/slam-mirrorbot mirrorbot/
cd mirrorbot
```
@ -134,16 +134,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-tg-mirror-bot`.
- **UPSTREAM_REPO**: Link for Bot Upstream Repo, if you want default update, fill `https://github.com/breakdowns/slam-mirrorbot`.
- **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-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).
- **DATABASE_URL**: Your Database URL. See [Generate Database](https://github.com/breakdowns/slam-mirrorbot/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-tg-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-mirrorbot#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)
@ -157,6 +157,7 @@ Fill up rest of the fields. Meaning of each fields are discussed below:
- **TAR_UNZIP_LIMIT**: To limit mirroring as Tar or unzipmirror. Available units is (gb or GB, tb or TB), Examples: `100 gb, 100 GB, 10 tb, 10 TB`
- **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://gitlab.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_EMAIL**: Heroku Account email Id in which the above app will be deployed (**NOTE**: Only needed if you deploying on Heroku with Github Workflow).
- **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**: If you want the bot to ignore pending requests after it restarts, set this to `True`.
@ -212,13 +213,8 @@ docker build . --rm --force-rm --compress --no-cache=true --pull --file Dockerfi
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-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>
## Deploying on Heroku with Github Workflow
<p><a href="https://github.com/breakdowns/slam-mirrorbot/blob/master/heroku-guide.md"> <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>
@ -288,7 +284,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-tg-mirror-bot/blob/master/.netrc) file
# Youtube-dl authentication using [.netrc](https://github.com/breakdowns/slam-mirrorbot/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
@ -311,4 +307,4 @@ Thanks to:
- [breakdowns](https://github.com/breakdowns) for slam-tg-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-tg-mirror-bot/graphs/contributors).
And many more people who aren't mentioned here, but may be found in [Contributors](https://github.com/breakdowns/slam-mirrorbot/graphs/contributors).

View File

@ -1,5 +1,5 @@
# Implement By - @anasty17 (https://github.com/breakdowns/slam-tg-mirror-bot/commit/0bfba523f095ab1dccad431d72561e0e002e7a59)
# (c) https://github.com/breakdowns/slam-aria-mirror-bot
# Implement By - @anasty17 (https://github.com/breakdowns/slam-mirrorbot/commit/0bfba523f095ab1dccad431d72561e0e002e7a59)
# (c) https://github.com/breakdowns/slam-mirrorbot
# All rights reserved
import time

205
app.json
View File

@ -1,205 +0,0 @@
{
"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-tg-mirror-bot",
"website": "https://github.com/breakdowns/slam-tg-mirror-bot",
"success_url": "https://t.me/SlamMirrorSupport",
"stack": "container",
"env": {
"ENV": {
"description": "Setting this to ANYTHING will enable Webhooks when in env mode",
"value": "ANYTHING"
},
"BOT_TOKEN": {
"description": "The Telegram bot token that you get from @BotFather.",
"required": true
},
"GDRIVE_FOLDER_ID": {
"description": "This is the folder ID of the Google Drive Folder to which you want to upload all the mirrors.",
"required": true
},
"DOWNLOAD_DIR": {
"description": "The path to the local folder where the downloads should be downloaded to.",
"value": "/usr/src/app/downloads",
"required": false
},
"DOWNLOAD_STATUS_UPDATE_INTERVAL": {
"description": "A short interval of time in seconds after which the Mirror progress message is updated. (I recommend to keep it 5 seconds at least).",
"value": "5",
"required":false
},
"OWNER_ID": {
"description": "The Telegram User ID of the Owner of the Bot. Get it by using /info in @MissRose_bot.",
"required": true
},
"AUTO_DELETE_MESSAGE_DURATION": {
"description": "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.",
"required": true
},
"IS_TEAM_DRIVE": {
"description": "Set to 'True' if GDRIVE_FOLDER_ID is from a Team Drive else False or Leave it empty.",
"required": false
},
"USE_SERVICE_ACCOUNTS": {
"description": "Whether to use Service Accounts or not. For this to work see 'Using Service Accounts' in repo.",
"required": false
},
"AUTHORIZED_CHATS": {
"description": "Fill User ID and Chat ID of you want to authorize, Seprate them with space.",
"required": false
},
"SUDO_USERS": {
"description": "Fill user_id (not username) of you want to sudoers, Seprate them with space.",
"required": false
},
"INDEX_URL": {
"description": "Refer to https://gitlab.com/ParveenBhadooOfficial/Google-Drive-Index The URL should not have any trailing '/'.",
"required": false
},
"TELEGRAM_API": {
"description": "This is to authenticate to your Telegram account for downloading Telegram files. You can get this from https://my.telegram.org.",
"required": true
},
"TELEGRAM_HASH": {
"description": "This is to authenticate to your Telegram account for downloading Telegram files. You can get this from https://my.telegram.org.",
"required": true
},
"HEROKU_API_KEY": {
"description": "Your Heroku API key, get it from https://dashboard.heroku.com/account.",
"required": true
},
"HEROKU_APP_NAME": {
"description": "Add the Heroku app name here.",
"required": true
},
"UPSTREAM_REPO": {
"description": "Link for Bot Upstream Repo, If you want default update, Fill https://github.com/breakdowns/slam-tg-mirror-bot.",
"value": "https://github.com/breakdowns/slam-tg-mirror-bot",
"required": true
},
"UPSTREAM_BRANCH": {
"description": "Branch name for Bot Upstream Repo, fill master.",
"value": "master",
"required": true
},
"UPTOBOX_TOKEN": {
"description": "Uptobox premium token to mirror uptobox links. Get it from https://uptobox.com/my_account.",
"required": false
},
"MEGA_API_KEY": {
"description": "Mega.nz api key to mirror mega.nz links. Get it from https://mega.nz/sdk.",
"required": false
},
"MEGA_EMAIL_ID": {
"description": "Your email id you used to sign up on mega.nz.",
"required": false
},
"MEGA_PASSWORD": {
"description": "Your password for your mega.nz account.",
"required": false
},
"BLOCK_MEGA_FOLDER": {
"description": "If you want to remove mega.nz folder support, set it to True.",
"required": false
},
"BLOCK_MEGA_LINKS": {
"description": "If you want to remove mega.nz mirror support, set it to True.",
"required": false
},
"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).",
"required": false
},
"TAR_UNZIP_LIMIT": {
"description": "To limit mirroring as Tar or unzipmirror. Available units is (gb or GB, tb or TB).",
"required": false
},
"CLONE_LIMIT": {
"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 downloading Mega (leave space between number and unit, Available units is (gb or GB, tb or TB).",
"required": false
},
"STOP_DUPLICATE": {
"description": "If this field is set to True, bot will check file in Drive, if it is present in Drive, downloading 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
},
"SHORTENER_API": {
"description": "Fill your shortener api key if you are using shortener.",
"required": false
},
"TOKEN_PICKLE_URL": {
"description": "(Optional) Only if you want to load your token.pickle externally from an index link. Fill this with the direct link of that file.",
"required": false
},
"ACCOUNTS_ZIP_URL": {
"description": "(Optional) Only if you want to load your service accs externally from an index link. Archive your service accs 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.",
"required": false
},
"VIEW_LINK": {
"description": "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 Code).",
"value": "False",
"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
},
"BUTTON_SIX_NAME": {
"description": "Extra buttons (optional).",
"required": false
},
"BUTTON_SIX_URL": {
"description": "Fill your URL if you are using extra buttons.",
"required": false
},
"STATUS_LIMIT": {
"description": "Status limit with buttons, Recommend limit status to 4 tasks max.",
"required": false
},
"BASE_URL_OF_BOT": {
"description": "Enter your Heroku app link to avoid the app from sleeping and to make it work with Torrent selection",
"value": "https://yourappname.herokuapp.com",
"required": true
}
},
"addons": [
{
"plan": "heroku-postgresql"
}
],
"formation": {
"web": {
"quantity": 1,
"size": "free"
}
}
}

View File

@ -49,7 +49,7 @@ This bot can mirror all your links to Google Drive!
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("Repo", "https://github.com/breakdowns/slam-mirrorbot")
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))
@ -60,7 +60,7 @@ Type /{BotCommands.HelpCommand} to get a list of available commands
else :
sendMarkup(start_string, context.bot, update, reply_markup)
else :
sendMarkup(f"Oops! not a Authorized user.\nPlease deploy your own <b>slam-tg-mirror-bot</b>.", context.bot, update, reply_markup)
sendMarkup(f"Oops! not a Authorized user.\nPlease deploy your own <b>slam-mirrorbot</b>.", context.bot, update, reply_markup)
def restart(update, context):

View File

@ -209,7 +209,7 @@ def github(url: str) -> str:
def hxfile(url: str) -> str:
""" Hxfile direct link generator
Based on https://github.com/zevtyardt/lk21
https://github.com/breakdowns/slam-aria-mirror-bot """
https://github.com/breakdowns/slam-mirrorbot """
bypasser = lk21.Bypass()
dl_url=bypasser.bypass_filesIm(url)
return dl_url
@ -218,7 +218,7 @@ def hxfile(url: str) -> str:
def anonfiles(url: str) -> str:
""" Anonfiles direct link generator
Based on https://github.com/zevtyardt/lk21
https://github.com/breakdowns/slam-aria-mirror-bot """
https://github.com/breakdowns/slam-mirrorbot """
bypasser = lk21.Bypass()
dl_url=bypasser.bypass_anonfiles(url)
return dl_url
@ -227,7 +227,7 @@ def anonfiles(url: str) -> str:
def letsupload(url: str) -> str:
""" Letsupload direct link generator
Based on https://github.com/zevtyardt/lk21
https://github.com/breakdowns/slam-aria-mirror-bot """
https://github.com/breakdowns/slam-mirrorbot """
dl_url = ''
try:
link = re.findall(r'\bhttps?://.*letsupload\.io\S+', url)[0]
@ -241,7 +241,7 @@ def letsupload(url: str) -> str:
def fembed(link: str) -> str:
""" Fembed direct link generator
Based on https://github.com/zevtyardt/lk21
https://github.com/breakdowns/slam-aria-mirror-bot """
https://github.com/breakdowns/slam-mirrorbot """
bypasser = lk21.Bypass()
dl_url=bypasser.bypass_fembed(link)
lst_link = []
@ -254,7 +254,7 @@ def fembed(link: str) -> str:
def sbembed(link: str) -> str:
""" Sbembed direct link generator
Based on https://github.com/zevtyardt/lk21
https://github.com/breakdowns/slam-aria-mirror-bot """
https://github.com/breakdowns/slam-mirrorbot """
bypasser = lk21.Bypass()
dl_url=bypasser.bypass_sbembed(link)
lst_link = []
@ -295,7 +295,7 @@ def pixeldrain(url: str) -> str:
def antfiles(url: str) -> str:
""" Antfiles direct link generator
Based on https://github.com/zevtyardt/lk21
https://github.com/breakdowns/slam-aria-mirror-bot """
https://github.com/breakdowns/slam-mirrorbot """
bypasser = lk21.Bypass()
dl_url=bypasser.bypass_antfiles(url)
return dl_url
@ -304,7 +304,7 @@ def antfiles(url: str) -> str:
def streamtape(url: str) -> str:
""" Streamtape direct link generator
Based on https://github.com/zevtyardt/lk21
https://github.com/breakdowns/slam-aria-mirror-bot """
https://github.com/breakdowns/slam-mirrorbot """
bypasser = lk21.Bypass()
dl_url=bypasser.bypass_streamtape(url)
return dl_url
@ -312,7 +312,7 @@ def streamtape(url: str) -> str:
def racaty(url: str) -> str:
""" Racaty direct links generator
based on https://github.com/breakdowns/slam-aria-mirror-bot """
based on https://github.com/breakdowns/slam-mirrorbot """
dl_url = ''
try:
link = re.findall(r'\bhttps?://.*racaty\.net\S+', url)[0]
@ -332,7 +332,7 @@ def racaty(url: str) -> str:
def fichier(link: str) -> str:
""" 1Fichier direct links generator
Based on https://github.com/Maujar
https://github.com/breakdowns/slam-aria-mirror-bot """
https://github.com/breakdowns/slam-mirrorbot """
regex = r"^([http:\/\/|https:\/\/]+)?.*1fichier\.com\/\?.+"
gan = re.match(regex, link)
if not gan:

View File

@ -1,5 +1,5 @@
# Implement By - @anasty17 (https://github.com/breakdowns/slam-tg-mirror-bot/commit/0bfba523f095ab1dccad431d72561e0e002e7a59)
# (c) https://github.com/breakdowns/slam-aria-mirror-bot
# Implement By - @anasty17 (https://github.com/breakdowns/slam-mirrorbot/commit/0bfba523f095ab1dccad431d72561e0e002e7a59)
# (c) https://github.com/breakdowns/slam-mirrorbot
# All rights reserved
import os

View File

@ -1,5 +1,5 @@
# Implement By - @anasty17 (https://github.com/breakdowns/slam-tg-mirror-bot/commit/80d33430715b4296cd253f62cefc089a81937ebf)
# (c) https://github.com/breakdowns/slam-tg-mirror-bot
# Implement By - @anasty17 (https://github.com/breakdowns/slam-mirrorbot/commit/80d33430715b4296cd253f62cefc089a81937ebf)
# (c) https://github.com/breakdowns/slam-mirrorbot
# All rights reserved
from .status import Status

View File

@ -1,5 +1,5 @@
# Implement By - @anasty17 (https://github.com/breakdowns/slam-tg-mirror-bot/pull/220)
# (c) https://github.com/breakdowns/slam-tg-mirror-bot
# Implement By - @anasty17 (https://github.com/breakdowns/slam-mirrorbot/pull/220)
# (c) https://github.com/breakdowns/slam-mirrorbot
# All rights reserved
from .status import Status

View File

@ -1,5 +1,5 @@
# Implement By - @anasty17 (https://github.com/breakdowns/slam-tg-mirror-bot/commit/0bfba523f095ab1dccad431d72561e0e002e7a59)
# (c) https://github.com/breakdowns/slam-aria-mirror-bot
# Implement By - @anasty17 (https://github.com/breakdowns/slam-mirrorbot/commit/0bfba523f095ab1dccad431d72561e0e002e7a59)
# (c) https://github.com/breakdowns/slam-mirrorbot
# All rights reserved
from bot import DOWNLOAD_DIR, LOGGER, get_client

View File

@ -117,7 +117,7 @@ class GoogleDriveHelper:
resumable=False)
file_metadata = {
'name': file_name,
'description': 'Uploaded using Slam Tg Mirror Bot',
'description': 'Uploaded using Slam Mirrorbot',
'mimeType': mime_type,
}
if parent_id is not None:
@ -171,7 +171,7 @@ class GoogleDriveHelper:
# File body description
file_metadata = {
'name': file_name,
'description': 'Uploaded by Slam Tg Mirror Bot',
'description': 'Uploaded by Slam Mirrorbot',
'mimeType': mime_type,
}
try:
@ -558,9 +558,9 @@ class GoogleDriveHelper:
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 Tg Mirror Bot Search',
author_name='Slam Tg Mirror Bot',
author_url='https://github.com/breakdowns/slam-tg-mirror-bot',
title = 'Slam Mirrorbot Search',
author_name='Slam Mirrorbot',
author_url='https://github.com/breakdowns/slam-mirrorbot',
html_content=content)
return
@ -643,9 +643,9 @@ class GoogleDriveHelper:
for content in self.telegraph_content :
self.path.append(Telegraph(access_token=telegraph_token).create_page(
title = 'Slam Tg Mirror Bot Search',
author_name='Slam Tg Mirror Bot',
author_url='https://github.com/breakdowns/slam-tg-mirror-bot',
title = 'Slam Mirrorbot Search',
author_name='Slam Mirrorbot',
author_url='https://github.com/breakdowns/slam-mirrorbot',
html_content=content
)['path'])

View File

@ -1,5 +1,5 @@
# Implement By - @anasty17 (https://github.com/breakdowns/slam-tg-mirror-bot/pull/111)
# (c) https://github.com/breakdowns/slam-tg-mirror-bot
# Implement By - @anasty17 (https://github.com/breakdowns/slam-mirrorbot/pull/111)
# (c) https://github.com/breakdowns/slam-mirrorbot
# All rights reserved
from telegram.ext import CommandHandler

View File

@ -11,7 +11,7 @@ AUTO_DELETE_MESSAGE_DURATION = 20
IS_TEAM_DRIVE = ""
TELEGRAM_API =
TELEGRAM_HASH = ""
UPSTREAM_REPO = "https://github.com/breakdowns/slam-tg-mirror-bot"
UPSTREAM_REPO = "https://github.com/breakdowns/slam-mirrorbot"
UPSTREAM_BRANCH = "master"
# OPTIONAL CONFIG
DATABASE_URL = ""

68
heroku-guide.md Normal file
View File

@ -0,0 +1,68 @@
## Deploying slam-mirrorbot on Heroku with Github Workflows.
## Pre-requisites
- [Heroku](heroku.com) accounts
- Recommended to use 1 App in 1 Heroku accounts
- Don't use bin/fake credits card, because your Heroku account will banned
## Deployment
1. 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-mirrorbot#getting-google-oauth-api-credential-file)
2. Go to Repository `Settings` -> `Secrets`
![secrets](https://telegra.ph/file/bb8cb0eced5caad68a41b.jpg)
3. Add the below Required Variables one by one by clicking `New Repository Secret` everytime.
```
HEROKU_EMAIL
HEROKU_API_KEY
HEROKU_APP_NAME
BOT_TOKEN
TELEGRAM_API
TELEGRAM_HASH
OWNER_ID
GDRIVE_FOLDER_ID
DOWNLOAD_DIR
DOWNLOAD_STATUS_UPDATE_INTERVAL
AUTO_DELETE_MESSAGE_DURATION
UPSTREAM_REPO
UPSTREAM_BRANCH
```
### Description of the above Required Variables
* `HEROKU_EMAIL` Heroku Account email Id in which the above app will be deployed
* `HEROKU_API_KEY` Go to your Heroku account and go to Account Settings. Scroll to the bottom until you see API Key. Copy this key and add it
* `HEROKU_APP_NAME` Your Heroku app name, Name Must be unique
* `BOT_TOKEN` The Telegram bot token that you get from https://t.me/BotFather.
* `TELEGRAM_API` This is to authenticate to your Telegram account for downloading Telegram files. You can get this from https://my.telegram.org DO NOT put this in quotes
* `TELEGRAM_HASH` This is to authenticate to your Telegram account for downloading Telegram files. You can get this from https://my.telegram.org
* `OWNER_ID` The Telegram user ID (not username) of the Owner of the bot
* `GDRIVE_FOLDER_ID` This is the folder ID of the Google Drive Folder to which you want to upload all the mirrors
* `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-mirrorbot`
* `UPSTREAM_BRANCH` Branch name for Bot Upstream Repo, fill `master`
### For Optional Variables you can get from [Here](https://github.com/breakdowns/slam-mirrorbot#setting-up-config-file)
4. After adding all the above Required Variables go to Github Actions tab in your repo
5. Select `Manually Deploy to heroku` workflow as shown below:
![Example Manually Deploy to Heroku](https://telegra.ph/file/38ffda0165d9671f1d5dc.jpg)
6. Then click on Run workflow
![Run workflow](https://telegra.ph/file/c5b4c2e02f585cb59fe5c.jpg)
7. _Done!_ your bot will be deployed now.
## NOTE
- Don't change/edit variables from Heroku if you want to change/edit do it from Github Secrets
- If you want to set optional variables, go to your Heroku app settings and add the variables
## Credits
- [arghyac35](https://github.com/arghyac35) for Tutorial

View File

@ -36,7 +36,7 @@ p { font-size: 12px; margin: 24px;}
</style>
</head>
<body>
<h1>slam-tg-mirror-bot: <a href="https://github.com/breakdowns/slam-tg-mirror-bot">@Github</a></h1>
<h1>slam-mirrorbot: <a href="https://github.com/breakdowns/slam-mirrorbot">@Github</a></h1>
<form action="{form_url}" method="POST">
{My_content}
@ -277,7 +277,7 @@ async def set_priority(request):
@routes.get('/')
async def homepage(request):
return web.Response(text="<h1>See slam-tg-mirror-bot <a href='https://github.com/breakdowns/slam-tg-mirror-bot'>@GitHub</a> By <a href='https://github.com/breakdowns'>Breakdowns</a></h1>",content_type="text/html")
return web.Response(text="<h1>See slam-mirrorbot <a href='https://github.com/breakdowns/slam-mirrorbot'>@GitHub</a> By <a href='https://github.com/breakdowns'>Breakdowns</a></h1>",content_type="text/html")
async def e404_middleware(app, handler):
@ -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-tg-mirror-bot</h3>",content_type="text/html")
return web.Response(text="<h1>404: Page not found</h2><br><h3>slam-mirrorbot</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-tg-mirror-bot</h3>",content_type="text/html")
return web.Response(text="<h1>404: Page not found</h2><br><h3>slam-mirrorbot</h3>",content_type="text/html")
raise
return middleware_handler