Interface Interaction

All Superinterfaces:
ISnowflake
All Known Subinterfaces:
ButtonInteraction, CommandAutoCompleteInteraction, CommandInteraction, CommandInteractionPayload, ComponentInteraction, ContextInteraction<T>, IAutoCompleteCallback, IDeferrableCallback, IMessageEditCallback, IReplyCallback, MessageContextInteraction, SelectMenuInteraction, SlashCommandInteraction, UserContextInteraction
All Known Implementing Classes:
ButtonInteractionEvent, CommandAutoCompleteInteractionEvent, GenericAutoCompleteInteractionEvent, GenericCommandInteractionEvent, GenericComponentInteractionCreateEvent, GenericContextInteractionEvent, GenericInteractionCreateEvent, MessageContextInteractionEvent, SelectMenuInteractionEvent, SlashCommandInteractionEvent, UserContextInteractionEvent

public interface Interaction extends ISnowflake
Abstract representation for any kind of Discord interaction.
This includes things such as Slash-Commands or Buttons.

To properly handle an interaction you must acknowledge it. Each interaction has different callbacks which acknowledge the interaction. These are added by the individual I...Callback interfaces:

Once the interaction is acknowledged, you can not reply with these methods again. If the interaction is a deferrable, you can use IDeferrableCallback.getHook() to send additional messages or update the original reply. When using IReplyCallback.deferReply() the first message sent to the InteractionHook will be identical to using InteractionHook.editOriginal(String). You must decide whether your reply will be ephemeral or not before calling IReplyCallback.deferReply(). So design your code flow with that in mind!

You can only acknowledge an interaction once! Any additional calls to reply/deferReply will result in exceptions. You can use isAcknowledged() to check whether the interaction has been acknowledged already.