Interface ComponentInteraction

    • Method Detail

      • getComponentId

        @Nonnull
        java.lang.String getComponentId()
        The custom component Id provided to the component when it was originally created.
        This value should be used to determine what action to take in regards to this interaction.
        This id does not have to be numerical.
        Returns:
        The component ID
      • getComponent

        @Nullable
        Component getComponent()
        The Component instance.
        This is null on interactions for ephemeral messages.
        Returns:
        The Component, or null if this message is ephemeral
      • getMessageIdLong

        long getMessageIdLong()
        The id of the message.
        Returns:
        The message id
      • getMessageId

        @Nonnull
        default java.lang.String getMessageId()
        The id of the message.
        Returns:
        The message id
      • deferEdit

        @Nonnull
        @CheckReturnValue
        UpdateInteractionAction deferEdit()
        No-op acknowledgement of this interaction.
        This tells discord you intend to update the message that the triggering component is a part of using the InteractionHook instead of sending a reply message. You are not required to actually update the message, this will simply acknowledge that you accepted the interaction.

        You only have 3 seconds to acknowledge an interaction!
        When the acknowledgement is sent after the interaction expired, you will receive ErrorResponse.UNKNOWN_INTERACTION.

        Use editMessage(String) to edit it directly.

        Returns:
        UpdateInteractionAction that can be used to update the message
        See Also:
        editMessage(String)
      • editMessage

        @Nonnull
        @CheckReturnValue
        default UpdateInteractionAction editMessage​(@Nonnull
                                                    Message message)
        Acknowledgement of this interaction with a message update.
        You can use Interaction.getHook() to edit the message further.

        You can only use deferEdit() or editMessage() once per interaction! Use Interaction.getHook() for any additional updates.

        You only have 3 seconds to acknowledge an interaction!
        When the acknowledgement is sent after the interaction expired, you will receive ErrorResponse.UNKNOWN_INTERACTION.

        Parameters:
        message - The new message content to use
        Returns:
        UpdateInteractionAction that can be used to further update the message
        Throws:
        java.lang.IllegalArgumentException - If the provided message is null
      • editMessage

        @Nonnull
        @CheckReturnValue
        default UpdateInteractionAction editMessage​(@Nonnull
                                                    java.lang.String content)
        Acknowledgement of this interaction with a message update.
        You can use Interaction.getHook() to edit the message further.

        You can only use deferEdit() or editMessage() once per interaction! Use Interaction.getHook() for any additional updates.

        You only have 3 seconds to acknowledge an interaction!
        When the acknowledgement is sent after the interaction expired, you will receive ErrorResponse.UNKNOWN_INTERACTION.

        Parameters:
        content - The new message content to use
        Returns:
        UpdateInteractionAction that can be used to further update the message
        Throws:
        java.lang.IllegalArgumentException - If the provided content is null
      • editComponents

        @Nonnull
        @CheckReturnValue
        default UpdateInteractionAction editComponents​(@Nonnull
                                                       java.util.Collection<? extends ComponentLayout> components)
        Acknowledgement of this interaction with a message update.
        You can use Interaction.getHook() to edit the message further.

        You can only use deferEdit() or editMessage() once per interaction! Use Interaction.getHook() for any additional updates.

        You only have 3 seconds to acknowledge an interaction!
        When the acknowledgement is sent after the interaction expired, you will receive ErrorResponse.UNKNOWN_INTERACTION.

        Parameters:
        components - The new message components, such as ActionRow
        Returns:
        UpdateInteractionAction that can be used to further update the message
        Throws:
        java.lang.IllegalArgumentException - If the provided components are null
      • editComponents

        @Nonnull
        @CheckReturnValue
        default UpdateInteractionAction editComponents​(@Nonnull
                                                       ComponentLayout... components)
        Acknowledgement of this interaction with a message update.
        You can use Interaction.getHook() to edit the message further.

        You can only use deferEdit() or editMessage() once per interaction! Use Interaction.getHook() for any additional updates.

        You only have 3 seconds to acknowledge an interaction!
        When the acknowledgement is sent after the interaction expired, you will receive ErrorResponse.UNKNOWN_INTERACTION.

        Parameters:
        components - The new message components, such as ActionRow
        Returns:
        UpdateInteractionAction that can be used to further update the message
        Throws:
        java.lang.IllegalArgumentException - If the provided components are null
      • editMessageEmbeds

        @Nonnull
        @CheckReturnValue
        default UpdateInteractionAction editMessageEmbeds​(@Nonnull
                                                          java.util.Collection<? extends MessageEmbed> embeds)
        Acknowledgement of this interaction with a message update.
        You can use Interaction.getHook() to edit the message further.

        You can only use deferEdit() or editMessage() once per interaction! Use Interaction.getHook() for any additional updates.

        You only have 3 seconds to acknowledge an interaction!
        When the acknowledgement is sent after the interaction expired, you will receive ErrorResponse.UNKNOWN_INTERACTION.

        Parameters:
        embeds - The new MessageEmbeds
        Returns:
        UpdateInteractionAction that can be used to further update the message
        Throws:
        java.lang.IllegalArgumentException - If any of the provided embeds is null
      • editMessageEmbeds

        @Nonnull
        @CheckReturnValue
        default UpdateInteractionAction editMessageEmbeds​(@Nonnull
                                                          MessageEmbed... embeds)
        Acknowledgement of this interaction with a message update.
        You can use Interaction.getHook() to edit the message further.

        You can only use deferEdit() or editMessage() once per interaction! Use Interaction.getHook() for any additional updates.

        You only have 3 seconds to acknowledge an interaction!
        When the acknowledgement is sent after the interaction expired, you will receive ErrorResponse.UNKNOWN_INTERACTION.

        Parameters:
        embeds - The new message embeds to include in the message
        Returns:
        UpdateInteractionAction that can be used to further update the message
        Throws:
        java.lang.IllegalArgumentException - If any of the provided embeds is null
      • editMessageFormat

        @Nonnull
        @CheckReturnValue
        default UpdateInteractionAction editMessageFormat​(@Nonnull
                                                          java.lang.String format,
                                                          @Nonnull
                                                          java.lang.Object... args)
        Acknowledgement of this interaction with a message update.
        You can use Interaction.getHook() to edit the message further.

        You can only use deferEdit() or editMessage() once per interaction! Use Interaction.getHook() for any additional updates.

        You only have 3 seconds to acknowledge an interaction!
        When the acknowledgement is sent after the interaction expired, you will receive ErrorResponse.UNKNOWN_INTERACTION.

        Parameters:
        format - The format string for the new message content
        args - The format arguments
        Returns:
        UpdateInteractionAction that can be used to further update the message
        Throws:
        java.lang.IllegalArgumentException - If the provided format is null