A comprehensive Discord bot for monitoring cryptocurrency mining operations, specifically designed for Litecoin (LTC) and Dogecoin (DOGE) mining through litecoinpool.org.
- Core Features
- Command Examples
- Environment Variables
- Setup and Installation
- Project Structure
- Error Handling
- Debugging
- Security Considerations
- Contributing
- License
- Setup Guides
- Automatically calculates mining profitability considering:
- Current cryptocurrency prices (LTC & DOGE)
- Expected mining rewards
- Electricity costs
- Power consumption
- Sends alerts when mining becomes unprofitable/profitable
- Real-time monitoring of mining worker status (30-second intervals)
- Instant notifications when:
- Workers go offline (hash rate drops to 0)
- Workers come back online with current hash rate
- Displays current hash rates for all workers
- Real-time LTC price tracking
- Real-time DOGE price tracking
- Total rewards calculation in USD
- Daily profit calculations
- 24-hour reward summaries
All commands start with ?
?help- Displays available commands?total- Shows total rewards in USD (LTC + DOGE)?profit- Displays expected daily profit?ltc- Shows current LTC price?doge- Shows current DOGE price
Shows a list of all available commands and their descriptions:
Displays your current mining rewards in both LTC and DOGE, converted to USD:
Shows current daily profit/loss calculation based on:
- Expected mining rewards
- Power consumption
- Electricity costs
Shows current Litecoin (LTC) price in USD:
Shows current Dogecoin (DOGE) price in USD:
DISCORD_TOKEN=your_discord_token_here
# Your Discord bot token from Discord Developer Portal
# Required for bot authentication with Discord services
CHANNEL_ID=your_channel_id_here
# Discord channel ID where the bot will send notifications
# Must be a valid Discord channel ID number
# Can be obtained by enabling Developer Mode in Discord and right-clicking the channel
LITECOINPOOL_API_KEY=your_api_key_here
# Your litecoinpool.org API key
# Required for accessing mining statistics and worker information
# Can be obtained from your litecoinpool.org account settings
POWER_USAGE=1392
# Total power consumption of your mining operation in Watts
# Used for profitability calculations
# Example: 1392W for a typical mining setup
ENERGY_COST_PER_KWH=0.034
# Your electricity cost per kilowatt-hour in USD
# Used for calculating operating costs
# Example: 0.034 for $0.034 per kWh
HOURS_PER_DAY=24
# Operating hours per day
# Default is 24 for continuous operation
# Can be adjusted if mining operation runs on a schedule
- Worker Status Checks: Every 30 seconds
- Profitability Alerts: Every 30 seconds
- Daily Totals Update: Every 24 hours (86400 seconds)
- Python 3.11 or higher
- Discord Developer Account
- Discord Bot Token
- litecoinpool.org Account and API Key
- Docker (optional)
-
Clone the repository:
git clone https://github.com/yourusername/litecoinpool-bot.git
-
Create and activate virtual environment:
python3 -m venv venv source venv/bin/activate # On Windows: .\venv\Scripts\activate
-
Install dependencies:
pip install -r requirements.txt
-
Configure environment:
cp .env.example .env # Edit .env with your values -
Run the bot:
python discord_bot.py
-
Configure environment:
cp .env.example .env # Edit .env with your values -
Build and run with Docker Compose:
docker-compose up --build
discord_bot.py- Main Discord bot implementation and event handlerscrypto_utils.py- Cryptocurrency API interaction and calculationsprofitability_tester.py- Standalone testing tool for profitability calculations
The bot includes comprehensive error handling for:
- API connection issues
- Discord connection problems
- Invalid data responses
- Channel access permissions
- Worker status monitoring
- Profitability calculation errors
Common issues and solutions:
-
Bot Not Responding
- Verify DISCORD_TOKEN is correct
- Check Discord bot permissions
- Ensure bot has access to specified channel
-
No Mining Data
- Verify LITECOINPOOL_API_KEY is correct
- Check litecoinpool.org API status
- Confirm API access permissions
-
Incorrect Profitability Calculations
- Verify POWER_USAGE matches your setup
- Confirm ENERGY_COST_PER_KWH is correct
- Check HOURS_PER_DAY setting
- Store
.envfile securely and never commit to version control - Regularly rotate API keys
- Use minimal required Discord bot permissions
- Monitor bot access logs
- Keep dependencies updated
- Fork the repository
- Create a feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
-
Create a Litecoinpool Account
- Visit litecoinpool.org
- Click "Register" and create an account
- Verify your email address
-
Generate API Key
- Log into your litecoinpool.org account
- Navigate to "Settings"
- Scroll down to the "API Access" section
- Click "Generate New Key"
- Copy your API key and store it securely
-
Create Discord Application
- Visit Discord Developer Portal
- Click "New Application"
- Give your application a name (e.g., "Crypto Mining Monitor")
- Click "Create"
-
Create Bot User
- In your application, go to the "Bot" section
- Click "Add Bot"
- Set bot username and icon
- Under "Privileged Gateway Intents", enable:
- Presence Intent
- Server Members Intent
- Message Content Intent
-
Get Bot Token
- In the "Bot" section, click "Reset Token"
- Copy your bot token (DISCORD_TOKEN)
- Keep this token secure and never share it
-
Invite Bot to Server
- Go to "OAuth2" → "URL Generator"
- Select the following scopes:
botapplications.commands
- Select bot permissions:
- Read Messages/View Channels
- Send Messages
- Read Message History
- Add Reactions
- Copy the generated URL
- Open URL in browser
- Select your server and authorize
-
Get Channel ID
- Open Discord Settings
- Go to "App Settings" → "Advanced"
- Enable "Developer Mode"
- Right-click the channel where you want bot notifications
- Click "Copy Channel ID"
- This is your CHANNEL_ID
-
Configure Bot
- Copy
.env.exampleto.env - Add your tokens and IDs:
DISCORD_TOKEN=your_bot_token_here CHANNEL_ID=your_channel_id_here LITECOINPOOL_API_KEY=your_litecoinpool_api_key_here
- Copy