Class SlashCommand
java.lang.Object
net.dv8tion.jda.api.hooks.ListenerAdapter
io.github.yusufsdiscordbot.yusufsdiscordcore.bot.handlers.extensions.SlashCommand
- All Implemented Interfaces:
net.dv8tion.jda.api.hooks.EventListener
public abstract class SlashCommand
extends net.dv8tion.jda.api.hooks.ListenerAdapter
Used when making a new command. Imports all the need methods into a new class.
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedSlashCommand(String name, String description, boolean isGuildOnly, CommandType... commandType) Were the command is registered. -
Method Summary
Modifier and TypeMethodDescriptionbooleanUsed to determine whether the command is Global(can be used on all servers) or whether it is only a Guild command(can only be used in specific servers)Used to determine what type of command it is.final StringProvides the user information on what the command is about.final StringgetName()Provides the user with name of the commandfinal @NotNull net.dv8tion.jda.api.interactions.commands.build.SlashCommandDataRetrieves all the slash command data such as the name and description of the command.voidonButtonInteraction(net.dv8tion.jda.api.events.interaction.component.ButtonInteractionEvent event) voidonSelectMenuInteraction(net.dv8tion.jda.api.events.interaction.component.SelectMenuInteractionEvent event) abstract voidonSlashCommand(YSlashCommandInteractionEvent yusufSlashCommandEvent) Used when creating a new slash command.Methods inherited from class net.dv8tion.jda.api.hooks.ListenerAdapter
onChannelCreate, onChannelDelete, onChannelUpdateArchived, onChannelUpdateArchiveTimestamp, onChannelUpdateAutoArchiveDuration, onChannelUpdateBitrate, onChannelUpdateInvitable, onChannelUpdateLocked, onChannelUpdateName, onChannelUpdateNSFW, onChannelUpdateParent, onChannelUpdatePosition, onChannelUpdateRegion, onChannelUpdateSlowmode, onChannelUpdateTopic, onChannelUpdateType, onChannelUpdateUserLimit, onCommandAutoCompleteInteraction, onDisconnect, onEmoteAdded, onEmoteRemoved, onEmoteUpdateName, onEmoteUpdateRoles, onEvent, onException, onGatewayPing, onGenericAutoCompleteInteraction, onGenericChannel, onGenericChannelUpdate, onGenericCommandInteraction, onGenericComponentInteractionCreate, onGenericContextInteraction, onGenericEmote, onGenericEmoteUpdate, onGenericEvent, onGenericGuild, onGenericGuildInvite, onGenericGuildMember, onGenericGuildMemberUpdate, onGenericGuildUpdate, onGenericGuildVoice, onGenericInteractionCreate, onGenericMessage, onGenericMessageReaction, onGenericPermissionOverride, onGenericRole, onGenericRoleUpdate, onGenericSelfUpdate, onGenericStageInstance, onGenericStageInstanceUpdate, onGenericThread, onGenericThreadMember, onGenericUpdate, onGenericUser, onGenericUserPresence, onGuildAvailable, onGuildBan, onGuildInviteCreate, onGuildInviteDelete, onGuildJoin, onGuildLeave, onGuildMemberJoin, onGuildMemberRemove, onGuildMemberRoleAdd, onGuildMemberRoleRemove, onGuildMemberUpdate, onGuildMemberUpdateAvatar, onGuildMemberUpdateBoostTime, onGuildMemberUpdateNickname, onGuildMemberUpdatePending, onGuildMemberUpdateTimeOut, onGuildReady, onGuildTimeout, onGuildUnavailable, onGuildUnban, onGuildUpdateAfkChannel, onGuildUpdateAfkTimeout, onGuildUpdateBanner, onGuildUpdateBoostCount, onGuildUpdateBoostTier, onGuildUpdateCommunityUpdatesChannel, onGuildUpdateDescription, onGuildUpdateExplicitContentLevel, onGuildUpdateFeatures, onGuildUpdateIcon, onGuildUpdateLocale, onGuildUpdateMaxMembers, onGuildUpdateMaxPresences, onGuildUpdateMFALevel, onGuildUpdateName, onGuildUpdateNotificationLevel, onGuildUpdateNSFWLevel, onGuildUpdateOwner, onGuildUpdateRulesChannel, onGuildUpdateSplash, onGuildUpdateSystemChannel, onGuildUpdateVanityCode, onGuildUpdateVerificationLevel, onGuildVoiceDeafen, onGuildVoiceGuildDeafen, onGuildVoiceGuildMute, onGuildVoiceJoin, onGuildVoiceLeave, onGuildVoiceMove, onGuildVoiceMute, onGuildVoiceRequestToSpeak, onGuildVoiceSelfDeafen, onGuildVoiceSelfMute, onGuildVoiceStream, onGuildVoiceSuppress, onGuildVoiceUpdate, onGuildVoiceVideo, onHttpRequest, onMessageBulkDelete, onMessageContextInteraction, onMessageDelete, onMessageEmbed, onMessageReactionAdd, onMessageReactionRemove, onMessageReactionRemoveAll, onMessageReactionRemoveEmote, onMessageReceived, onMessageUpdate, onPermissionOverrideCreate, onPermissionOverrideDelete, onPermissionOverrideUpdate, onRawGateway, onReady, onReconnected, onResumed, onRoleCreate, onRoleDelete, onRoleUpdateColor, onRoleUpdateHoisted, onRoleUpdateIcon, onRoleUpdateMentionable, onRoleUpdateName, onRoleUpdatePermissions, onRoleUpdatePosition, onSelfUpdateAvatar, onSelfUpdateMFA, onSelfUpdateName, onSelfUpdateVerified, onShutdown, onSlashCommandInteraction, onStageInstanceCreate, onStageInstanceDelete, onStageInstanceUpdatePrivacyLevel, onStageInstanceUpdateTopic, onStatusChange, onThreadHidden, onThreadMemberJoin, onThreadMemberLeave, onThreadRevealed, onUnavailableGuildJoined, onUnavailableGuildLeave, onUserActivityEnd, onUserActivityStart, onUserContextInteraction, onUserTyping, onUserUpdateActivities, onUserUpdateActivityOrder, onUserUpdateAvatar, onUserUpdateDiscriminator, onUserUpdateFlags, onUserUpdateName, onUserUpdateOnlineStatus
-
Constructor Details
-
SlashCommand
protected SlashCommand(@Nonnull String name, @Nonnull String description, boolean isGuildOnly, @Nonnull CommandType... commandType) Were the command is registered.
-
-
Method Details
-
getName
Provides the user with name of the command- Returns:
CommandDataImpl.getName()
-
getDescription
Provides the user information on what the command is about.- Returns:
CommandDataImpl.getDescription()
-
getSlashCommandData
@NotNull public final @NotNull net.dv8tion.jda.api.interactions.commands.build.SlashCommandData getSlashCommandData()Retrieves all the slash command data such as the name and description of the command. Also- Returns:
Commands.slash(String, String)and can also return
Choices can also be used which makes it easier for the user. which returnsOptionData.addChoice(String, long)
-
checkIfIsGuildOnly
public boolean checkIfIsGuildOnly()Used to determine whether the command is Global(can be used on all servers) or whether it is only a Guild command(can only be used in specific servers) -
getCommandType
Used to determine what type of command it is. -
onSlashCommand
Used when creating a new slash command.- Parameters:
yusufSlashCommandEvent- the event that is being used to create the command.
-
onButtonInteraction
public void onButtonInteraction(@Nonnull net.dv8tion.jda.api.events.interaction.component.ButtonInteractionEvent event) - Overrides:
onButtonInteractionin classnet.dv8tion.jda.api.hooks.ListenerAdapter
-
onSelectMenuInteraction
public void onSelectMenuInteraction(@Nonnull net.dv8tion.jda.api.events.interaction.component.SelectMenuInteractionEvent event) - Overrides:
onSelectMenuInteractionin classnet.dv8tion.jda.api.hooks.ListenerAdapter
-