Interface RestInteraction

  • All Known Subinterfaces:
    DirectInteraction, GuildInteraction

    @Experimental
    public interface RestInteraction
    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:
    Interactions
    • Method Detail

      • 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

        FollowupInteractionHandler reply​(String content)
        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

        FollowupInteractionHandler replyEphemeral​(String content)
        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.