Awesome_E Awesome_E
GitHub Experience Projects

Identifying its Purpose

As we hosted our online hackathons on Discord, we quickly saw that some functions we wanted were (and still aren’t) natively implemented in Discord. One of these features was being able to send a different invite link that would automatically assign appropriate channel permissions to judges, mentors, speakers, and participants.

What it Does

The Treasure Hacks Discord Bot is a general purpose bot made for our server. It takes handles certain cases in moderation and provides us with a list of commands so that we can focus more on running our events. Below is a non-exhaustive list of the functionality it has:

Attendance: When run, the /attendance record command gets everyone in the current voice channel (where the command is run) and saves it in a database. We can then view this data later with /attendance list, which returns the date the command was run, then name of the workshop, and the participant list.

Category Management: The /category clear command helps us more easily manage categories. Because certain mini-events, workshops, etc. take place in their own category of channels, sometimes we want to delete all sub-channels at once. Discord allows you to delete categories, but then all nested channels become uncategorized and appear at the top of the server list, so we made this command to easily delete the nested channels first. We also created /category sync to sync permissions for every channel instead of doing them one by one.

Custom Ticket System: While other bots do offer ticketing system functionality, we wanted ours to work a little differently. With our system, the user will use the /request command to specify the reason for the ticket and others to include in it. We would then approve or reject the ticket.

Invite Management: This system allowed us to track which invite someone joined with, then automatically assign them to a specific role in our server. This made it so we could easily just give judges, workshop speakers, and mentors a different link from participants, and it would reflect that on their profile as soon as they joined.

Random Fact Generation: Because I wanted to make this bot have functionality for users in a fun way, I decided to add a random fact every time someone “says hello” to the bot (using the /hello command). This uses a random facts API to generate the data and returns it to the user.

Scam Checker: Because we list our server publicly around the hackathon season, bot users and spammers will occasionally find it and post scams that while obvious, can be annoying to remove. So, we implemented a scam detection system using pre-trained AI models and began to automatically delete scam messages.

Team Pairing: Since some of our mini-events are done in teams, we wanted a fast way to randomly split up people in the event into different groups. The /category teams command let us quickly specify at most how many people should be in one team, and the bot would create one channel for every team and automatically update the permissions for them to include everyone in the corresponding team.

How it was Built
Node.js Logo JavaScript Logo Jest Logo

The Discord Bot uses the Node.js runtime and takes advantage of the discord.js library. It is written in JavaScript, and all user commands have unit tests written for them using Jest.