Crypto Bot is a simple yet powerful Telegram bot that allows users to get real-time cryptocurrency prices with the ease of clicking a button. Whether you're a trader or a crypto enthusiast, this bot provides you with up-to-date information about any cryptocurrency you're interested in.
- Instant Prices: Get real-time prices for various cryptocurrencies.
- User-Friendly: Simply click a button to fetch the price of your desired crypto product.
- Multi-Currency Support: Supports a wide range of cryptocurrencies including Bitcoin, Ethereum, Litecoin, and more.
- Start the bot on Telegram.
- Choose the cryptocurrency you want to check.
- Click the button to get the latest price for the selected currency.
To run this bot locally, follow the steps below:
-
git clone https://github.com/yourusername/crypto-bot.git cd crypto-bot
-
Install the required Python libraries:
pip install -r requirements.txt
Required Libraries:
python-telegram-bot requests
-
Open Telegram and search for "BotFather". Type /newbot and follow the instructions to create a new bot. Copy the TOKEN provided by BotFather.
-
Store your bot token as an environment variable for secure access:
On Windows:
Search for "Environment Variables" and add a new user variable called BOT_TOKEN with your bot token as the value. On Linux/Mac:
In the terminal, run:
export BOT_TOKEN="your_bot_token_here"
Alternatively, replace os.getenv("BOT_TOKEN") in the code with your token directly (not recommended for production).
-
Once you’ve set your bot token, you can start the bot by running the Python script:
python bot.py
You should see Polling....., meaning your bot is now running and ready to respond to commands.
Here are the available commands:
/start: Initiate the bot. /help: Get help about how to use the bot. /price: Fetch real-time cryptocurrency prices (Bitcoin, Ethereum, Litecoin).