Interface InteractionCreateEvent

  • All Superinterfaces:
    Event


    public interface InteractionCreateEvent
    extends Event
    An interaction create event.
    • Method Detail

      • getInteraction

        Interaction getInteraction​()
        Gets the created interaction.
        Returns:
        The interaction.
      • getSlashCommandInteraction

        default Optional<SlashCommandInteraction> getSlashCommandInteraction​()
        Gets the created interaction as SlashCommandInteraction, if the interaction is of this type.
        Returns:
        The interaction.
      • getSlashCommandInteractionWithCommandId

        default 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 Optional<MessageComponentInteraction> getMessageComponentInteraction​()
        Gets the created interaction as MessageComponentInteraction, if the interaction is of this type.
        Returns:
        The interaction.
      • getMessageComponentInteractionWithCustomId

        default Optional<MessageComponentInteraction> getMessageComponentInteractionWithCustomId​(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 InteractionBaseOptional<T> getInteractionAs​(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 to use the different getXXX() methods to walk down the interaction inheritance tree.

        If the interaction is not castable to the specified type, the Optional will be empty.

        Type Parameters:
        T - The desired type.
        Parameters:
        type - The type as which to obtain this interaction.
        Returns:
        Returns an Optional of this interaction if it could be cast, otherwise an empty result.