Skip to content

A modern Discord bot that automatically fetches and shares LeetCode daily challenges

License

Notifications You must be signed in to change notification settings

cxyfer/leetcode-daily-discord-bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

48 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🎯 LeetCode Daily Challenge Discord Bot

A modern Discord bot that automatically fetches and shares LeetCode daily challenges

Python Discord License

✨ Features

  • 🔄 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

🚀 Quick Start

  1. Clone the repository:

    git clone https://github.com/cxyfer/leetcode-daily-discord-bot.git
    cd leetcode-daily-discord-bot
  2. Configure your environment:

    # Copy and edit the environment file
    mv .env.example .env
    # Edit .env with your Discord bot token
  3. Run the bot:

    uv run bot.py

🛠️ Configuration

Required Bot Permissions

  • Send Messages
  • Embed Links
  • Use Slash Commands

Required Intents

  • Message Content - Receive message content
    • Note: When the bot joins more than 100 servers, this permission needs to be verified and approved by Discord

Environment Variables

DISCORD_TOKEN=your_bot_token_here

📝 Usage

Slash Commands

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

Server Configuration Steps

  1. Set up notification channel using /set_channel (Required)
  2. Configure role mentions with /set_role (Optional)
  3. Set posting time and timezone (Optional)
  4. Verify settings with /show_settings

🗺️ Development Roadmap

  • 🎮 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
  • 🌐 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
  • 🗄️ 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

🤝 Contributing

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.

📦 Dependencies

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

About

A modern Discord bot that automatically fetches and shares LeetCode daily challenges

Topics

Resources

License

Stars

Watchers

Forks

Languages