LeetCode Bot

Overview

This is a Discord Bot created using Discord.py. Its purpose is to facilitate LeetCoding within a Discord server. It achieves this goal through the usage of custom settings, customizable daily problems, notifications for upcoming contests, and other features.

As a live service product, it is a constant work in progress and always changing. The source code is available on GitHub. There you can also find an invite link and documentation for setting it up on your own server.

Technologies Used

Links

The Product

The final product was a Discord bot that helps users with LeetCode problems by providing customizable daily challenges, tracking progress, and other things.

The bot is designed to be easily configurable, allowing server administrators to set their own preferences for problem difficulty, frequency of these problems, and more.

The bot uses the LeetCode API to fetch problems and user data, ensuring that users receive relevant content.

It also includes features such as reminders for upcoming contests, a leaderboard to track user progress, and a help command to assist users in navigating the bot's features.

The image shows an example of a problem being sent to a user.

For more examples, check out the GitHub repository.

LeetCode Bot Screenshot

Challenges & Solutions

At the time of making this, it was the biggest project I've ever worked on and designed on my own. This naturally came with a lot of unique challenges that I had not encountered yet.

One of the main challenges was designing a bot that could scale with the needs of the users. I had to ensure that the bot could handle multiple servers and users without performance issues.

Another challenge was managing the custom settings and demands of each server. I used a combination of in-memory data structures and persistent storage to achieve this.

Additionally, a major challenge was getting the notification and problem delivery system to work. Ultimately through the usage of the Observer pattern, namely a Time Observer, I was able to notify relevant users.

Finally, I had to ensure that the bot was user-friendly and easy to use. I spent a lot of time designing the commands and interactions to be intuitive and straightforward. This included creating a help command that provided users with information on how to use the bot and its features.

Takeaways

This was an incredibly useful project for my development. Building this product allowed me to put together everything I know and learned in a way that allowed me to apply my skills effectively. I learned an enormous amount about building and maintaining a live service product.

I realized how useful it is to have a solid understanding of the underlying technologies and frameworks when building a complex system. Also how important it is to read the documentation of the libraries and tools I am using.

Some key takeaways include: