Class SlashCommand
java.lang.Object
xyz.dynxsty.dih4jda.interactions.commands.RestrictedCommand
xyz.dynxsty.dih4jda.interactions.commands.application.ApplicationCommand<E,T>
xyz.dynxsty.dih4jda.interactions.commands.application.BaseApplicationCommand<net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent,net.dv8tion.jda.api.interactions.commands.build.SlashCommandData>
xyz.dynxsty.dih4jda.interactions.commands.application.SlashCommand
- All Implemented Interfaces:
ExecutableCommand<net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent>
public abstract class SlashCommand
extends BaseApplicationCommand<net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent,net.dv8tion.jda.api.interactions.commands.build.SlashCommandData>
Represents a single Slash Command.
- Since:
- v1.5
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classModel class which represents a single Subcommand.static classModel class which represents a single subcommand group.Nested classes/interfaces inherited from class xyz.dynxsty.dih4jda.interactions.commands.RestrictedCommand
RestrictedCommand.Cooldown -
Method Summary
Modifier and TypeMethodDescriptionfinal voidaddSubcommandGroups(SlashCommand.SubcommandGroup... groups) AddsSlashCommand.SubcommandGroups to thisSlashCommand.final voidaddSubcommands(SlashCommand.Subcommand... classes) AddsSlashCommand.Subcommands to thisSlashCommand.net.dv8tion.jda.api.interactions.commands.CommandGets the correspondingJDA entityfor this command.voidexecute(net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent event) The method that gets called once the command gets executed.final SlashCommand.SubcommandGroup[]Returns an array of allSlashCommand.SubcommandGroups this command contains.final SlashCommand.Subcommand[]Returns an array of allSlashCommand.Subcommands this command contains.Methods inherited from class xyz.dynxsty.dih4jda.interactions.commands.application.BaseApplicationCommand
getQueueableGuilds, getRegistrationType, setQueueableGuilds, setRegistrationTypeMethods inherited from class xyz.dynxsty.dih4jda.interactions.commands.application.ApplicationCommand
getCommandData, setCommandDataMethods inherited from class xyz.dynxsty.dih4jda.interactions.commands.RestrictedCommand
applyCooldown, getCommandCooldown, getRequiredGuilds, getRequiredPermissions, getRequiredRoles, getRequiredUsers, hasCooldown, retrieveCooldown, setCommandCooldown, setRequiredGuilds, setRequiredPermissions, setRequiredRoles, setRequiredUsers
-
Method Details
-
getSubcommands
Returns an array of allSlashCommand.Subcommands this command contains.- Returns:
- An
SlashCommand.Subcommand-array.
-
addSubcommands
AddsSlashCommand.Subcommands to thisSlashCommand.- Parameters:
classes- Instances of theSlashCommand.Subcommands to add.
-
getSubcommandGroups
Returns an array of allSlashCommand.SubcommandGroups this command contains.- Returns:
- An
SlashCommand.SubcommandGroup-array.
-
addSubcommandGroups
AddsSlashCommand.SubcommandGroups to thisSlashCommand.- Parameters:
groups- Instances of theSlashCommand.SubcommandGroupclass.
-
execute
public void execute(@Nonnull net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent event) Description copied from interface:ExecutableCommandThe method that gets called once the command gets executed.- Parameters:
event- the command that is getting passed.
-
asCommand
@Nonnull public net.dv8tion.jda.api.interactions.commands.Command asCommand()Gets the correspondingJDA entityfor this command. If the command was not cached or queued before (e.g. when using sharding), this may return null.- Returns:
- The
Commandcorresponding to this class.
-