Discord bot written in Python using discord.py for tracking information on blockchain
API from CoinGecko was used to fetch the data
-
.envfileProvide
TOKENvariable obtained from Discord developer portal -
venvBefore installing dependencies it is highly recommended to work in virtual environment. If you want to create virtual environment
.venv, use following command:python -m venv .venv
Make sure it is activated after installation
pip install -r requirements.txt-
Command
python main.pyThis command initiates the bot using file logging. The bot's activities, errors, and relevant information will be logged into a file named
discord.log. File logging has advantages for long-term record-keeping, troubleshooting, and maintaining a history of the bot's performance. Keep in mind that file logging may accumulate data over time, so regular maintenance might be needed to manage log files. -
Command
python main.py --testThis command starts the bot in testing mode, utilizing standard console logging. When initiated with the --test flag, the bot will log information directly to the console instead of a file. Console logging is useful during testing and development phases, providing immediate feedback and visibility into the bot's activities.
| Command | Explanation |
|---|---|
| $sync | Syncing slash commands with the guild |
| /ath [coin] | All time high for the coin |
| /info [coin] | Basic info for the coin (market cap, price, 24h change etc.) |
| /pnl [coin] [type] [price] | Profit and loss for the coin based on type of the position and the price when position was opened |
| /price_change [coin] | Price change (24h, 7 days, 14 days, 30 days) |
| /price [coin] | Price of the coin |
| /top [n] | Top n coins by the market cap |