Skip to content

Rework command system to add context command and autocomplete support #368

Closed
@Tais993

Description

@Tais993

Is your feature request related to a problem? Please describe.
Discord has added a lot of things, and to use those, we need to update our command system to reflect these changes.

Describe the solution you'd like

Initial proposal

Context commands:

We add BotCommand which extends the UserInteractor added with b9b047a
This interface gets getType, getVisibility and getData.

After that we'll add a MessageContextInteraction and UserContextInteraction interface (for the context menus)
Those 2 and SlashCommand will all implement the BotCommand interface.

Now we will rename SlashCommandVisibility to CommandVisibility

Note, SlashCommand will return SlashCommandData instead of CommandData for the getData method

There will probably also come an abstract class like SlashCommand has for context-command's, but will see that when I go deeper into our system

Autocomplete:

JDA added OptionData#setAutoComplete(boolean). If autocomplete is set to true, Discord will send autocomplete interactions.
Thus, we add onCommandAutoCompleteInteractionEvent(CommandAutoCompleteInteractionEvent) to the SlashCommand
The command has to filter for which option the event is, our command-system will filter for which command.

To-do

  • Rename SlashCommandVisibility to CommandVisibility a0fb71e
  • Move getType, getVisibility and getData to BotCommand a0fb71e
  • Move component ID logic documentation into acceptComponentIdGenerator a0fb71e
  • Add BotCommandAdapter (and move some SlashCommandAdapter method to there) a0fb71e
  • Add ContextCommandAdapter (for the differentation between Message and User context commands)
  • Add MessageContextInteraction + UserContextInteraction a0fb71e
  • Update BotCore
  • Add onAutoComplete to SlashCommand and SlashCommandAdapter a0fb71e
  • Update all documentation
  • Add support for multiple commands of different types with the same name
  • Automatically update commands on start-up (and remove the reload command) e3aa80b
  • Update SlashCommandProvider to become a general CommandProvider e3aa80b

Future:

  • Update JDA
  • onModal method

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requestpriority: majorvalidThis issue/PR is validated and ready to be picked. This auto adds items to TJ project board.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions