Zero Setup SQL Migration in production
because we all hate migrations
Heroku is a container-based cloud platform for deploying, managing and scaling
modern apps.
A telegram user bot is not actually a bot (it can be), it uses
commands to communicate with the user, for example you can do .weather city
and it will send you the weather report for that location, it can convert
currencies, translate text and do a lot more.
The setup process isn’t that
complicated but its not widely shared, you have to give it a go on your own,
anyway i am about to change that here.
There are many forks of the userbot,
but i personally use this one
because it doesn’t use a database, which i don’t need, however without a
database some functions won’t work.
git clone http://GitHub.com/Nick80835/Telegram-UserBot
pip3 install -r requirements.txt
mv sample_config.env config.env
python3 -m userbot
The bot uses the userbot.session file so you wont have to login again, add that
file to the repo first (do not push this file to github!).
heroku login
git branch -m master
git push heroku master
(force push if you
got any errors git push -f heroku master
)heroku run python3 -m userbot
heroku config:set CONFIG=value
heroku run:detached python3 -m userbot
app running on heroku is not a git repository so you cant use the .update
command, to update the bot first stop the running bot process
heroku stop processid
(to get the id run heroku ps
run.XXXX is the id), and
then you can update normally with git pull
.
and thats all your bot
should be kicking fine for now, heroku has a limited amount of hours for free
accounts (550 hours), it will also kill all processes if there is no activity
for more than 30min or so, don’t worry you can just restart it again
because we all hate migrations
Converting Jupyter notebooks to jekyll posts
Automating the Boring stuff with python
Automating the Boring Stuff with Python