diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index d99418d..67ffaf9 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -17,17 +17,4 @@ jobs: 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_GDRIVE_FOLDER_ID: ${{secrets.GDRIVE_FOLDER_ID}} - HD_HEROKU_API_KEY: ${{secrets.HEROKU_API_KEY}} - HD_HEROKU_APP_NAME: ${{secrets.HEROKU_APP_NAME}} - 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}} + HD_CONFIG_FILE_URL: ${{secrets.CONFIG_FILE_URL}} diff --git a/bot/__init__.py b/bot/__init__.py index d2a0901..6aeb012 100644 --- a/bot/__init__.py +++ b/bot/__init__.py @@ -33,6 +33,12 @@ logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)s LOGGER = logging.getLogger(__name__) +CONFIG_FILE_URL = os.environ.get('CONFIG_FILE_URL', None) +if CONFIG_FILE_URL is not None: + out = subprocess.run(["wget", "-q", "-O", "config.env", CONFIG_FILE_URL]) + if out.returncode != 0: + logging.error(out) + load_dotenv('config.env') Interval = [] diff --git a/heroku-guide.md b/heroku-guide.md index 0872726..17121ca 100644 --- a/heroku-guide.md +++ b/heroku-guide.md @@ -20,35 +20,15 @@ HEROKU_EMAIL HEROKU_API_KEY HEROKU_APP_NAME - BASE_URL_OF_BOT - 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 + CONFIG_FILE_URL ``` +- To get CONFIG_FILE_URL, check the steps here: - ### 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 - * `BASE_URL_OF_BOT` Enter your Heroku app link to avoid the app from sleeping and to make it work with Torrent selection, Example: `https://yourappname.herokuapp.com` (**NOTE**: No slash at the end) - * `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, Fill `/usr/src/app/downloads` - * `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/Slam-Team/slam-mirrorbot` - * `UPSTREAM_BRANCH` Branch name for Bot Upstream Repo, fill `master` - ### For Optional Variables you can get from [Here](https://github.com/Slam-Team/slam-mirrorbot#setting-up-config-file) + ![steps 1 to 3](https://telegra.ph/file/1d8fec16516a87ba9d1ac.jpg) + + ![step 4](https://telegra.ph/file/1491f99836cd694ea1195.jpg) + + ![step 5](https://telegra.ph/file/416a550f7ded579b63272.jpg) 4. After adding all the above Required Variables go to Github Actions tab in your repo