A simple and interactive Telegram bot built with Go that fetches real-time cryptocurrency prices. This bot allows users to check the latest prices and 24h/1h change percentages of popular cryptocurrencies such as Bitcoin, Ethereum, Solana, Dogecoin, and more.
- 🪙 Fetch real-time cryptocurrency prices.
- 📈 View 24-hour and 1-hour percentage changes.
- 🕹️ Interactive buttons for easy navigation and selection.
- 🔧 Easy to configure and extend with new cryptocurrencies.
- 🌐 Fetches data using a lightweight public API.
To run the bot, you will need:
- Go 1.16 or higher
- A Telegram bot token (Get one by chatting with BotFather)
- Internet connection
git clone https://github.com/yourusername/Telegram_CryptoPriceBot.git
cd Telegram_CryptoPriceBotCreate a .env file in the root directory and add your Telegram bot token:
BOT_TOKEN=your-telegram-bot-token-hereNote: Make sure to keep your
.envfile secure and never share it publicly.
Run the following command to download required dependencies:
go mod tidyLaunch the bot using:
go run main.goThis bot uses the CoinLore API to fetch cryptocurrency data. The API provides the following features:
- Price data in USD for various cryptocurrencies.
- Percentage changes in price over the last 1 hour and 24 hours.
- Metadata such as coin name and symbol.
To fetch data for Bitcoin:
GET https://api.coinlore.net/api/ticker/?id=90
[
{
"id": "90",
"symbol": "BTC",
"name": "Bitcoin",
"price_usd": "30125.36",
"percent_change_24h": "1.89",
"percent_change_1h": "0.18"
}
]- Send
/startto the bot. - Select a cryptocurrency using the provided buttons.
- Receive a response with the coin's details, including price, 24h change, and 1h change.
By default, the bot supports:
- Bitcoin
- Ethereum
- Solana
- Dogecoin
- Tron
- SUI
- Shiba Inu
- TON Coin
You can easily extend this list by modifying the main.go file.
Contributions are always welcome! Here's how to get started:
- Fork the repository on GitHub.
- Create a new branch for your feature (
git checkout -b feature-name). - Make your changes and commit them (
git commit -m 'Add new feature'). - Push your branch (
git push origin feature-name). - Submit a pull request with a detailed explanation of your changes.
This project is licensed under the MIT License. Feel free to use, modify, and distribute this project.