Discord price bots framework using CoinGecko, web3, and python.
- Copy and paste the
.example-env
contents into a new.env
file. - Provide the bot token fields with the discord client secrets for the bots you're trying to run.
- Provide the bot id fields with the user ids of the bots you're trying to run.
- Fill out the token address fields with the tokens you're representing with the price bots.
- Provide a web3 node URL
- Provide a monitoring webhook if you'd like to receive alerts for some of the failures.
Note: subject to change, docker structure less than ideal right now.
- Run
docker-compose up -d
which will build and run all of the uncommented services in a background process - Run
docker-compose logs -f
if you want to stream the logs for the active services
In the case you need to restart or rebuild the images, following process works.
- Stop running service using
docker-compose rm -s -v <service-name>
- Build new service container with updates using
docker-compose build <service-name>
- Delete old image to free up space by running
docker images
and thendocker image rm -f <image-id>
- Run new service in background with
docker-compose up -d <service-name>
All the source code is in the src/
directory. The price-bot.py
file contains the most basic implementation to update a Discord bot with the current price and market cap of a token every 45 seconds using CoinGecko's API. The sett-bot.py
and digg-bot.py
classes extend the PriceBot class with unique modifications to get additional data and more accurate data.
You can reference the DiggBot and SettBot classes for how to integrate Chainlink oracles and other web3 calls to get price information and display it using Discord.