The BOT is hosted on Heroku and it has been tested using Python v3.9.7
. Also, python-telegram-bot API and sqlite3 are needed.
J4NN0 BOT main features:
- Store and retrieve data from a database: you can save/delete/show items on your personal list.
- Set an alarm: when time is up the BOT will remind you what you asked for.
Check it out on telegram: @J4NN0_Bot
It is composed by a single table, REMINDERS
:
CHATID
: chat id for that user.USRNAME
: username of the user.ITEM
: the item added by the user.
Every time an user add/remove one or more item(s), these are added/removed to/from the db.
I also suggest you to download DB Browser for SQLite to easily manage (create, read, delete, modify, etc.) the database(s).
-
⭕ Developer
/about
: to see info about developer
-
📝 List
/addtolist <item>
: to add one or several items to your personal list./rmfromlist <item>
: to remove one or several items from your personal list./show_list
: it shows all items in your personal list./clear_list
: to delete all items from your personal list.
-
🔀 Random value
/random <number>
: it will return a random number between 0 and .
-
⏰ Alarm
/timer <seconds>
: to set a timer and wait for your message.
-
🤖 Info about bot
/help
: to have info about all commands.
There are also a lot of Easter eggs (you can't find them in this code) that i wrote to have fun with my friends. Try to find them and enjoy!
-
Register on Heroku.
-
Download and install Heroku CLI and git.
-
Create a project folder and put inside it the following files
bot.py Procfile runtime.txt requirements.txt
You can also have a
app.json
schema in order to declare environment variables, add-ons, and other information required to run an app on Heroku. More info here. -
Put inside
Procfile
worker: python script.py
-
Put the python version you want to use in
runtime.txt
.For instance, if you want to use Python
v3.6.6
just put inside the file:python-3.6.6
-
Specify explicit dependencies versions inside
requirements.txt
.For instance, I'm using python-telegram-bot API. So my file
requirements.txt
will look likepython-telegram-bot==8.1.1
To update this file, you can use the
pip freeze
command in your active virtual environment:pip freeze > requirements.txt
More info here.
-
At this stage, if you haven't already, log in to your Heroku account and follow the prompts to create a new SSH public key
heroku login
-
Create git repository
git init
or clone this repo
git clone https://github.com/J4NN0/j4nn0-b0t.git
-
Create heroku app
heroku create
-
Push your code (or deploy changes) into heroku app
git add . git commit -m 'message' git push heroku master
-
Run your worker
heroku ps:scale worker=1
-
Check logs with and enjoy your bot
heroku logs --tail
Checkout also the offical heroku guide: Getting Started on Heroku with Python.