Case Study Page

project thumbnail

Venezium

A Discord bot with a custom XP system & that handles group ranking on Roblox

Year

2022

Type

Personal Project

Role

Solo Developer

Project goal

The goal was to create a Discord bot that would allow users to check their XP (experience points) directly in the Discord server through the bot. For context, the Discord bot was for a military-style group on Roblox where you can earn XP by attending events and be promoted to a new rank based on how much XP you have.

The purpose of this bot would be to handle their XP system and automate promotions on Roblox. This involved making it possible for the group to track how much XP each member has and award XP to members, along with having the bot automatically promote members in the Roblox group once they had enough XP.

Technologies Used

I used Node.js for the functionality of the bot, Airtable for the database (I used their API for performing the CRUD operations), Autocode for hosting the bot, and Google Apps Script for the functionality of the Discord webhook and integration of Google Forms to Airtable.

How it was created

Before I started coding, I began writing the pseudocode for the command of the bot that would allow users to check their XP. To run the command they would need to specify the username which would be passed as a parameter. I would need to make several calls to the Roblox API to fetch information based on the parameter provided. The first being to check whether or not the username is valid. If it is, then it should fetch the Roblox account ID from the API as this is the value that is going to be used to retrieve how much XP a member has from the database. If the user doesn't exist in the database yet, then it should create a profile for them first before returning anything to the user. I would also need to make calls to the Roblox API to fetch the group rank and thumbnail of the user, and another that fetches all of the roles in the group. Their current group rank would be used to calculate their progression in the group and indicate how much more XP they need to rank up to the next rank.

I was initially planning on adding a command for staff to add XP through the Discord but I decided to simplify the process of adding XP. Since they were already using a Google Form to log events they hosted, I added a field in the form so that they could put the usernames of the attendees. Upon submitting the form, XP would automatically be awarded to the attendees. This was done through Google Apps Script by adding a trigger for when the form is submitted and then processing the usernames and using the Airtable API to write to the database. The script also calculates the new XP total for each attendee and checks if they have enough XP to be promoted to the next rank; if they do, it uses the Roblox API (PATCH request) to change their rank in the group. If the request fails for whatever reason, it sends a message to their staff through a webhook to notify them which users need to be promoted. Each time XP is added, an automated message that indicates this is also sent to a channel in their Discord server through a webhook.

project imageproject imageproject imageproject imageproject image

Thanks for checking out my case study.

Here are some of my other projects & work.

If you like what you see and think I'd be a good fit for your next project, I'd love to chat!