Skip to content

Conversation

@ghost
Copy link

@ghost ghost commented Feb 10, 2024

ViBot

Changelog

Features

Complete Headcount rewrite

  • Added headcount as a slash command /hc <type> [length] [duration]
    • type is autocomplete and will provide a list of matching templates you can run in the channel
      • If they use the alias anyways instead of a full number, it will still match it
    • duration is autocomplete for Seconds Minutes and Hours, also accepts partial text
  • Asks to confirm sending headcount if there are active headcounts matching certain criteria
    • 2 or more active headcounts already in the relative status channel
    • Any active headcount in the relative status channel using the same template
    • Any active headcount the leader has up in the server
    • Any active AFK checks in the relative status channel
  • Added commands channel panel if headcount was provided timeout options
    • No panel if used plainly ;hc v since cannot clarify when it should stop sending items over
      • If maybe it should default to some time so they all have a panel, that might be good too but I opted out of that for now (easy to change)
    • Displays short lists of reacts, who reacted to key, etc.
    • Has two buttons 'Convert to AFK' and 'Abort'
    • Convert to AFK - Attempts to process an afk check from a headcount panel
      • Will pop up with a modal asking for location, unsure if this should instead be requested in chat, easy to change
      • Then, processes an afk check as if you ran ;afk <type> <location>

Changes

.eslintignore

  • removed commands/headcount.js

botSetup.js

  • Added headcount initialization

commands/afkCheck.js

  • Added class afkCheck in module.exports
  • Added leader = message.member argument to afkCheck.ctor to provide a different GuildMember than what's attached to the message argument for headcount conversion.
  • Added panelReply parameter to afkCheck.start to provide a message to reply to instead of only sending it in commands channel (for headcount conversion)
  • Added replyTo parameter for afkCheck.sendInitialStatusMessage to provide a message to reply to instead of only sending it in status channel (for headcount conversion)
  • Added many JSDoc comments for better Intellisense typings

commands/afkTemplate.js

  • Provided a getter for the underlying template (used to serialize headcounts & avoid mismatching with an updated template on restart)
  • Updated #validateTemplateEmote and #processReacts to consider if the template provided has previously ran #processReacts (this happens when loading one from redis)
  • Added AfkTemplate.getRandomThumbnail() to return a random thumbnail from the body
  • Added many JSDoc comments for better Intellisense typings
  • Added getter for AfkTemplate.#template
    commands/templates.js
  • For testing bots who might not be in all emote servers, add a null chain on bot.storedEmojis[...].text in case the emoji wasn't loaded

index.js

  • Calls handleHeadcountRow if handleReactionRow returns false to check if it's a headcount reaction

commands/templates.js

  • Add null-chain for testing bots that might not have all emojis loaded.

commands/headcount.js

  • Completely rewritten, functional changes described under Features

Bugs

  • Should stop headcounts with the timeout argument from causing rate limits

Quality of Life

  • Various JSDoc additions
  • Convert to Afk button for headcounts
  • Confirm to not contest other headcounts

Examples

/hc 'Ocean Trench' 5 Minutes

Commands Channel panel
image
Status Channel message
image
Aborted Headcount panel
image

/hc 'v' - headcount with no timeout given

Confirmation if existing headcount from leader
image
Cancel confirmation
image
Commands Channel panel
image
Status Channel message
image

*hc so 2 m

Converted Headcount asks for location
image
Headcount panel & afk panel
image
Raid status channel
image

*hc v 2 m with a void headcount + 1 in rsa and +1 in vet status

image
with an active afk check
image

husky-rotmg added 4 commits February 5, 2024 20:28
templates.js - in case an emoji is not found (mostly for testing bots not in all emoji servers)
headcount.js - reworked execute portion, now is a slash command as well

As discussed with Sauron, will be adding headcount timeout & adding a commands channel panel for timeoutable headcounts
@ghost ghost added Bug A fix for something that does not work as intended Change A modification to something that exists dependencies Pull requests that update a dependency file Feature A new piece of functionality that has been introduced Lost Halls This relates to the Discord Guild named "Lost Halls" Quality of Life An improvement of something that exists Shatters/Moonlight This relates to the Discord Guild named "Shatters/Moonlight" labels Feb 10, 2024
husky-rotmg added 5 commits February 10, 2024 14:31
headcounts.js
- Removed mutex and instead each headcount has its own timeout.
- Uses local cache - redis used to load headcounts on restart
- Warns user about putting up extra headcounts depending on active in channel/by user/by run
- moved module.exports to the bottom

afkCheck.js
- Added JSDoc typings for intellisense

afkTemplate.js
- Added JSDoc typings for intellisense

index.js
- No longer need to pass bot to handleHeadcountRow

package.json
- Removed async-mutex
- Forgot to add BodyEmbed typing
- Changed confirm send headcount embed color to run color
- Make sure to explicitly remove components on no-timeout panel
@ghost ghost changed the title [ON HOLD] Husky/headcount rework [READY FOR REVIEW] Husky/headcount rework Feb 12, 2024
@ghost ghost marked this pull request as ready for review February 12, 2024 04:18
@ghost ghost self-requested a review as a code owner February 12, 2024 04:18
@ghost
Copy link
Author

ghost commented Feb 12, 2024

This is now fully ready for review after considerations mentioned in #dev-lounge

@ghost ghost self-assigned this Feb 12, 2024
@ghost ghost removed the dependencies Pull requests that update a dependency file label Feb 12, 2024
@Ragviswa Ragviswa changed the title [READY FOR REVIEW] Husky/headcount rework Husky/headcount rework Feb 12, 2024
husky-rotmg added 6 commits February 12, 2024 15:52
- Removed usage of `handleHeadcountRow` in index
- Utilize `createReactionRow` to handle button interactions
- Added check for any afks in status channel
- Slight formatting changes in confirmation
- made afkChecks.timerSecondsRemaining public for headcount confirmations
Copy link
Contributor

@Huntifer-RotMG Huntifer-RotMG left a comment

Choose a reason for hiding this comment

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

Not a detailed review, will try and write more later but I would strongly prefer if we didn't add hundreds of lines of (questionably valid JSDoc)

@Thomasc33 Thomasc33 unassigned ghost Mar 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug A fix for something that does not work as intended Change A modification to something that exists Feature A new piece of functionality that has been introduced Lost Halls This relates to the Discord Guild named "Lost Halls" Quality of Life An improvement of something that exists Shatters/Moonlight This relates to the Discord Guild named "Shatters/Moonlight"

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Commands like ;headcount with the time arguments and ;afk Raid Status Embeds cause rate-limiting to sending Messages

1 participant