Telegram Bot
Local development
Setup eq-aggregator
that will send events to localhost:3300
and run the next
script:
➜ tg-bot git:(master) MONGO_URI="mongodb+srv://..." go run .
This command will:
- spin up a server on
localhost:3300
that listens to earthquake events and
send them to the bot,
- start bot to listen to user events.
Deployment
Manual
# build docker image
docker build -t eq-tg-bot .
# run docker container
docker run -d --network host --log-opt max-size=10m --log-opt max-file=5 -e MONGO_URI="mongodb+srv://.../?retryWrites=true&w=majority" -e TELEGRAM_BOT_TOKEN="14...w" -e BOT_ENV=prod --restart=always eq-tg-bot:latest
Fly.io
Install flyctl.
# log in with your account
flyctl auth login
# launch the app
flyctl launch
# set app secrets
flyctl secrets set TELEGRAM_BOT_TOKEN=<tg-bot-token> \
BOT_ENV=prod \
MONGO_URI="<mongo-db-uri>"
Check the official documentation.
Bot Father configuration
Name
Earthquake Events ⚠️
Description
It makes you able to receive notifications of recent earthquakes by making subscriptions configured with parameters such as magnitude, location, and observing radius.
Commands
start - Starts the home screen
list - Lists current subscriptions