A comprehensive Telegram bot for the GraphLinq ecosystem that provides staking information, price data, and community resources for GLQ token holders.
Live Bot: @GraphlinqBot
- Address Management: Set and view your wallet address
- Personal Staking Info: View your staked GLQ, rewards, tier, and rank
- Portfolio Tracking: Monitor your staking position and USD value
- Network Statistics: Total stakers, total staked, APY rates
- Tier Information: View staking tiers and their distributions
- Price Data: Real-time GLQ pricing and market data
- Community Resources: Links to websites, social media, exchanges
- Documentation: Quick access to GraphLinq resources
- Maintenance Mode: Bot-wide maintenance with admin bypass
- System Monitoring: Server stats, uptime, and performance metrics
- Advanced Logging: Multi-level logging system with file separation
- Python 3.6-3.10 (3.7+ recommended)
β οΈ Important: This project usespython-telegram-bot==13.0
which is incompatible with Python 3.11+ and does not support the async patterns introduced in v20+ - Telegram Bot Token (from @BotFather)
- Ethereum/Web3 RPC endpoint (Infura, Alchemy, etc.)
- LiveCoinWatch API key (optional, for price data)
-
Clone the repository
git clone https://github.com/jrbgit/GraphLinq.TelegramBot.git cd GraphLinq.TelegramBot
-
Install dependencies
pip install -r requirements.txt
-
Set up environment variables
Create a
.env
file in the project root:# Required TELEGRAM_KEY=your_telegram_bot_token_here NETWORK_URL=https://your-ethereum-rpc-endpoint.com CONTRACT_ADDRESS=0x9F9c8ec3534c3cE16F928381372BfbFBFb9F4D24 # Optional LCW_API_KEY=your_livecoinwatch_api_key MAINT_MODE=0 ALLOWED_ADMIN=your_telegram_user_id
-
Run the bot
python3 bot.py
-
Using Docker Compose (Recommended)
docker-compose up -d
-
Manual Docker Build
docker build -t graphlinq-bot . docker run -d --name graphlinq-bot graphlinq-bot
Command | Description | Example |
---|---|---|
/setmyaddress <address> |
Set your wallet address | /setmyaddress 0x123... |
/myaddress |
View your stored address | /myaddress |
/mytotal |
View your total staked GLQ | /mytotal |
/myrank |
View your staking rank | /myrank |
/mytier |
View your current tier | /mytier |
/myrewards |
View claimable rewards | /myrewards |
Command | Description |
---|---|
/start |
Welcome message and bot info |
/help |
Display command help menu |
/apy |
Current APY rates for each tier |
/tiers |
GLQ staked in each tier |
/totalstaked |
Total GLQ staked across all tiers |
/totalstakers |
Number of active stakers |
/supply |
GraphLinq Chain supply information |
/websites |
Official GraphLinq websites |
/socials |
Social media links |
/staking |
Staking guide and resources |
/documentation |
Link to official docs |
/listings |
Where to buy/trade GLQ |
/status |
Network status links |
/shortcuts |
Command aliases |
For backward compatibility, the following shortcuts are supported:
/set
β/setmyaddress
/address
β/myaddress
/total
β/mytotal
/rank
β/myrank
/tier
β/mytier
/rewards
β/myrewards
/staked
β/totalstaked
/stakers
β/totalstakers
GraphLinq.TelegramBot/
βββ bot.py # Main bot application
βββ config_base.py # Base configuration and API keys
βββ config_contract.py # Smart contract interface
βββ config_logging.py # Logging configuration
βββ config_maint.py # Maintenance mode settings
βββ config_msgs.py # Bot messages and responses
βββ requirements.txt # Python dependencies
βββ docker-compose.yml # Docker deployment
βββ Dockerfile # Docker container config
βββ .env # Environment variables (create this)
βββ logs/ # Log files directory
βββ debug.log
βββ info.log
βββ warning.log
βββ error.log
βββ critical.log
- Smart Contract Integration: Direct interaction with GraphLinq staking contract
- Database: SQLite for user address storage
- Price APIs: LiveCoinWatch and GraphLinq Hub integration
- Logging System: Multi-level logging with file separation
- Maintenance Mode: System-wide maintenance with admin bypass
Variable | Required | Description | Example |
---|---|---|---|
TELEGRAM_KEY |
β | Bot token from BotFather | 123456:ABC-DEF... |
NETWORK_URL |
β | Ethereum RPC endpoint | https://mainnet.infura.io/v3/... |
CONTRACT_ADDRESS |
β | GraphLinq staking contract | 0x9F9c8ec3534c3cE16F928381372BfbFBFb9F4D24 |
LCW_API_KEY |
β | LiveCoinWatch API key | abc123... |
MAINT_MODE |
β | Maintenance mode (0=off, 1=on) | 0 |
ALLOWED_ADMIN |
β | Admin Telegram user ID | 123456789 |
The bot includes the complete ABI for the GraphLinq staking contract, supporting functions like:
getDepositedGLQ()
- User staked amountgetGlqToClaim()
- Claimable rewardsgetPosition()
- User rankgetWalletCurrentTier()
- User tiergetTiersAPY()
- Current APY ratesgetTotalStakers()
- Total staker count
- Staking Data: Direct smart contract queries via Web3
- Price Data: LiveCoinWatch API and GraphLinq Hub API
- Supply Data: GraphLinq Chain Explorer API
- User Data: Local SQLite database for address storage
- Address Storage: User addresses stored locally in encrypted SQLite database
- Private Commands: Restricted to direct messages only
- Admin Controls: Maintenance mode with admin bypass functionality
- API Key Masking: Sensitive data masked in logs
- Error Handling: Comprehensive exception handling and logging
The bot supports maintenance mode for updates and troubleshooting:
- Enable: Set
MAINT_MODE=1
in environment - Admin Bypass: Admin users can still access all functions
- User Message: Automatic maintenance message to regular users
- Logging: All maintenance events logged
The bot implements a comprehensive logging system:
- debug.log: Detailed execution flow
- info.log: General information and startup
- warning.log: Non-critical issues
- error.log: Error conditions
- critical.log: Critical failures
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature
) - Commit changes (
git commit -m 'Add amazing feature'
) - Push to branch (
git push origin feature/amazing-feature
) - Open a Pull Request
This project is open source and available under the MIT License.
- Issues: GitHub Issues
- GraphLinq Telegram: Join Community
- Documentation: GraphLinq Docs
- GraphLinq Protocol: https://graphlinq.io
- Staking Platform: https://app.graphlinq.io/app/staking
- Explorer: https://explorer.graphlinq.io
- Hub: https://hub.graphlinq.io
Author: jrbgit
Contact: @jr00t_GLQ
Website: jr00t.com
Built with β€οΈ for the GraphLinq community