A simple Telegram bot which publishes 12 month Euribor rates once a day and comments on them using ChatGPT.
The bot tracks the 12 month Euribor rate published by the the Bank of Finland every day. When the rate is updated at around midday Finnish time, the bot sends it to all the channels it tracks. It also reacts on the rate change by generating a comment using ChatGPT.
Once the bot has been added to a channel, you need to send the /euribor register
command so that the bot starts sending rates. If want to stop receiving rates, send /euribor unregister
. You can also query the rate at any time with /euribor rate
.
You can run the bot locally by installing the dependencies, setting your bot token and then running npm run dev
:
# Install dependencies
npm ci
# Export the token received from the Botfather
export TELEGRAM_BOT_TOKEN=your-token-goes-here
# Export the API key from OpenAI
export OPENAI_API_KEY=your-api-key-goes-here
# Start the bot
npm run dev
Alternatively you can build the bot as a container and run it:
# Build the container image
docker build -t euribor-bot .
# Run the container and mount local database path to container
docker run --name euribor-bot --rm -d -v $(pwd)/data:/home/node/bot/data -e TELEGRAM_BOT_TOKEN=your-token-goes-here euribor-bot
The bot uses LowDB to store the rate history, as well the channels it tracks. These database contents are written to /data/db.json
.