How ujan0009/telegrampricealertbot works
CryptoPriceBot lets Telegram users check cryptocurrency prices and create threshold alerts. Telegram command handlers validate requests, resolve coin shortcuts, fetch USD prices from CoinGecko, and reply to users. Alert requests are held in memory and checked every 60 seconds; triggered alerts are sent through Telegram. A small Flask endpoint reports that the bot is alive, started alongside polling. The source is a single-file application, so several distinct responsibilities share main.py; omitted portions limit detail about alert triggering and command behavior.
Main entry points: main.py Bot runtime
Components 11
Telegram bot
- Bot runtime
main.py - Command handlers
main.py
Price lookup
- Coin mapping
main.py - Price fetch
main.py
Price alerts
- Alert state
main.py - Alert checker
main.py
Uptime endpoint
- Alive endpoint
main.py - Flask server
main.py
Other components
- Telegram user
- Telegram platform
- CoinGecko API
Connections 14
- Telegram user → Telegram platform: sends commands
- Telegram platform → Bot runtime: delivers updates
- Bot runtime → Command handlers: dispatches commands
main.py - Command handlers → Telegram platform: sends replies
main.py - Command handlers → Price fetch: fetches prices
main.py - Price fetch → Coin mapping: resolves symbol
main.py - Price fetch → CoinGecko API: requests price
main.py - Command handlers → Alert state: stores alerts
main.py - Bot runtime → Alert checker: schedules checks
main.py - Alert checker → Alert state: reads alerts
main.py - Alert checker → Price fetch: checks prices
main.py - Alert checker → Telegram platform: sends notifications
main.py - Bot runtime → Flask server: starts server
main.py - Flask server → Alive endpoint: serves route
main.py