🎯 TerremotiBot 2.0 - Telegram bot
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
lib
scripts
test
.dockerignore
.dockerignore-prod
.eslintrc.json
.gitignore
.istanbul.yml
.release.json
Dockerfile.Dev
Dockerfile.Prod
Dockerfile.Tests
LICENSE
README.md
docker-compose.dev.yml
docker-compose.tests.yml
index.js
mocha.opts
package.json
yarn.lock

README.md

TerremotiBot

GitHub release Code coverage Dependencies License

🎯 Source code of the Italian bot TerremotiBot, available on Telegram

Configuration

A config.json file should be placed in the config directory. The template for the configuration file is example.config.json.

Key Required Explanation
telegram.token Yes The Telegram Bot API bot token
telegram.serverPort Yes The port used for the HTTP webhook server
db.connectionString Yes MongoDB connection string
ingv.pollingInterval Yes Interval for INGV server polling
ingv.broadcastThreshold Yes Magnitude threshold value. Earthquakes with a magnitude above this value will be notified to all chats in the database. To disable broadcast notifications, set the value to an high number (like 10)
social.enabled Yes Enable or disable the feature that publishes earthquakes to an Amazon SQS queue, for being later published to social networks
social.threshold No Social publish threshold value
social.sqs No Credentials for publishing earthquakes and image cards to SQS
geonames.username Yes Username for the GeoNames service, used for reverse geocoding
mapbox.token Yes Mapbox token for generating the maps for the notifications
stathat.key No StatHat key for logging some metrics

How to run it

yarn
node index.js

Run with Docker

You can run the application locally with Docker. This Docker Compose configuration brings up a MongoDB instance, and the base image already includes all the required dependencies (Node.js, yarn, GraphicsMagick, ffmpeg, vapoursynth with vsimagereader).

docker-compose -f docker-compose.dev.yml up --build

You can also run MongoDB in a separate shell:

docker-compose -f docker-compose.dev.yml up mongo

And then run the actual bot:

docker-compose -f docker-compose.dev.yml up --build bot

Run tests with Docker

You can run tests locally with Docker. This brings up a MongoDB instance used for runnig tests. After they are completed, stop Compose pressing CTRL+C (once).

docker-compose -f docker-compose.tests.yml up --build