Class GuildCommandRegistrar


  • public class GuildCommandRegistrar
    extends Object
    A simple way to register a set of application command definitions to guilds. Use create(RestClient, List) to build one.
    • Method Detail

      • create

        public static GuildCommandRegistrar 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(Snowflake).
        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(Snowflake)
      • registerCommands

        public Flux<discord4j.discordjson.json.ApplicationCommandData> registerCommands​(Snowflake guildId)
        Submit the command definitions to Discord to register each application command in the given guild.
        Parameters:
        guildId - the guild chosen for command registration
        Returns:
        a Flux with each command registration response from Discord if successful