Package discord4j.rest.interaction
Class GlobalCommandRegistrar
- java.lang.Object
-
- discord4j.rest.interaction.GlobalCommandRegistrar
-
public class GlobalCommandRegistrar extends Object
A simple way to register a set of application command definitions globally. Usecreate(RestClient, List)to build one.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static GlobalCommandRegistrarcreate(RestClient restClient, List<discord4j.discordjson.json.ApplicationCommandRequest> commandRequests)Create a registrar using a list ofApplicationCommandRequestentries.Flux<discord4j.discordjson.json.ApplicationCommandData>registerCommands()Submit the command definitions to Discord to register each application command globally.
-
-
-
Method Detail
-
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
public Flux<discord4j.discordjson.json.ApplicationCommandData> 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
-
-