Interface InteractionBase

    • Method Detail

      • getApplicationId

        long getApplicationId()
        Gets the id of the application that this interaction is for.
        Returns:
        The id of the application.
      • getType

        InteractionType getType()
        Gets the type of the interaction.
        Returns:
        The type of the interaction.
      • createImmediateResponder

        InteractionImmediateResponseBuilder createImmediateResponder()
        Create a response builder that can be used to immediately reply to this interaction with a message. Please note that you have to call respond() on the returned object within 3 seconds after receiving the interaction.
        Returns:
        The new response builder.
      • respondLater

        java.util.concurrent.CompletableFuture<InteractionOriginalResponseUpdater> respondLater()
        Sends an acknowledgement of the interaction to Discord and displays a loading state to the user, indicating that you'll respond with a delay. Please note that you can only actually update this loading state message within 15 minutes after receiving the interaction.
        Returns:
        A CompletableFuture that completes as soon as the acknowledgement has been sent; it yields an updater that should be used to update the message later on.
      • respondLater

        java.util.concurrent.CompletableFuture<InteractionOriginalResponseUpdater> respondLater​(boolean ephemeral)
        Sends an acknowledgement of the interaction to Discord and displays an (ephemeral) loading state to the user, indicating that you'll respond with a delay. Please note that you can only actually update this loading state message within 15 minutes after receiving the interaction.
        Parameters:
        ephemeral - Whether the response should be ephemeral
        Returns:
        A CompletableFuture that completes as soon as the acknowledgement has been sent; it yields an updater that should be used to update the message later on.
      • respondWithModal

        default java.util.concurrent.CompletableFuture<java.lang.Void> respondWithModal​(java.lang.String customId,
                                                                                        java.lang.String title,
                                                                                        HighLevelComponent... components)
        Respond with a popup modal the user can interact with. You can respond to every interaction with a modal except to a ModalInteraction.
        Parameters:
        customId - The custom ID of the modal.
        title - The title of the modal.
        components - The components that should be displayed in the modal.
        Returns:
        A CompletableFuture that completes as soon as the modal has been sent.
      • respondWithModal

        java.util.concurrent.CompletableFuture<java.lang.Void> respondWithModal​(java.lang.String customId,
                                                                                java.lang.String title,
                                                                                java.util.List<HighLevelComponent> components)
        Respond with a popup modal the user can interact with. You can respond to every interaction with a modal except to a ModalInteraction.
        Parameters:
        customId - The custom ID of the modal.
        title - The title of the modal.
        components - The components that should be displayed in the modal.
        Returns:
        A CompletableFuture that completes as soon as the modal has been sent.
      • createFollowupMessageBuilder

        InteractionFollowupMessageBuilder createFollowupMessageBuilder()
        Create a message builder to send follow-up messages for this interaction. You can send, edit and delete follow-up messages for up to 15 minutes after you received the interaction.
        Returns:
        The new message builder.
      • getServer

        java.util.Optional<Server> getServer()
        Gets the server that this interaction was sent from.
        Returns:
        The server.
      • getChannel

        java.util.Optional<TextChannel> getChannel()
        Gets the channel that this interaction was sent from.
        Returns:
        The channel.
      • getUser

        User getUser()
        Gets the invoking user.
        Returns:
        The invoking user.
      • getToken

        java.lang.String getToken()
        Gets the continuation token for responding to the interaction.
        Returns:
        The token.
      • getVersion

        int getVersion()
        Gets the version.
        Returns:
        The version.
      • getLocale

        DiscordLocale getLocale()
        Gets the selected language of the invoking user.
        Returns:
        The user selected language.
      • getServerLocale

        java.util.Optional<DiscordLocale> getServerLocale()
        Gets the server's preferred locale, if invoked in a server.
        Returns:
        The server's preferred locale.
      • getBotPermissions

        java.util.Optional<java.util.EnumSet<PermissionType>> getBotPermissions()
        Gets the permissions the bot has within the channel the interaction was sent from. Not present if the interaction has been invoked in a direct message.
        Returns:
        The bots permissions within the channel the interaction was sent from.