Add admin commands for force broken queue and update mmr multiplier #34
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #26.
Description
This work adds admin slash commands for force breaking a queue (removing an active match) and setting the MMR multiplier for the current event.
Re-did the way we track messages sent by Norm. Before we only cared about the one queue embed. Now with force broken queue, we also need to track active match embeds. To do this, I added some event handlers for
messageCreate
andmessageDelete
. OnmessageCreate
we add the message to an array stored locally calledqueueMessages
. OnmessageDelete
we look inqueueMessages
for the same message and remove it from the array if the embed is there.This way we can look through all of the embeds in the queue channel and find the one that's relevant to the admin command when needed.
Changes
AdminController.ts
- Add new commands, refactor to use new message tracking implementation and add new command functionality.Interactions.ts
- Revert back to returning void since the way we track the queue embed has changed inindex.ts
.index.ts
- AddmessageCreate
andmessageDelete
event handlers and logic for keepingqueueMessages
up to date.ActiveMatchRepository.ts
- Slight adjustment to how "player not in an active match" is handled to better align with similar implementations elsewhere in the codebase.EventRepository.ts
- Add method for updating the current event.AdminService.ts
- Add function to handle error checking when setting the mmr multiplier.discordUtils.ts
- Added some functions to help with determining the type of embed that was sent. It matches based off color. I'm not a fan of doing it this way, but I couldn't think of a better solution. I even asked the Discord.js Discord and got very little help. To ease my worry I added some unit tests to make sure these checks work the way we expect.