LeetBot

2021-08-03
#Python

Making Leetcode more social and fun through friendly competition

LeetBot is a Discord bot that scrapes Leetcode user profiles and creates a live feed of user activity in a designated channel. Every developer has had to spend copious amounts of time on Leetcode (or Hackerrank or CodeSignal) in the hopes of landing their dream job. The idea behind LeetBot was to make the experience more social, similar to the way study groups work, by using live feeds to encourage each other.

The idea was developed by me and two friends, Ritz and Neel. For this project, I coded most of the backend while Ritz wrote the database procedures, and Neel contributed the Leetcode API route handling.

Tech Stack

LeetBot is written entirely in Python using discord.py and uses PostgreSQL for database management. The bot is not public at the moment, but the source code can be found here.

Commands and Features

LeetBot's main feature is a live feed of all users' recent Leetcode submissions. The bot is currently set up to check for new submissions every 30 seconds, although this can be adjusted in the main bot.py file for local instances of the bot.

image of the live feed

An image of the live feed

Other commands are used to set-up the live feed channel and register Leetcode user profiles to follow in the feed channel. There are also a few leaderboard commands to view which users have submitted the most accepted solutions for easy, medium, and hard problems. The full list of commands is shown below:

image of the help command

The +help command shows all commands

+add [username] and +remove let users link and unlink their Leetcode account

+top generates a leaderboard

+my generates a user's own stats

There are also an assortment of admin-only commands that server administrators can use to set the feed channel and start/stop the feed. Additionally, server admins can remove users for moderation reasons. These commands are prefixed by ++.

++remove [username], ++set, and ++stop commands