In this project, we proposed a transactional telegram chatbot
for exchanging money between mobile money operators and other digital currencies.
- Fist, search @botfarther on telegram to create a bot.
- Request @botfather for the new bot access management token
- Install poetry for virtual env management if it not already done
sudo apt-get update
sudo apt-get install poetry
- Install projet dependencies from projet root folder type
poetry installl
- Enable virtual env
poetry shell
- Export bot access token
export BOT_API_TOKEN='access management token'
python3 start.py
- skip steps 1, 2, 3 of config section
- launch project with docker-compose
docker-compose up
A handler is an update event: for example a new text incoming message, a new voice incoming message, etc. The list below enumerate some message handlers:
- telegram.ext.CommandHandler
- telegram.ext.ConversationHandler
- telegram.ext.MessageHandler
- telegram.ext.PollAnswerHandler
For the complete list see this link
- add a new function on this app/telegram/handlers.py module
that function must have one parameter to take an Application object.
the code below is an example to add to add CommandHandler
# app/telegram/handlers.py
from telegram.ext import CommandHandler
from telegram.ext import Application
def new_command_handler(app: Application) -> None
handler = CommandHandler(command='health', callback=callback)
app.add_handler(handler)