Class GenericCommandInteractionEvent
- All Implemented Interfaces:
ISnowflake,GenericEvent,IDeferrableCallback,IModalCallback,IPremiumRequiredReplyCallback,IReplyCallback,CommandInteraction,CommandInteractionPayload,Interaction
- Direct Known Subclasses:
GenericContextInteractionEvent,SlashCommandInteractionEvent
CommandInteraction was used.
Requirements
To receive these events, you must unset the Interactions Endpoint URL in your application dashboard.
You can simply remove the URL for this endpoint in your settings at the Discord Developers Portal.
-
Constructor Summary
ConstructorsConstructorDescriptionGenericCommandInteractionEvent(JDA api, long responseNumber, CommandInteraction interaction) -
Method Summary
Modifier and TypeMethodDescriptionAcknowledge this interaction and defer the reply to a later time.longThe command id.TheTypeof command this interaction is for.getHook()TheInteractionHookwhich can be used to send deferred replies or followup messages.TheInteractioninstance.getName()The command name.The options provided by the user when this command was executed.The subcommand group name.The subcommand name.booleanWhether the used command is a guild command.replyModal(Modal modal) Acknowledgement of this interaction with aModal.Deprecated.Methods inherited from class net.dv8tion.jda.api.events.interaction.GenericInteractionCreateEvent
getChannel, getChannelIdLong, getContext, getEntitlements, getGuild, getGuildLocale, getIdLong, getIntegrationOwners, getMember, getToken, getTypeRaw, getUser, getUserLocale, isAcknowledgedMethods inherited from class net.dv8tion.jda.api.events.Event
getJDA, getRawData, getResponseNumber, toStringMethods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface net.dv8tion.jda.api.interactions.commands.CommandInteractionPayload
getCommandId, getCommandString, getFullCommandName, getOption, getOption, getOption, getOption, getOptionsByName, getOptionsByType, isGlobalCommandMethods inherited from interface net.dv8tion.jda.api.interactions.Interaction
getChannel, getChannelId, getChannelIdLong, getChannelType, getContext, getEntitlements, getGuild, getGuildChannel, getGuildLocale, getIntegrationOwners, getJDA, getMember, getMessageChannel, getToken, getType, getTypeRaw, getUser, getUserLocale, isAcknowledged, isFromAttachedGuild, isFromGuildMethods inherited from interface net.dv8tion.jda.api.interactions.callbacks.IReplyCallback
deferReply, reply, reply, replyComponents, replyComponents, replyEmbeds, replyEmbeds, replyFiles, replyFiles, replyFormat, replyPollMethods inherited from interface net.dv8tion.jda.api.entities.ISnowflake
getId, getIdLong, getTimeCreated
-
Constructor Details
-
GenericCommandInteractionEvent
public GenericCommandInteractionEvent(@Nonnull JDA api, long responseNumber, @Nonnull CommandInteraction interaction)
-
-
Method Details
-
getInteraction
Description copied from class:GenericInteractionCreateEventTheInteractioninstance.
Note that this event is a delegate which implements the same interface.- Overrides:
getInteractionin classGenericInteractionCreateEvent- Returns:
- The
Interaction
-
getCommandType
Description copied from interface:CommandInteractionPayloadTheTypeof command this interaction is for.- Specified by:
getCommandTypein interfaceCommandInteractionPayload- Returns:
- The command type
-
getName
Description copied from interface:CommandInteractionPayloadThe command name.
This can be useful for abstractions.Note that commands can have these following structures:
/name subcommandGroup subcommandName/name subcommandName/name
CommandInteractionPayload.getFullCommandName()to simplify your checks.- Specified by:
getNamein interfaceCommandInteractionPayload- Returns:
- The command name
-
getSubcommandName
Description copied from interface:CommandInteractionPayloadThe subcommand name.
This can be useful for abstractions.Note that commands can have these following structures:
/name subcommandGroup subcommandName/name subcommandName/name
CommandInteractionPayload.getFullCommandName()to simplify your checks.- Specified by:
getSubcommandNamein interfaceCommandInteractionPayload- Returns:
- The subcommand name, or null if this is not a subcommand
-
getSubcommandGroup
Description copied from interface:CommandInteractionPayloadThe subcommand group name.
This can be useful for abstractions.Note that commands can have these following structures:
/name subcommandGroup subcommandName/name subcommandName/name
CommandInteractionPayload.getFullCommandName()to simplify your checks.- Specified by:
getSubcommandGroupin interfaceCommandInteractionPayload- Returns:
- The subcommand group name, or null if this is not a subcommand group
-
getCommandIdLong
public long getCommandIdLong()Description copied from interface:CommandInteractionPayloadThe command id.
This is the id generated when a command is created viaGuild.updateCommands()or similar.It is usually preferred to discriminate commands by the
command namesinstead.- Specified by:
getCommandIdLongin interfaceCommandInteractionPayload- Returns:
- The command id
-
isGuildCommand
public boolean isGuildCommand()Description copied from interface:CommandInteractionPayloadWhether the used command is a guild command.Guild commands can be created with
Guild.upsertCommand(CommandData).- Specified by:
isGuildCommandin interfaceCommandInteractionPayload- Returns:
- True, if the used command is a guild command
-
getOptions
Description copied from interface:CommandInteractionPayloadThe options provided by the user when this command was executed.
Each option has a name and value.For
CommandAutoCompleteInteraction, this might be incomplete and unvalidated. Auto-complete interactions happen on incomplete command inputs and are not validated.- Specified by:
getOptionsin interfaceCommandInteractionPayload- Returns:
- The options passed for this command
- See Also:
-
getHook
Description copied from interface:IDeferrableCallbackTheInteractionHookwhich can be used to send deferred replies or followup messages.- Specified by:
getHookin interfaceIDeferrableCallback- Returns:
- The interaction hook
-
deferReply
Description copied from interface:IReplyCallbackAcknowledge this interaction and defer the reply to a later time.
This will send a<Bot> is thinking...message in chat that will be updated later through eitherInteractionHook.editOriginal(String)orWebhookClient.sendMessage(String).You can use
deferReply(true)to send a deferred ephemeral reply. If your initial deferred message is not ephemeral it cannot be made ephemeral later. Your first message to theInteractionHookwill inherit whether the message is ephemeral or not from this deferred reply.You only have 3 seconds to acknowledge an interaction!
When the acknowledgement is sent after the interaction expired, you will receiveErrorResponse.UNKNOWN_INTERACTION.Use
IReplyCallback.reply(String)to reply directly.- Specified by:
deferReplyin interfaceIReplyCallback- Returns:
ReplyCallbackAction
-
replyModal
Description copied from interface:IModalCallbackAcknowledgement of this interaction with aModal.This will open a popup on the target user's Discord client.
Interactions can only be acknowledged once.
You only have 3 seconds to acknowledge an interaction!
When the acknowledgement is sent after the interaction expired, you will receiveErrorResponse.UNKNOWN_INTERACTION.- Specified by:
replyModalin interfaceIModalCallback- Parameters:
modal- The Modal to send- Returns:
- ModalCallbackAction
-
replyWithPremiumRequired
@Nonnull @Deprecated @CheckReturnValue public PremiumRequiredCallbackAction replyWithPremiumRequired()Deprecated.- Specified by:
replyWithPremiumRequiredin interfaceIPremiumRequiredReplyCallback
-