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. Use create(RestClient, List) to build one.
  • Method Details

    • create

      public static GlobalCommandRegistrar create(RestClient restClient, List<discord4j.discordjson.json.ApplicationCommandRequest> commandRequests)
      Create a registrar using a list of ApplicationCommandRequest entries. Run the command registration process by subscribing to registerCommands().
      Parameters:
      restClient - a Discord web client to perform API requests
      commandRequests - 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