Skip to content
This repository has been archived by the owner on Jul 11, 2024. It is now read-only.

feat: get/list commands, bulk set & fix update/delete #529

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

lrstanley
Copy link

@lrstanley lrstanley commented May 11, 2023

Description

  • Add Get() to the ApplicationCommands query builder, for fetching an individual application command.
  • Add Commands() to the ApplicationCommands query builder, for fetching all application commands.
  • Add various missing fields for ApplicationCommand, CreateApplicationCommand, and UpdateApplicationCommand.
  • Add BulkOverwrite() to the ApplicationCommands query builder, which allows overwriting all commands (global and guild still separate). Naming was defined by how it's described here.
  • Fix Update() and Delete() on ApplicationCommands query builder, where the generated URL didn't include / as the prefix, leading to a malformed request.

One of the big items I think with this change, is most users likely should shift to using BulkOverwrite(), which effectively defines all of their commands. The downside with the currently documented example is that if commands are added, then removed from the array, they never actually get removed from the application and/or guild.

There are three items I'm still not sure about.

  • The naming of Get() for singular, and Commands() for listing. I skimmed through some of the other builders/methods and wasn't sure what was best for naming standards to differentiate 1 vs many.
  • Commands() should probably accept an input, which allows the command list to include localized names and descriptions. I wasn't sure if:
    1. It should just default to enabling that (can't be much additional query data?)
    2. If an Option struct of some kind should be used. If this is the best option, not sure on best naming, as I don't see many of these types of structs across the project.
    3. If this should somehow be built into the query builder as an additional method.
  • Should I update the command examples to use BulkOverwrite()?

Breaking Change?

no

Checklist:

  • I have performed a self-review of my own code
  • Commented complex situations or referenced the discord documentation
  • Updated documentation
  • Added/Updated unit tests
  • Added/Updated benchmarks (if this is a performance critical component)

@lrstanley lrstanley force-pushed the feature/get-commands branch from a6423e1 to 20f6314 Compare May 14, 2023 04:08
@lrstanley lrstanley force-pushed the feature/get-commands branch from 20f6314 to 65522b0 Compare May 14, 2023 04:09
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant