Giter VIP home page Giter VIP logo

deploy-mirror-leech-bot's Introduction

Repo dosen't support heroku now. This method no longer works

Deploy Mirror Leech Bot

Requirements

  • Telegram Account.
  • Heroku Account.
  • Github Account.
  • Install Python on Windows.
  • Google Drive Account.

Repo Link: Here

In this guide, we will deploy our mirror bot on heroku using github action. keep this thing in mind that deploying mirror bot on heroku may result in suspension of the heroku account.
If you starting fresh, then this guide will easily take your 1-2 hours.

Ok then lets start.

Step 1: Fork And Download The Repo

Click Here
  • First thing first, goto bot repo Click Here and fork the bot repo.

image

  • Now download that repo.

image

  • The downloaded repo will be in zip file, so extract it.

Step 2: Create credentials.json

Click Here
  • Goto your google cloud console. Click Here
  • Create a new project (if you already have a project then no need to create another one)

image image

  • Now select the project you just create.

image image

  • Now search for drive api and enable it.

image image image

  • After enabling drive api, goto your oauth consent screen cloud console home screen > hamburger menu on the left > api and services > oauth consen screen

image image image image image image image image image

  • Once the oauth consent screen app is published, now we can create the credentials.json

image image image image image

  • And done now download your .json file.

image

  • After download rename it to credentials.json, make sure you have enabled "file name extensions" because most users basically rename credentials.json to credentials.json.json without knowing.

image

  • Make sure that its credentials.json and not credentials.json.json.

  • Now move that credentials.json file to the extracted repo folder.

image

  • We have sucessfully created our credentials.json file.

Step 3: Create token.pickle

Click Here
  • For generating token.pickle you will need python.
  • So install python from this link Click Here. (while installing, make sure that add to the path option is selected.)
  • Once installed, open cmd and run
python --version

to make that you have installed python correctly.

image

  • Ok, now goto your extracted repo folder click on the address bar and type cmd then hit enter.

image image image

  • There you go.
  • Now give command
pip install google-api-python-client google-auth-httplib2 google-auth-oauthlib
  • Now for the next command make sure to set a default browser, in my case chrome is the default.
  • Then run
python generate_drive_token.py
  • One browser window will open, just follow the on screen prompt.

image image image image

  • Now after you reach this screen.

image

  • token.pickle will be available in the extracted repo folder.

image

Step 4: Hosting token.pickle

Click Here
  • Now we need to host our token.pickle
  • For that we will use google drive index.
  • This is the repo we will be using for our google drive index.
  • Go to this link.
  • Sign in to get the Authentication Code.

image image image image

  • Paste that code in Authentication Code var.

