Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add admin commands for force broken queue and update mmr multiplier #34

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

mattwells19
Copy link
Owner

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 and messageDelete. On messageCreate we add the message to an array stored locally called queueMessages. On messageDelete we look in queueMessages 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 in index.ts.
  • index.ts - Add messageCreate and messageDelete event handlers and logic for keeping queueMessages 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.

Copy link
Collaborator

@duanekord duanekord left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add ability for admins to force break a queue and set the mmr multiplier
2 participants