Class ApplicationCommandBuilder<R extends ApplicationCommand,​D extends ApplicationCommandBuilderDelegate<R>,​T extends ApplicationCommandBuilder<R,​D,​T>>

    • Constructor Detail

      • ApplicationCommandBuilder

        protected ApplicationCommandBuilder​(D delegate)
    • Method Detail

      • setName

        public T setName​(java.lang.String name)
        Sets the name of the message context menu.
        Parameters:
        name - The name.
        Returns:
        The current instance in order to chain call methods.
      • addNameLocalization

        public T addNameLocalization​(DiscordLocale locale,
                                     java.lang.String localization)
        Adds a name localization for the given locale.
        Parameters:
        locale - The locale to add this localization for.
        localization - The command name localization.
        Returns:
        The current instance in order to chain call methods.
      • setDescription

        public T setDescription​(java.lang.String description)
        Sets the description of the slash command.
        Parameters:
        description - The description.
        Returns:
        The current instance in order to chain call methods.
      • addDescriptionLocalization

        public T addDescriptionLocalization​(DiscordLocale locale,
                                            java.lang.String localization)
        Adds a description localization for the given locale.
        Parameters:
        locale - The locale to add a localization for.
        localization - The command description localization.
        Returns:
        The current instance in order to chain call methods.
      • setDefaultEnabledForPermissions

        public T setDefaultEnabledForPermissions​(PermissionType... requiredPermissions)
        Sets the default required permissions to be able to use this command. Passing no arguments will cause the command to be available to admins only. This can later be overridden by server admins.
        Parameters:
        requiredPermissions - The required permissions to use this command.
        Returns:
        The current instance in order to chain call methods.
      • setDefaultEnabledForPermissions

        public T setDefaultEnabledForPermissions​(java.util.EnumSet<PermissionType> requiredPermissions)
        Sets the default required permissions to be able to use this command. Passing no arguments will cause the command to be available to admins only. This can later be overridden by server admins.
        Parameters:
        requiredPermissions - The required permissions to use this command.
        Returns:
        The current instance in order to chain call methods.
      • setDefaultEnabledForEveryone

        public T setDefaultEnabledForEveryone()
        Enables this command for use by all users. This can later be overridden by server admins.
        Returns:
        The current instance in order to chain call methods.
      • setDefaultDisabled

        public T setDefaultDisabled()
        Sets whether this command should be disabled and only usable by server administrators by default. This can later be overridden by server administrators.
        Returns:
        Whether this command is disabled by default.
      • setEnabledInDms

        public T setEnabledInDms​(boolean enabledInDms)
        Sets whether this command is able to be used in DMs. By default, this is true This has no effect on server commands.
        Parameters:
        enabledInDms - Whether the command is enabled in DMs
        Returns:
        The current instance in order to chain call methods.
      • getDelegate

        public D getDelegate()
        Gets the delegate used by the application command builder internally.
        Returns:
        The delegate used by this application command builder internally.
      • createGlobal

        public java.util.concurrent.CompletableFuture<R> createGlobal​(DiscordApi api)
        Creates a global application command. When used to update multiple global slash commands at once DiscordApi.bulkOverwriteGlobalApplicationCommands(List) should be used instead.
        Parameters:
        api - The discord api instance.
        Returns:
        The built application command.
      • createForServer

        public java.util.concurrent.CompletableFuture<R> createForServer​(Server server)
        Creates an application command for a specific server. When used to create multiple server application commands at once DiscordApi.bulkOverwriteServerApplicationCommands(Server, List) should be used instead.
        Parameters:
        server - The server.
        Returns:
        The built application command.
      • createForServer

        public java.util.concurrent.CompletableFuture<R> createForServer​(DiscordApi api,
                                                                         long server)
        Creates an application command for a specific server. When used to create multiple server application commands at once DiscordApi.bulkOverwriteServerApplicationCommands(Server, List) should be used instead.
        Parameters:
        api - The discord api instance.
        server - The server.
        Returns:
        The built application command.