image

  • For Site Name var, you can give any name for eg personal.
  • For Share Drive ID or root var, goto your drive and create a new folder for your index (don't create this folder in the shared drive).

image

  • Go inside that folder and copy the id of that folder.

image

  • Use it for Share Drive ID or root var.

image

  • Then click on submit and copy the genrated code for your index.

image

  • Now goto cloudflare and sign up for an account.
  • Then goto workers

image image image

  • Then complete the verification process and come back to the workers section again.

image image image

  • Remove all the default content from here.

image

  • And paste the code u genrated for your index then click on save and deploy.

image image

  • Now wait for 10 seconds your index will be online.
  • Then go here and save the link for your index, it will come handy later.

image

  • Now goto that drive folder u create for the index and upload your token.pickle

image

  • Then open your index link click on drive one you will see your token.pickle file u just uploaded.

image image

  • We successfully hosted our token.pickle in our index. (Just dont share this index link, as it has confidential file.)

Step 5: Create config.env

Click Here
  • Go here and copy all the content.
  • Then goto Github Gist
  • Give your gist a name config.env

image

  • And paste the previously copied content here

image

  • Now remove line no 2. _____REMOVE_THIS_LINE_____=True

image

  • Then start filling the config vars.
  • For now i will only show the necessary config values for the proper working of the mirror leech bot.

BOT_TOKEN:

  • Search @BotFather on telegram, start the bot and send /newbot then follow the on screen instruction to create a new bot.

image

  • This will be the value of BOT_TOKEN

GDRIVE_FOLDER_ID:

  • Search @MSGuite_SD_Creator_Bot on telegram, start the bot click on genrate td now send your email address, give your drive a good name for eg hitesh920's drive and done.
  • Now go inside the shared drive you just created by google drive > shared drive > the shared drive you created.

image

image

  • This will be the value of GDRIVE_FOLDER_ID

OWNER_ID:

  • Search @MissRose_bot on telegram, start the bot then type /id bot will send your account's id
  • Use that for OWNER_ID

DOWNLOAD_DIR:

  • Keep the default values, no need to change anything here.

DOWNLOAD_STATUS_UPDATE_INTERVAL:

  • Keep the default values, no need to change anything here.

AUTO_DELETE_MESSAGE_DURATION:

  • Keep the default values, no need to change anything here.

IS_TEAM_DRIVE:

  • Set this to True as we are using shared drive.

TELEGRAM_API & TELEGRAM_HASH:

  • Go here and register with your number connected to telegram account fill with your number , choose desktop, fill app title and short name to any name you want.

image

image

  • This will give the values of TELEGRAM_API and TELEGRAM_HASH

App api_id will be your TELEGRAM_API

App api_hash will be your TELEGRAM_HASH

TOKEN_PICKLE_URL:

  • Go to your index link and click on the token.pickle u just hosted in step 4 and copy the direct download link.

image

  • And use that url for TOKEN_PICKLE_URL

BASE_URL_OF_BOT:

UPSTREAM_REPO:

  • Your forked repository link, if your repo is private add https://username:{githubtoken}@github.com/{username}/{reponame} format. Get token from Github settings. So your bot can update from filled repository on each restart.

UPSTREAM_BRANCH:

  • Upstream branch for update. Empty means master.

We are done with the all necessary configs for the proper working of your mirror leech bot.

It should look like this after filling all the necessary values

image

  • Then click on create secret gist to save the gist.

image

  • We have successfully created our config.env

Step 6: Set Up Secrets For Github Action

Click Here
  • Goto your forked repo > settings > secrets > action

image image

Now here under secrets, you need to create four secrets

  • HEROKU_EMAIL
  • HEROKU_API_KEY
  • HEROKU_APP_NAME
  • CONFIG_FILE_URL

image image

Do the same for other three secrets.

HEROKU_API_KEY

  • Goto your heroku account settings Here
  • Scroll down and copy the api key

image

HEROKU_APP_NAME:

  • Name you would like to give to your heroku app (must be unique)

CONFIG_FILE_URL:

  • Goto that gist you created for the config.env

  • Then click on raw

image

  • And copy the url then remove the commit id
  • For eg https://gist.githubusercontent.com/ghostmirrorlab/f9b1e6xxxxxxxxxxxxxaaac04520/raw/200d4a93e0eb5ee8d4b0e5a377ce0396a131843e/config.env then the commit id will the one after raw/ and before /config.env

original config.env url:
https://gist.githubusercontent.com/ghostmirrorlab/f9b1e6xxxxxxxxxxxxxaaac04520/raw/200d4a93e0eb5ee8d4b0e5a377ce0396a131843e/config.env

url after removing commit id:
https://gist.githubusercontent.com/ghostmirrorlab/f9b1e6xxxxxxxxxxxxxaaac04520/raw/config.env

  • After removing the commit id use that url for the CONFIG_FILE_URL
  • Once all the four secrets have been added, it should look like this

image

  • And we are done with the action secrets.

Step 7: Deploy Bot

Click Here

We will use github action to deploy bot.

  • Goto your forked repo > action

image image image image image

  • Now your workflow will start, deploy will take arround 3-4 minutes.
  • You can check the workflow logs at

image image image

  • Once deployment done

image

  • Goto your heroku account, click on the app you just created then click on more and then click on view logs.

image image

  • Wait for few seconds your bot will start if your config.env is correct.

image

  • Now search the username of the bot u created with @BotFather and start the bot

image

  • And done, congratulations.

Extra:

  • To use service account follow the sa branch or just Click Here
  • If you want to update your bot then just do /restart or you can also turn dynos off and on from your heroku app.
  • If you want to update config.env then goto your config.env gist > edit > save > then /restart the bot.
  • If you want to redeploy the bot then just goto heroku website then delete the app you deployed and follow the step 7 and start the workflow again.
  • To know more about all the optional configs then read the README.md file of the bot repo.
  • To set bot commands, then you can use @BotFather using /setcommands. All the commands are listed in the README.md file of the bot repo.
  • Want to ask something els? Join Mirror Socity.

Credits

deploy-mirror-leech-bot's People

Contributors

ghostmirrorlab avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.