Inspired by pipercucu/DiscordSidebarPriceBot, these Python scripts can run Discord bots that pull live data at intervals and display it on the sidebar of a Discord guild (i.e. server). It currently supports:
- Cryptocurrency price data (in USD, BTC, and/or ETH) from Coingecko API
- Gas price of the Ethereum blockchain (in gwei) from Etherscan API
- Forex price from exchangeratesapi
- Crypto Fear & Greed Index from Alternate.me API
Recommended Python 3.7
, although it should support Python >=3.5 <=3.9
. Install all dependencies:
pip install -r requirements.txt
- Cache the cryptocurrency ticker list from Coincegko by generating a crypto_cache.json file.
python crypto_cache.py -v
-
Configure crypto_config.yaml using the template provided. It requires a unique Discord bot key and (non-unique) Guild ID per bot. 1 sidebar bot per cryptocurrency (expressed by their ticker e.g. BTC, ETH, YFI). For each cryptocurrency, the price can be shown in USD, BTC, and/or ETH.
-
Sometimes multiple coins or tokens share the same ticker (e.g. UNI). In this case, modify resolver_ambiguous_ticker() to specify the token you want.
-
Run a cryptocurrency price bot:
python crypto_run.py -t BTC
Replace the ticker BTC
with any cryptocurrency you have configured in Step 2.
-
Configure gas_config.yaml using the template provided. It requires a unique Discord bot key and (non-unique) Guild ID per bot. It also requires an Etherscan API key if you would like to use Etherscan API.
-
Run a gas price bot using Etherscan API:
python gas_run.py -s etherscan
-
Configure forex_config.yaml using the template provided. It requires a unique Discord bot key and (non-unique) Guild ID per bot. 1 sidebar bot per forex pair (expressed by their ticker/ticker e.g. GBP/HKD).
-
Run a forex price bot:
python forex_run.py -p GBP/HKD
Replace GBP/HKD
with any forex pair you have configured in Step 1.
-
Configure cfgi_config.yaml using the template provided. It requires a unique Discord bot key and (non-unique) Guild ID per bot.
-
Run a bot:
python cfgi_run.py
Once you are familiar with running a single sidebar bot, you can run multiple bots concurrently by calling ./bot.sh
and kill all bots by calling ./kill.sh
. You might want to modify the commands in ./bot.sh
to suit your own needs.