HCryptoPrice is a Python-based bot that fetches real-time cryptocurrency prices from Coingecko and presents them in an easy-to-understand format on Telegram. It also offers historical price data, market cap rankings.
If you want to use more advanced bot features as call limits, you can use the API interaction,
which is available in the hcpb-api repository.
Here's a working version of the bot: @h_crypto_price_bot
- First, make sure you have Python 3.11 installed on your machine. You can check your Python version by opening a terminal and running the following command:
python --version
- Next, clone the h-crypto-price-bot repository to your local machine. You can do this by running the following command in your terminal:
git clone https://github.com/halon176/h-crypto-price-bot.git
- Change into the directory where the bot's code is located, the install the dependencies using Poetry:
cd h-crypto-price-bot
poetry install
-
Create a new Telegram bot by following the instructions in the Telegram Bot API documentation: https://core.telegram.org/bots#6-botfather
-
After creating your bot, copy the token provided by BotFather. Then, set up an environment variable named TOKEN with the bot token using the following command, replacing <telegram_bot_token> with your bot token:
export TELEGRAM_TOKEN=<telegram_bot_token>
To use the gas price feature, you must include an Etherscan API key. Other keys are optional.
export ETHSCAN_API_KEY=<etherscan_api_key>
export CMC_API_KEY=<coinmarketcap_api_key>
export API_URL=<api_url>
- Run the bot by running the following command:
python src/main.py
Your bot should now be up and running! You can add it to a Telegram group or start a chat with it to test it out.
- Clone the h-crypto-price-bot repository to your local machine. You can do this by running the following command in your terminal:
git clone https://github.com/halon176/h-crypto-price-bot.git
- Launch the 'docker build' command to build your Docker image.
docker build -t h-crypto-price h-crypto-price-bot/.
- Now you can start the container using the command, replacing <telegram_bot_token> with your bot token:
docker run -d -e TELEGRAM_TOKEN=<telegram_bot_token> --name h-crypto-price h-crypto-price
To use the gas price feature, you must include an Etherscan API key. ETHSCAN_API_KEY=<etherscan_api_key>
docker run -d -e TELEGRAM_TOKEN=<telegram_bot_token> -e ETHSCAN_API_KEY=<etherscan_api_key> --name h-crypto-price h-crypto-price
The bot is now up and running within the Docker container!
The bot can receive requests using the command /p followed by the cryptocurrency symbol, for example:
/p btc
/p eth
/p cro
To display the list of all available commands, type /help
- Build more interactions with API, such as store settings and call limits.
Contributions are welcome! If you have any suggestions or bug reports, please open an issue on the GitHub repository.
This project is licensed under the MIT License. See the LICENSE file for details.