Code Monkey home page Code Monkey logo

heroku-telegram-bot's Introduction

Starting November 28, 2022, free Heroku Dynos, Redis and PostgreSQL will no longer be available

https://blog.heroku.com/next-chapter

Since then this repository is archived. Get Github Developers student pack if you're looking for free hosting and other services. Try Docker, docker-compose and kubernetes to build, deploy, run & orchestrate your applications.

Hosting telegram bot on Heroku for free.

Easy way to host your python telegram bot on Heroku

Deploying via Heroku Toolbelt (CLI)

Install Heroku Toolbelt, then:

Clone repository

git clone https://github.com/Kylmakalle/heroku-telegram-bot.git

Edit files

  1. Edit bot.py file with your code

    1. ATTENTION! Do not collapse/delete/comment some_token = os.environ[SOME_TOKEN] style stings (you can delete redis setup line if you do not need it), do not change them with your REAL tokens, all tokens will be setted up below in this guide!

    2. More About Config Vars

    3. Also, don't do like this, it's insecure, realy.

  2. Edit requirments.txt with your code's dependencies

  3. Specify your python runtime, avaliable versions listed here

Go to command line

cd heroku-telegram-bot
heroku login
heroku create --region eu appname # create app in eu region, common regions: eu, us
heroku addons:create heroku-redis:hobby-dev -a appname # (Optionaly) installing redis
heroku buildpacks:set heroku/python # set python buildpack
git push heroku master # deploy app to heroku
heroku config:set TELEGRAM_TOKEN=123456789:AAABBBCCCDDDEEEFFFGGGHHHIIIJJJKKKLL # set config vars, insert your own
heroku config:set SOME_API_TOKEN=qwertyuiop1234567890
                ...
heroku ps:scale bot=1 # start bot dyno
heroku logs --tail # If for some reason it’s not working, check the logs
heroku ps:stop bot #stop bot dyno

Deploying via Heroku Dashboard (GUI)

  1. Fork this repo to your account.

  2. Edit files

  3. Go to Dashboard, login, Press New and choose Create new app.

  4. Fill in an App Name and choose Runtime Region.

  5. Connect your GitHub repo at Deploy page.

  6. Setup Automatics deploys (Optionaly).

  7. Deploy a GitHub branch.

  8. Then go to a Settings page, click Reveal Config Vars and then add your own, for example: Config Vars

  9. Finally, go to the Resources page.

    1. Install Heroku Redis add-on (Optionaly)
    2. Press on a small pen button, move slider and then click Confirm, that will start bot dyno.
    3. Simply move slider back if you need to stop bot dyno, remember to click Confirm.
    4. If for some reason it’s not working, check the logs here

    Logs

More about

Thanks to Roman Zaynetdinov for awesome and easy CLI guide.

heroku-telegram-bot's People

Contributors

kylmakalle avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

heroku-telegram-bot's Issues

question on deployment

thank you for the bot installation and all the setup.
it is really clear and great.

i had question though, maybe others also had it.

when i am deploying it (through Heroku Dashboard or without) when it tries to clone your repo there are some errors. did you also had them?

     Running command git clone -q https://github.com/Kylmakalle/pyTelegramBotAPI.git /tmp/pip-req-build-h02rpt0r

     Running command git checkout -b feature-BotAPIV3 --track origin/feature-BotAPIV3

     Switched to a new branch 'feature-BotAPIV3'

     Branch 'feature-BotAPIV3' set up to track remote branch 'feature-BotAPIV3' from 'origin'.

   Collecting https://site.org/files/package.zip (from -r /tmp/build_0790f21bca1810dd02b5d00b825b4595/requirements.txt (line 11))

     WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7fc1cb8b55f8>: Failed to establish a new connection: [Errno -5] No address associated with hostname',)': /files/package.zip

Thanks!

Did not found below steps in GUI

Press on a small pen button, move slider and then click Confirm, that will start bot dyno.
Simply move slider back if you need to stop bot dyno, remember to click Confirm.
If for some reason it’s not working, check the logs here

How to start dyno from GUI ?

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.