Inspiration

Technical interview preparation can be intimidating, especially when finding quality practice problems or getting meaningful feedback. While platforms like LeetCode provide thousands of questions, they don't always explain why a solution could be improved or simulate the experience of discussing your code with an interviewer. I wanted to build a Discord bot that combines AI with coding practice, making interview preparation more interactive, accessible, and collaborative.

What it does

The bot offers two different ways to practice:

  • Daily LeetCode Challenges: Retrieves the daily LeetCode problem so users can solve current interview-style questions directly from Discord.
  • AI Challenge Mode: Uses Google's Gemini model to generate original LeetCode-style programming problems with selectable difficulty levels (Easy, Medium, or Hard).

After writing a solution, users submit their code to the bot, which uses Gemini to analyze it. Instead of simply saying whether the answer is right or wrong, the bot provides detailed feedback, including:

  • Code correctness analysis
  • Potential bugs and edge cases
  • Time complexity
  • Space complexity
  • Suggestions for cleaner or more efficient code
  • Overall interview-style feedback

This creates a coding coach that helps users understand how to improve rather than simply giving them an answer.

How we built it

The project was built using:

  • Node.js for the backend
  • Discord.js for interacting with the Discord API
  • Google Gemini API for problem generation and code review
  • LeetCode GraphQL API for retrieving the daily coding challenge
  • JavaScript with modular services to separate challenge generation, submissions, and AI review

The bot maintains an active coding session for each user so multiple people can practice independently within the same Discord server.

Challenges we ran into

One of the biggest challenges was interacting with LeetCode's GraphQL endpoints. Some requests required CSRF protection, resulting in several HTTP 400 and 403 errors while attempting to retrieve problem information by ID. We explored multiple approaches before settling on a more reliable workflow.

Another challenge involved AI output formatting. Gemini occasionally returned mathematical constraints using LaTeX syntax such as:

1 \le nums.length \le 10^5

Since Discord doesn't render LaTeX, we modified the prompts and added post-processing to produce clean, readable constraints.

Managing Discord's message length limits also required additional logic. AI-generated problems and reviews can become quite long, so the bot automatically truncates responses when necessary to stay within Discord's message limits.

Finally, designing prompts that consistently generated high-quality interview questions and constructive code reviews took multiple iterations. Small prompt changes had a significant impact on the consistency and usefulness of Gemini's responses.

What we learned

This project provided hands-on experience with:

  • Prompt engineering for reliable AI-generated content
  • Building conversational applications with Discord.js
  • Designing modular Node.js applications
  • Integrating multiple APIs into a single workflow
  • Managing user state across concurrent Discord sessions
  • Handling API limitations, rate limits, and formatting inconsistencies

We also gained a better understanding of how large language models can augment traditional developer tools by acting as mentors instead of simply providing answers.

What's next

Future improvements include:

  • Executing submitted code in a secure sandbox against hidden test cases.
  • Adding language support beyond JavaScript, such as Python, Java, and C++.
  • Tracking user progress with leaderboards and statistics.
  • Supporting topic-specific practice (Arrays, Graphs, Dynamic Programming, Trees, etc.).
  • Creating an interview mode where Gemini asks follow-up questions just like a real technical interviewer.
  • Allowing users to compete in AI-generated coding contests directly within Discord.

Built With

Share this project:

Updates