Class SlashCommand
java.lang.Object
xyz.dynxsty.dih4jda.interactions.commands.RestrictedCommand
xyz.dynxsty.dih4jda.interactions.commands.application.ApplicationCommand<net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent,net.dv8tion.jda.api.interactions.commands.build.SlashCommandData>
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
Modifier and TypeClassDescriptionstatic class
Model class which represents a single Subcommand.static class
Model 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 void
addSubcommandGroups
(SlashCommand.SubcommandGroup... groups) AddsSlashCommand.SubcommandGroup
s to thisSlashCommand
.final void
addSubcommands
(SlashCommand.Subcommand... classes) AddsSlashCommand.Subcommand
s to thisSlashCommand
.net.dv8tion.jda.api.interactions.commands.Command
Gets the correspondingJDA entity
for this command.void
execute
(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.SubcommandGroup
s this command contains.final SlashCommand.Subcommand[]
Returns an array of allSlashCommand.Subcommand
s this command contains.Methods inherited from class xyz.dynxsty.dih4jda.interactions.commands.application.BaseApplicationCommand
getQueueableGuilds, getRegistrationType, setQueueableGuilds, setRegistrationType
Methods inherited from class xyz.dynxsty.dih4jda.interactions.commands.application.ApplicationCommand
getCommandData, setCommandData
Methods 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.Subcommand
s this command contains.- Returns:
- An
SlashCommand.Subcommand
-array.
-
addSubcommands
AddsSlashCommand.Subcommand
s to thisSlashCommand
.- Parameters:
classes
- Instances of theSlashCommand.Subcommand
s to add.
-
getSubcommandGroups
Returns an array of allSlashCommand.SubcommandGroup
s this command contains.- Returns:
- An
SlashCommand.SubcommandGroup
-array.
-
addSubcommandGroups
AddsSlashCommand.SubcommandGroup
s to thisSlashCommand
.- Parameters:
groups
- Instances of theSlashCommand.SubcommandGroup
class.
-
execute
public void execute(@Nonnull net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent event) Description copied from interface:ExecutableCommand
The 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 entity
for this command. If the command was not cached or queued before (e.g. when using sharding), this may return null.- Returns:
- The
Command
corresponding to this class.
-