Author(s): Wil Aquino
Honorable Mention(s): Turtle, Slate
Creation Date: February 17, 2021
Last Updated: April 1, 2023
Command and Usage Documentation: How To Use Libra - MullowayIT's Bot Documentation
Table of Contents:
- Introduction
- How to Install
- Classes and Data Structures
- Persistence
- Licensing and Rights
Libra is a multi-functional Discord bot designed to handle many tasks, with respect to the Mulloway Institute of Turfing (MIT), a draft server for Nintendo's competitive shooter IP, Splatoon. Her main goal is to keep track of a player database, implement convenience features for running tournaments, and most importantly, host several automated draft systems from beginning (queuing players) to end (reporting scores).
After pulling this project, you can import it using the JetBrains' official IntelliJ Gradle documentation. All dependencies will be imported upon starting up the project with Gradle.
If another IDE or medium is being used, Gradle must be installed to import the project dependencies. If you prefer Maven, the Gradle dependencies listed in build.gradle can be translated.
To fully configure the bot, the credentials listed in the ConfigExample.java class must be filled out in its entirety. Afterwards, the file must be renamed to Config.java
for integration.
The main module to run is Main.java but to start the bot from the console, run the following:
javac *
java src/main/java/bot/Main.java
The entry point of the bot. It constructs the bot and prepares it for processing commands.
String NAME
- the name of the bot.Color mitColor
- the color of MIT.Color freshwatershoalsColor
- the color of Freshwater Shoals.Color launchpointColor
- the color of LaunchPoint.Color inkodysseyColor
- the color of Ink Odyssey.Color inkodysseygraduateColor
- the color of Ink Odyssey graduates.
A class consisting of credential-specific information, pertaining to Discord and the bot's persistence. Due to the credentials of this class, the secrets have been redacted. See ConfigExample.java
for a template.
The class which parses through user-inputted commands, as referenced in Usage
.
Random RANDOM_GENERATOR
- a random number generator for the bot.int MAX_FS_DRAFTS
- the maximum number of Freshwater Shoals drafts.int MAX_LP_DRAFTS
- the maximum number of LaunchPoint drafts.int MAX_IO_DRAFTS
- the maximum number of Ink Odyssey drafts.TreeMap<Integer, Draft> fsDrafts
- a map of numbers/buttons to Freshwater Shoals drafts.TreeMap<Integer, Draft> lpDrafts
- a map of numbers/buttons to LaunchPoint drafts.TreeMap<Integer, Draft> ioDrafts
- a map of numbers/buttons to Ink Odyssey drafts.ArrayHeapMinPQ<Integer> fsQueue
- a queue of numbered Freshwater Shoals drafts.ArrayHeapMinPQ<Integer> lpQueue
- a queue of numbered LaunchPoint drafts.ArrayHeapMinPQ<Integer> lpQueue
- a queue of numbered Ink Odyssey drafts.
A class which builds a minimum heap priority queue (This class is taken from another project and is therefore not detailed here. See the class itself for more details).
A class for storing components used throughout the bot.
A class used as a timer and clock for Discord.
long timerStart
- the starting time of the first timer of the watch.long timerDuration
- how long the first timer of the watch should last.long timerStart2
- the starting time of the second timer of the watch.long timerDuration2
- how long the second timer of the watch should last.
A class which handles files (currently only for saving text).
File file
- an object representation for a text file.
A class which navigates a Google Sheet (spreadsheet).
Sheets sheetsService
- an object representation for the Google Sheets SDK.String spreadsheetID
- the credential ID of the spreadsheet.
A class which builds a button quickly.
Button button
- the button that was built.
A class which builds a selection menu quickly.
SelectionMenu menu
- the menu that was built.
A class which enters players into MIT, processing the command lp/io add
.
A class which awards players roles within MIT, processing the command lp/io award
.
A class which manages Draft Cup (tournament) work, processing the command dc lookup
.
A class which graduates a user in a section within MIT, processing the command lp/io grad
, granting the associated roles.
String TAB
- the tab to reference within the profiles spreadsheet.
A class for parenting MIT section-specific commands.
String name
- the name of this section.String prefix
- the prefix of this section.String role
- the role of this section.String emote
- the emote of this section.Color color
- the color of this section.String gradSheetID
- the graduates spreadsheet ID for this section.String cyclesSheetID
- the Cycles spreadsheet ID for this section.String calculationsSheetID
- the calculations spreadsheet ID for this section.String CYCLES_TAB
- the tab to reference within the Cycles spreadsheet.String CYCLES_START_COLUMN
- the Cycles spreadsheet column that starts the needed information.String CYCLES_END_COLUMN
- the Cycles spreadsheet column that ends the needed information.
A class which automatically updates the draft stats of a user.
A class which manually updates the draft stats of a user by processing the lp/io log
and lp/io sub
commands.
A class for storing information about a player within MIT.
int numRow
- the numbered row of the player's data within their associated draft spreadsheet.String name
- the player's name.String nickname
- the player's nickname on the server.int setWins
- the player's amount of set wins.int setLosses
- the player's amount of set losses.int gamesWon
- the player's amount of won matches.int gamesLost
- the player's amount lost matches.
A class which calculates MIT leaderboard points for cycle changes.
int MINIMUM_SETS
- the number of played sets needed to accrue points.int MAX_CATGEORY_POINTS
- the maximum amount of points per scoring category.int NUM_TOTAL_SCORES
- the total scoring categories to calculate.char SCORE_COLUMNS_START
- the first column where points are inputted.
A class which reverts draft commands, processing the command lp/io undo
.
A class which forms and starts drafts/games.
(Generalized process S and player P)
boolean initialized
- a flag for checking if a draft/game has been initialized.GameProperties properties
- the properties of the draft/game.DiscordWatch watch
- a watch to use throughout the draft/game.int numDraft
- the formal number of the draft/game, with respect to the draft maps inEvents
.TreeMap<String, P> players
- the players of the draft/game.HashSet<String> playerHistory
- a history of players which have entered the draft/game queue at any point.int numInactive
- the number of inactive players within the draft/game.TextChannel draftChat
- the draft chat which this draft/game is linked to.String messageID
- the Discord message ID of the draft/game request.S process
- the formal process for the draft/game's execution.
A class which represents the properties of a draft/game.
GameType gameType
- the type of the draft/game.String name
- the formal name of the draft/game.int playersPerTeam
- the number of players needed on each team.int minimumPlayersToStart
- the minimum number of players to start the draft/game.int maximumPlayersToStart
- the maximum number of players to start the draft/game.int numMatches
- the number of total matches to play in the draft/game.int rotation
- the number of matches to play before rotating teams, if any.int winningScore
- the amount of points needed to win the draft/game.int mapGens
- the number of map generations made for the draft/game.
A class which represents the type of a draft/game.
DRAFT
- a type representations for Drafts (scored).RANKED
- a type representation for Ranked games (unscored).TURF_WAR
- a type representation for Turf War games (unscored).HIDE_AND_SEEK
- a type representation for Hide and Seek games (unscored).JUGGERNAUT
- a type representation for Juggernaut games (unscored).SPAWN_RUSH
- a type representation for Spawn Rush games (unscored).
GameReqs foundDraft
- a draft/game associated with the map generator.int MIN_MAPS
- the minimum number of maps to generate in a single maplist.int MAX_MAPS
- the maximum number of maps to generate in a single maplist.int MAX_DRAFT_MAPLISTS
- the maximum number of map generations for a draft/game.
A class which represents a player within a draft/game.
String name
- the name of the player.boolean active
- a flag for checking whether the player is active in the draft/game or not.boolean teamStatus
- a flag for checking the player's team status.boolean subStatus
- a flag for checking the player's sub status.int subs
- the number of times the player subbed out.
A class for testing teams and players.
A class which formally manages and processes drafts/games.
(Generalized draft/game G and team T)
boolean started
- a flag for checking if the draft/game has started.G game
- the draft/game to be processed.T team1, team2, team3
- the teams of the draft/game.int turn
- the current turn of the draft/game (if used).HashSet<String> endButtonClicked
- the players who have clicked theEnd Draft
button consecutively.String messageID
- the Discord message ID of the draft/game request.
A class which represents a team within a draft/game.
(Generalized player P)
int maxPlayers
- the maximum number of players on a team for a draft/game.TreeMap<String, P>
- the players on a team for a draft/game.int playersNeeded
- the amount of active players a team needs, at any given time, for a draft/game.int minimumScore
- a team's minimum amount of points to gain, if any.int maximumScore
- a team's maximum amount of points to gain, if any.int score
- the team's total score, if any.
A class which forms and starts a draft, processing the command lp/io startdraft
and handling other commands such as lp/io forcesub
, etc.
A class which represents a player within a draft.
1.boolean captainStatus1, captainStatus2
- flags for checking captaincy with respect to the two teams of the draft.
2. int minimumPoints
- the minimum amount of points a player can have.
3. int maximumPoints
- the maximum amount of points a player can have.
4. int matchWins
- the player's match wins during the draft.
5. int matchLosses
- the player's match losses during the draft.
A class which formally manages and processes drafts.
A class which represents a team within a draft.
DraftTeam opponents
- the opponents of the team.
A class which forms and starts a minigame, processing the command fs startdraft
and handling other commands such as fs forcesub
, etc.
1.int cappedSize
- the maximum number of players allowed in the minigame (it becomes capped if the game starts early).
A class which formally manages and processes minigames.
A class for storing information about a player within MIT.
int numRow
- the numbered row of the player's data within their associated draft spreadsheet.String tag
- the player's Discord tag.String nickname
- the player's nickname on the server.String friendcode
- the player's Nintendo Switch friend code.String pronouns
- the player's preferred pronouns.String playstyle
- the player's preferred playstyle.String weapons
- the player's preferred main weapons.String rank
- the player's average rank in-game.String team
- the player's competitive team, if any.
A class which manages the profile database of MIT.
String spreadsheetID
- the profiles spreadsheet ID.String START_COLUMN
- the starting information column of the profiles spreadsheet.String END_COLUMN
- the ending information column of the profiles spreadsheet.String TAB
- the tab to reference within the profiles spreadsheet.Pattern FC_PATTERN
- a pattern for friend codes to strictly follow.Pattern PRONOUNS_PATTERN
- a pattern for pronouns to strictly follow.Pattern WEAPONS_PATTERN
- a pattern for weapons to strictly follow.
A class for testing various aspects of a profile.
A class for constructing gramattical pronouns.
Pattern HE_REGEX
- a pattern for matching pronouns with the phrase "he" in it.Pattern SHE_REGEX
- a pattern for matching pronouns with the phrase "she" in it.Pattern THEY_REGEX
- a pattern for matching pronouns with the phrase "they" in it.Pattern IT_REGEX
- a pattern for matching pronouns with the phrase "it" in it.Pattern ALL_REGEX
- a pattern for matching pronouns with the phrase "all" or "any" in it.Pattern ASK_REGEX
- a pattern for matching pronouns with the phrase "ask" (for pronouns) in it.List<String> subjects
- subjects for a person.List<String> objects
- objects for a person.List<String> possessivePronouns
- possessive pronouns for a person.List<String> possessiveAdjectives
- possessive adjectives for a person.
An interface outlining the format of the bot's command implementations.
A template for classes which forms and starts draft/games.
A template for classes which formally manages and processes draft/games.
The project saves and loads data from Google Sheets spreadsheets, for the ManualLog, Graduate, PointsCalculator, and Profile classes.
These spreadsheets are connected and interacted with using the Google Sheets API, linked through the Gradle components of this project. Feature summary updates are also sent, through the channel the user originally typed commands in, by the bot using the Discord JDA API, also linked through Gradle.
The lp/io undo
commands allows a user to revert a cycle command, by saving and loading the previous cycle command, saved in text files.
The lp/io cyclescalc
commands allow a user to perform a Cycle Top 10 calculation, while updating the section leaderboards.
The mit profile
commands allow a user to create and modify their official MIT profile.
The badwords.txt text file, partially created by nantonakos, is referenced when finding profanity within phrases.
For more info on licensing and copyright, see the information listed under licensing file LICENSE.