Package org.javacord.api.interaction
Class SlashCommandBuilder
- java.lang.Object
-
- org.javacord.api.interaction.SlashCommandBuilder
-
public class SlashCommandBuilder extends Object
This class is used to create new slash commands.
-
-
Constructor Summary
Constructors Constructor Description SlashCommandBuilder()Creates a new slash command builder.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SlashCommandBuilderaddOption(SlashCommandOption option)Adds an slash command option to the slash command.CompletableFuture<SlashCommand>createForServer(Server server)Creates an slash command for a specific server.CompletableFuture<SlashCommand>createGlobal(DiscordApi api)Creates a global slash command.SlashCommandBuilderDelegategetDelegate()Gets the delegate used by the slash command builder internally.SlashCommandBuildersetDefaultPermission(Boolean defaultPermission)Sets the default permission for the slash command whether the command is enabled by default when the app is added to a server.SlashCommandBuildersetDescription(String description)Sets the description of the slash command.SlashCommandBuildersetName(String name)Sets the name of the slash command.SlashCommandBuildersetOptions(List<SlashCommandOption> options)Sets the slash commands for the slash command.
-
-
-
Method Detail
-
setName
public SlashCommandBuilder setName(String name)
Sets the name of the slash command.- Parameters:
name- The name.- Returns:
- The current instance in order to chain call methods.
-
setDescription
public SlashCommandBuilder setDescription(String description)
Sets the description of the slash command.- Parameters:
description- The name.- Returns:
- The current instance in order to chain call methods.
-
addOption
public SlashCommandBuilder addOption(SlashCommandOption option)
Adds an slash command option to the slash command.- Parameters:
option- The option.- Returns:
- The current instance in order to chain call methods.
-
setOptions
public SlashCommandBuilder setOptions(List<SlashCommandOption> options)
Sets the slash commands for the slash command.- Parameters:
options- The options.- Returns:
- The current instance in order to chain call methods.
-
setDefaultPermission
public SlashCommandBuilder setDefaultPermission(Boolean defaultPermission)
Sets the default permission for the slash command whether the command is enabled by default when the app is added to a server.- Parameters:
defaultPermission- The default permission.- Returns:
- The current instance in order to chain call methods.
-
createGlobal
public CompletableFuture<SlashCommand> createGlobal(DiscordApi api)
Creates a global slash command. When used to update multiple global slash commands at onceDiscordApi.bulkOverwriteGlobalSlashCommands(List)should be used instead.- Parameters:
api- The discord api instance.- Returns:
- The built slash command.
-
createForServer
public CompletableFuture<SlashCommand> createForServer(Server server)
Creates an slash command for a specific server. When used to create multiple server slash commands at onceDiscordApi.bulkOverwriteServerSlashCommands(Server, List)(List)} should be used instead.- Parameters:
server- The server.- Returns:
- The built slash command.
-
getDelegate
public SlashCommandBuilderDelegate getDelegate()
Gets the delegate used by the slash command builder internally.- Returns:
- The delegate used by this slash command builder internally.
-
-