April Fools' 2022 - Discord Games Bot (N.O.B.)

At RASA Studios, we like to make a video each year for April Fools’ day. Generally, these take the form of update videos for us and our projects. This year we had an additional twist: we created a Discord bot to allow people to play small versions of some of the games in the Noxsquad Gameshow (inspired by Discord’s Snowball Bot from Winter 2021).

The original idea for the bot was conceived by Stuart, with further input and ideas throughout from Chelsea. Stuart and I started development on the bot, and a little later on, Quinn (Sword) was brought on to help with the project’s infrastructure (hosting, continuous deployment) and bot development. Finally, David and Benedict were brought in to help with writing the script for the event (see the video below) and to help write random responses for the bot.

A number of commands were available for people on the server to use.

  • Team management commands
    In order to be able to take part in games, a team (either blue or yellow) needed to be joined. This unlocked the ability to use all other commands (excluding the admin command).
  • Information commands
    When a game was running, the commands /rules and /episode were unlocked. These allowed players to learn the commands used to interact during the current game, and to watch the game that the current game was inspired by in our YouTube releases of the Noxsquad Gameshow, respectively. Additionally, once the event started, the /scores command was unlocked, which allowed players to see both teams’ current scores.
  • Gameplay commands
    Each game registered its own commands for players to use. This allowed functionality to be tailored to the type of game that was being played and allowed players to more easily understand what action the command they were running would take. This also allowed commands to specify arguments, such as a target to perform an action against.

Each action performed by a player during a game (assuming the command was valid, such as a target being both on a team and on the opposing team) would result in a score value. At the end of a given game, all scores were summed and the team with the greater score won the game. This was then announced to the server, alongside the overall number of games won by each team so far, allowing people to see how their team was performing over the duration of the event.

The bot was written using Discord.js, which was my first real experience using the library - the Discord integration in Jamdroid uses a combination of incoming and outgoing webhooks to implement its functionality. Persistent storage was handled by MongoDB using the Mongoose library and its model abstraction, which differed from my university dissertation project where I was more directly communicating with Mongo itself.

Overall, this was a fun project to work on. Progress was initially slow, as a lot of utility functions and administration commands needed to be implemented first. However once these were in place, the development of the minigames themselves was quite quick and easy, mostly consisting of random outcomes and associated messages for the players.

Written by James Cordon | First published:
Link to this page: https://mrjamesco.uk/projects/discord_games_bot_nob/