Package discord4j.rest.interaction
Interface RestInteraction
- All Known Subinterfaces:
DirectInteraction,GuildInteraction
A single interaction coming from Discord. An application command can be reacted upon through this class by first
extracting relevant information from the event and then running one of the initial response methods like
acknowledge or reply.- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionBuild an interaction handler that will acknowledge this request, displaying a loading state.Build an interaction handler that will acknowledge this request, displaying a loading state only for the invoking user.Return the channel ID where this interaction was created.discord4j.discordjson.json.ApplicationCommandInteractionDataReturn the raw application command interaction data from this interaction.discord4j.discordjson.json.InteractionDatagetData()Return the raw data for this interaction.getId()Return the ID for this interaction.reply(discord4j.discordjson.json.InteractionApplicationCommandCallbackData callbackData) Build an interaction handler that will produce a reply using the contents of the supplied callback data to the interaction member.Build an interaction handler that will produce a text reply to the interaction member.replyEphemeral(String content) Build an interaction handler that will produce a text reply only to the interaction member.
-
Method Details
-
getData
discord4j.discordjson.json.InteractionData getData()Return the raw data for this interaction.- Returns:
- an interaction data object
-
getId
Snowflake getId()Return the ID for this interaction.- Returns:
- this interaction Snowflake ID
-
getChannelId
Snowflake getChannelId()Return the channel ID where this interaction was created.- Returns:
- this interaction Snowflake channel ID
-
getCommandInteractionData
discord4j.discordjson.json.ApplicationCommandInteractionData getCommandInteractionData()Return the raw application command interaction data from this interaction.- Returns:
- an application command interaction data object
-
acknowledge
FollowupInteractionHandler acknowledge()Build an interaction handler that will acknowledge this request, displaying a loading state.- Returns:
- a followup handler to continue processing this interaction asynchronously, until the interaction token bound to this interaction expires after 15 minutes.
-
acknowledgeEphemeral
FollowupInteractionHandler acknowledgeEphemeral()Build an interaction handler that will acknowledge this request, displaying a loading state only for the invoking user.- Returns:
- a followup handler to continue processing this interaction asynchronously, until the interaction token bound to this interaction expires after 15 minutes.
-
reply
Build an interaction handler that will produce a text reply to the interaction member.- Parameters:
content- the content to be sent as reply- Returns:
- a followup handler to continue processing this interaction asynchronously, until the interaction token bound to this interaction expires after 15 minutes.
-
replyEphemeral
Build an interaction handler that will produce a text reply only to the interaction member.- Parameters:
content- the content to be sent as reply- Returns:
- a followup handler to continue processing this interaction asynchronously, until the interaction token bound to this interaction expires after 15 minutes.
-
reply
FollowupInteractionHandler reply(discord4j.discordjson.json.InteractionApplicationCommandCallbackData callbackData) Build an interaction handler that will produce a reply using the contents of the supplied callback data to the interaction member.- Parameters:
callbackData- the data used to produce a reply message- Returns:
- a followup handler to continue processing this interaction asynchronously, until the interaction token bound to this interaction expires after 15 minutes.
-