Interface InteractionCreateEvent
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description InteractiongetInteraction()Gets the created interaction.default <T extends InteractionBase>
java.util.Optional<T>getInteractionAs(java.lang.Class<T> type)For advanced users: Get the interaction as a desired subtype of interaction.default java.util.Optional<MessageComponentInteraction>getMessageComponentInteraction()Gets the created interaction as MessageComponentInteraction, if the interaction is of this type.default java.util.Optional<MessageComponentInteraction>getMessageComponentInteractionWithCustomId(java.lang.String customId)Gets the created interaction as MessageComponentInteraction, if the interaction is of this type, and the custom id equals the given custom id.default java.util.Optional<SlashCommandInteraction>getSlashCommandInteraction()Gets the created interaction as SlashCommandInteraction, if the interaction is of this type.default java.util.Optional<SlashCommandInteraction>getSlashCommandInteractionWithCommandId(long commandId)Gets the created interaction as SlashCommandInteraction, if the interaction is of this type and the command id equals the given command id.
-
-
-
Method Detail
-
getInteraction
Interaction getInteraction()
Gets the created interaction.- Returns:
- The interaction.
-
getSlashCommandInteraction
default java.util.Optional<SlashCommandInteraction> getSlashCommandInteraction()
Gets the created interaction as SlashCommandInteraction, if the interaction is of this type.- Returns:
- The interaction.
-
getSlashCommandInteractionWithCommandId
default java.util.Optional<SlashCommandInteraction> getSlashCommandInteractionWithCommandId(long commandId)
Gets the created interaction as SlashCommandInteraction, if the interaction is of this type and the command id equals the given command id.- Parameters:
commandId- The command it to match.- Returns:
- The interaction.
-
getMessageComponentInteraction
default java.util.Optional<MessageComponentInteraction> getMessageComponentInteraction()
Gets the created interaction as MessageComponentInteraction, if the interaction is of this type.- Returns:
- The interaction.
-
getMessageComponentInteractionWithCustomId
default java.util.Optional<MessageComponentInteraction> getMessageComponentInteractionWithCustomId(java.lang.String customId)
Gets the created interaction as MessageComponentInteraction, if the interaction is of this type, and the custom id equals the given custom id.- Parameters:
customId- The custom id to match.- Returns:
- The interaction.
-
getInteractionAs
default <T extends InteractionBase> java.util.Optional<T> getInteractionAs(java.lang.Class<T> type)
For advanced users: Get the interaction as a desired subtype of interaction. Use this as a shortcut if you know which type of deeply nested interaction type you're expecting. For regular users, we recommend using the differentgetXXX()methods to walk down the interaction inheritance tree.If the interaction is not castable to the specified type, the
Optionalwill be empty.- Type Parameters:
T- The desired type.- Parameters:
type- The type as which to obtain this interaction.- Returns:
- Returns an
Optionalof this interaction if it could be cast, otherwise an empty result.
-
-