Package org.javacord.api.interaction
Class ApplicationCommandUpdater<T extends ApplicationCommand,D extends ApplicationCommandUpdaterDelegate<T>,B extends ApplicationCommandUpdater<T,D,B>>
- java.lang.Object
-
- org.javacord.api.interaction.ApplicationCommandUpdater<T,D,B>
-
- Direct Known Subclasses:
MessageContextMenuUpdater,SlashCommandUpdater,UserContextMenuUpdater
public abstract class ApplicationCommandUpdater<T extends ApplicationCommand,D extends ApplicationCommandUpdaterDelegate<T>,B extends ApplicationCommandUpdater<T,D,B>> extends java.lang.Object
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedApplicationCommandUpdater(D delegate)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description BaddDescriptionLocalization(DiscordLocale locale, java.lang.String localization)Adds a description localization for the given locale.BaddNameLocalization(DiscordLocale locale, java.lang.String localization)Adds a name localization for the given locale.DgetDelegate()Gets the delegate used by the application command updater internally.BsetDefaultDisabled()Sets whether this command should be disabled and only usable by server administrators by default.BsetDefaultEnabledForEveryone()Enables this command for use by all users.BsetDefaultEnabledForPermissions(java.util.EnumSet<PermissionType> requiredPermissions)Sets the default required permissions to be able to use this command.BsetDefaultEnabledForPermissions(PermissionType... requiredPermissions)Sets the default required permissions to be able to use this command.BsetDescription(java.lang.String description)Sets the new description of the slash command.BsetEnabledInDms(boolean enabledInDms)Sets whether this command is able to be used in DMs.BsetName(java.lang.String name)Sets the new name of the application command.java.util.concurrent.CompletableFuture<T>updateForServer(DiscordApi api, long server)Updates an application command on the given server.java.util.concurrent.CompletableFuture<T>updateForServer(Server server)Updates an application command on the given server.java.util.concurrent.CompletableFuture<T>updateGlobal(DiscordApi api)Updates a global application command.
-
-
-
Constructor Detail
-
ApplicationCommandUpdater
protected ApplicationCommandUpdater(D delegate)
-
-
Method Detail
-
setName
public B setName(java.lang.String name)
Sets the new name of the application command.- Parameters:
name- The name to set.- Returns:
- The current instance in order to chain call methods.
-
addNameLocalization
public B addNameLocalization(DiscordLocale locale, java.lang.String localization)
Adds a name localization for the given locale.- Parameters:
locale- The locale to add a localization for.localization- The localization.- Returns:
- The current instance in order to chain call methods.
-
setDescription
public B setDescription(java.lang.String description)
Sets the new description of the slash command.- Parameters:
description- The description to set.- Returns:
- The current instance in order to chain call methods.
-
addDescriptionLocalization
public B addDescriptionLocalization(DiscordLocale locale, java.lang.String localization)
Adds a description localization for the given locale.- Parameters:
locale- The locale to add this localization for.localization- The command description localization.- Returns:
- The current instance in order to chain call methods.
-
setDefaultEnabledForPermissions
public B 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 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 B 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 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 B 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 B 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 B setEnabledInDms(boolean enabledInDms)
Sets whether this command is able to be used in DMs. By default, this istrueThis 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.
-
updateGlobal
public java.util.concurrent.CompletableFuture<T> updateGlobal(DiscordApi api)
Updates a global application command. When used to update multiple global application commands at onceDiscordApi.bulkOverwriteGlobalApplicationCommands(List)should be used instead.- Parameters:
api- The DiscordApi instance.- Returns:
- The updated application command.
-
updateForServer
public java.util.concurrent.CompletableFuture<T> updateForServer(Server server)
Updates an application command on the given server. When used to update multiple server application commands at onceDiscordApi.bulkOverwriteServerApplicationCommands(Server, List)should be used instead.- Parameters:
server- The server where the command should be updated.- Returns:
- The updated application command.
-
updateForServer
public java.util.concurrent.CompletableFuture<T> updateForServer(DiscordApi api, long server)
Updates an application command on the given server. When used to update multiple server application commands at onceDiscordApi.bulkOverwriteServerApplicationCommands(Server, List)should be used instead.- Parameters:
api- The DiscordApi instance.server- The server where the command should be updated.- Returns:
- The updated application command.
-
getDelegate
public D getDelegate()
Gets the delegate used by the application command updater internally.- Returns:
- The delegate used by this application command updater internally.
-
-