A modern Discord bot that automatically fetches and shares LeetCode daily challenges
- 🔄 Automatic Daily Challenge: Automatically retrieves and posts LeetCode daily challenges
- ⏰ Scheduled Delivery: Configurable posting time for each server
- 🎮 Slash Commands: Easy-to-use slash commands for manual control
- 📊 Rich Information: Includes title, difficulty, link, tags, and more
- 🌐 Multi-server Support: Independent settings for each Discord server
- 🔔 Custom Notifications: Configurable role mentions and channels
- 🌍 Timezone Support: Server-specific timezone settings
-
Clone the repository:
git clone https://github.com/cxyfer/leetcode-daily-discord-bot.git cd leetcode-daily-discord-bot
-
Configure your environment:
# Copy and edit the environment file mv .env.example .env # Edit .env with your Discord bot token
-
Run the bot:
uv run bot.py
Send Messages
Embed Links
Use Slash Commands
Message Content
- Receive message content- Note: When the bot joins more than 100 servers, this permission needs to be verified and approved by Discord
DISCORD_TOKEN=your_bot_token_here
Command | Description | Required Permissions |
---|---|---|
/daily |
Display today's LeetCode.com (LCUS) daily challenge | None |
/daily_cn |
Display today's LeetCode.cn (LCCN) daily challenge | None |
/set_channel |
Set notification channel | Manage Channels |
/set_role |
Set role to mention | Manage Roles |
/set_post_time |
Set posting time (HH:MM) | Manage Guild |
/set_timezone |
Set server timezone | Manage Guild |
/show_settings |
Display current settings | None |
/remove_channel |
Remove channel settings | Manage Channels |
- Set up notification channel using
/set_channel
(Required) - Configure role mentions with
/set_role
(Optional) - Set posting time and timezone (Optional)
- Verify settings with
/show_settings
- 🎮 Enhanced Command Interface
- Add slash command prompts
- Reply in the same channel where slash commands are used
- ⚙️ Advanced Configuration System
- Allow admin users to set the configuration
- Set the channel to post the daily challenge
- Set the posting time and timezone
- Set the role to mention
- Set customizable message templates
- Integrate the existing excessive setup instructions
- More flexible notification settings
- Allow admin users to set the configuration
- 🌐 Multi-server Infrastructure
- Support server-specific configurations
- 📝 Code Optimization
- Implement improved runtime logging
- Implement modular architecture
- Add comprehensive documentation
- 🇨🇳 LeetCode.cn Integration
- Add slash command
/daily_cn
for LeetCode.cn daily challenge - Implement separate scheduler for LeetCode.cn challenges
- Add slash command
- 🗄️ Database Integration
- Store and query problem information in database
- Enable historical daily challenge lookup
- 🔍 Large Language Model Integration
- Integrate LLM to generate problem translation and inspiration
- Cache LLM results to improve performance
- 📊 User Engagement Features
- Track submission records of specific users
- Allow users to configure tracked LeetCode accounts
- Implement server-wide submission leaderboards
- 🐳 Containerization Support
- Add Docker compose file and image
- 🌍 Internationalization
- Support multiple display languages
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
- discord.py - Discord bot framework
- python-dotenv - Environment variable management
- requests - HTTP library for API calls
- pytz - Timezone handling
- beautifulsoup4 - HTML parsing
- colorlog - Colored logging output
- langchain - LLM application framework
- langchain-google-genai - Google Gemini LLM integration
- aiohttp - Asynchronous HTTP client/server
This project is licensed under the MIT License - see the LICENSE file for details.