Git Product home page Git Product logo

bot.py's Introduction

Intial Deploy to heroku

Intially I was not able to push a simple bot to heroku, but yeah googling a lot made it work!

Very Initial Steps [NOOB Steps]

  1. Install Telegram :)
  2. Create a telegram bot by talking to Bot Father
  3. Install python in your computer, if you are on windows follow this
  4. Install git, follow this
  5. Install Heroku account here
  6. Install Heroku CLI from here
  7. Install editor of your choice, I preffer Atom

Step 0 [Optional]:

  • Just git clone this repository and start working by editing the code
    git clone https://github.com/AnshumanFauzdar/telegram-bot-heroku-deploy.git
    cd telegram-bot-heroku-deploy
  • Or follow steps below!

Step 1:

  • Create your bot like we have bot.py and write any python code that is intially working on your local machine!

Step 2:

  • Make a folder like telegram-bot and put bot.py in the folder

Step 3:

  • Make a blank python file named
    __init__.py

Step 4:

  • Make a Procfile this should be without any extension like .txt, you can go to view -> tick file name extensions and remove any extension
    worker: python bot.py
  • Write this in Procfile by using notepad or any editor of your choice! Here bot.py is your python code!

Step 5:

  • Now we have to make a requirements.txt through which heroku will install the dependencies to make our bot work!
  • What to add in requirements.txt
    • Mine looks like this:
    future>=0.16.0
    certifi
    tornado>=5.1
    cryptography
    python-telegram-bot
    

Add anything which you have included in the python code!

Step 6:

  • Change directory to where you have made these files
  • now in git bash CLI, intialize a git
    git init
    

Step 7:

  • Now install heroku CLI
  • Next
    heroku login
    heroku create app_name
  • If you have already created app then select it:
    heroku git:remote -a app_name
  • Or else continue:
    git add -f bot.py Procfile requirements.txt __init__.py
  • git commit -m "Added Files"
  • Push files to heroku:
    git push heroku master
  • If it is not working then try this one:
    git push heroku master --force

At this point your bot should be running, you can check by

  •  heroku ps

If it is not running then we have to reset dynos:

  • heroku ps:scale worker=0
  • heroku ps:scale worker=1

Now it should be running fine! Enjoy :)

If you are trying to lazy which you should not! (Deploying to Heroku)

Deploy

Choose App name and deploy! Follow from Step 7 and edit bot.py with your token! And finally deploy!

Working Example

working

Want a video tutorial?

bot.py's People

Contributors

imran95942 avatar

Watchers

 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.