Class 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 Detail

      • 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