Package discord4j.rest.interaction
Class GlobalCommandRegistrar
java.lang.Object
discord4j.rest.interaction.GlobalCommandRegistrar
A simple way to register a set of application command definitions globally. Use
create(RestClient, List)
to build one.-
Method Summary
Modifier and TypeMethodDescriptionstatic GlobalCommandRegistrarcreate(RestClient restClient, List<discord4j.discordjson.json.ApplicationCommandRequest> commandRequests) Create a registrar using a list ofApplicationCommandRequestentries.Flux<discord4j.discordjson.json.ApplicationCommandData>Submit the command definitions to Discord to register each application command globally.
-
Method Details
-
create
public static GlobalCommandRegistrar create(RestClient restClient, List<discord4j.discordjson.json.ApplicationCommandRequest> commandRequests) Create a registrar using a list ofApplicationCommandRequestentries. Run the command registration process by subscribing toregisterCommands().- Parameters:
restClient- a Discord web client to perform API requestscommandRequests- a list of command definitions- Returns:
- a registrar that can register application commands by subscribing to
registerCommands()
-
registerCommands
Submit the command definitions to Discord to register each application command globally.- Returns:
- a Flux with each command registration response from Discord if successful
-