Class SlashCommand
java.lang.Object
xyz.dynxsty.dih4jda.interactions.commands.CommandRequirements
xyz.dynxsty.dih4jda.interactions.commands.BaseCommandRequirements
xyz.dynxsty.dih4jda.interactions.commands.SlashCommand
Represents a single Slash Command.
- Since:
- v1.5
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classModel class which represents a single Subcommand. -
Method Summary
Modifier and TypeMethodDescriptionfinal voidaddSubcommandGroups(Map<net.dv8tion.jda.api.interactions.commands.build.SubcommandGroupData, Set<SlashCommand.Subcommand>> groups) Sets all Subcommand Groups that belong to this "base" command.final voidaddSubcommands(SlashCommand.Subcommand... classes) Sets all Subcommands that belong to this "base" command.voidexecute(net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent event) Method that should be overridden for all Slash Commands that should be executed.final net.dv8tion.jda.api.interactions.commands.build.SlashCommandDatafinal Map<net.dv8tion.jda.api.interactions.commands.build.SubcommandGroupData,Set<SlashCommand.Subcommand>> final Set<SlashCommand.Subcommand>final voidsetSlashCommandData(net.dv8tion.jda.api.interactions.commands.build.SlashCommandData commandData) Sets this commands'SlashCommandData.Methods inherited from class xyz.dynxsty.dih4jda.interactions.commands.BaseCommandRequirements
blacklistGuilds, getGuilds, getRegistrationType, setRegistrationType, whitelistGuildsMethods inherited from class xyz.dynxsty.dih4jda.interactions.commands.CommandRequirements
getRequiredPermissions, getRequiredRoles, getRequiredUsers, requirePermissions, requireRoles, requireUsers
-
Method Details
-
execute
public void execute(net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent event) Method that should be overridden for all Slash Commands that should be executed.public class PingCommand extends SlashCommand { public PingCommand() { setCommandData(Commands.slash("ping", "Ping!")); } @Override public void execute(SlashCommandInteractionEvent event) { event.reply("Pong!").queue(); } }- Since:
- v1.5
-
getSlashCommandData
public final net.dv8tion.jda.api.interactions.commands.build.SlashCommandData getSlashCommandData() -
setSlashCommandData
public final void setSlashCommandData(net.dv8tion.jda.api.interactions.commands.build.SlashCommandData commandData) Sets this commands'SlashCommandData.- Parameters:
commandData- TheSlashCommandDatawhich should be used for this command.
-
getSubcommands
-
addSubcommands
Sets all Subcommands that belong to this "base" command.- Parameters:
classes- The classes (must extendSlashCommand.Subcommand) which should be registered as subcommands.
-
getSubcommandGroups
public final Map<net.dv8tion.jda.api.interactions.commands.build.SubcommandGroupData,Set<SlashCommand.Subcommand>> getSubcommandGroups() -
addSubcommandGroups
public final void addSubcommandGroups(Map<net.dv8tion.jda.api.interactions.commands.build.SubcommandGroupData, Set<SlashCommand.Subcommand>> groups) Sets all Subcommand Groups that belong to this "base" command.- Parameters:
groups- A map of theSubcommandGroupDataand their correspondingSlashCommand.Subcommands.
-