Class UserCommand
java.lang.Object
net.dv8tion.jda.api.hooks.ListenerAdapter
io.github.yusufsdiscordbot.yusufsdiscordcore.bot.handlers.extensions.UserCommand
- All Implemented Interfaces:
net.dv8tion.jda.api.hooks.EventListener
public abstract class UserCommand
extends net.dv8tion.jda.api.hooks.ListenerAdapter
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedUserCommand(String name, boolean isGuildOnly, CommandType... commandType) -
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)final net.dv8tion.jda.api.interactions.commands.build.CommandDataRetrieves all the command data such as the name and description of the command.Used to determine what type of command it is.final StringgetName()Provides the user with name of the commandvoidonButtonInteraction(net.dv8tion.jda.api.events.interaction.component.ButtonInteractionEvent event) voidonSelectMenuInteraction(net.dv8tion.jda.api.events.interaction.component.SelectMenuInteractionEvent event) abstract voidonUserContextInteraction(net.dv8tion.jda.api.events.interaction.command.UserContextInteractionEvent event) Used to create a user context interaction event.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, onUserTyping, onUserUpdateActivities, onUserUpdateActivityOrder, onUserUpdateAvatar, onUserUpdateDiscriminator, onUserUpdateFlags, onUserUpdateName, onUserUpdateOnlineStatus
-
Constructor Details
-
UserCommand
protected UserCommand(@Nonnull String name, boolean isGuildOnly, @Nonnull CommandType... commandType)
-
-
Method Details
-
getName
Provides the user with name of the command- Returns:
CommandDataImpl.getName()
-
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. -
getCommandData
@Nonnull public final net.dv8tion.jda.api.interactions.commands.build.CommandData getCommandData()Retrieves all the command data such as the name and description of the command. Also used to create options and sub commands.- Returns:
CommandDataImpl(String, String)and can also returnSlashCommandData.addOption(OptionType, String, String)
Choices can also be used which makes it easier for the user. which returnsOptionData.addChoice(String, long)
-
onUserContextInteraction
public abstract void onUserContextInteraction(@Nonnull net.dv8tion.jda.api.events.interaction.command.UserContextInteractionEvent event) Used to create a user context interaction event.- Overrides:
onUserContextInteractionin classnet.dv8tion.jda.api.hooks.ListenerAdapter- Parameters:
event- The event that is being used to create the user context interaction event.
-
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
-