Interface WebhookMessageCreateAction<T>

All Superinterfaces:
AbstractWebhookMessageAction<T, WebhookMessageCreateAction<T>>, FluentRestAction<T, WebhookMessageCreateAction<T>>, MessageCreateRequest<WebhookMessageCreateAction<T>>, MessageData, MessageRequest<WebhookMessageCreateAction<T>>, RestAction<T>

public interface WebhookMessageCreateAction<T> extends MessageCreateRequest<WebhookMessageCreateAction<T>>, AbstractWebhookMessageAction<T, WebhookMessageCreateAction<T>>
Extension of a default RestAction that allows setting message information before sending!

This is available as return type of all sendMessage/sendFile methods in WebhookClient.

When this RestAction has been executed all provided files will be closed.
Note that the garbage collector also frees opened file streams when it finalizes the stream object.

See Also:
  • Method Details

    • setEphemeral

      @Nonnull @CheckReturnValue WebhookMessageCreateAction<T> setEphemeral(boolean ephemeral)
      Set whether this message should be visible to other users.
      When a message is ephemeral, it will only be visible to the user that used the interaction.

      Ephemeral messages have some limitations and will be removed once the user restarts their client.
      Limitations:

      This only works on InteractionHooks! For a deferred reply, this is not supported. When a reply is deferred, the very first message sent through the InteractionHook, inherits the ephemeral state of the initial reply. To send an ephemeral deferred reply, you must use deferReply(true) instead. Note: Your message can appear ephemeral in several cases:

      • In guilds the bot is not a member of, if the member is unable to use external application, this usually happens for user-installed commands
      • If the interaction user is unable to send messages
      • If the content contains elements the user does not have the permission to send (like files or embeds)
      • If the content triggered AutoMod
      Parameters:
      ephemeral - True, if this message should be invisible for other users
      Returns:
      The same message action, for chaining convenience
      Throws:
      IllegalStateException - If this is not an interaction webhook
    • setUsername

      @Nonnull @CheckReturnValue WebhookMessageCreateAction<T> setUsername(@Nullable String name)
      Set the apparent username for the message author.
      This changes the username that is shown for the message author.

      This cannot be used with InteractionHooks!

      Parameters:
      name - The username to use, or null to use the default
      Returns:
      The same message action, for chaining convenience
      Throws:
      IllegalStateException - If this is an interaction webhook
    • setAvatarUrl

      @Nonnull @CheckReturnValue WebhookMessageCreateAction<T> setAvatarUrl(@Nullable String iconUrl)
      Set the apparent avatar for the message author.
      This changes the avatar that is shown for the message author.

      This cannot be used with InteractionHooks!

      Parameters:
      iconUrl - The URL to the avatar, or null to use default
      Returns:
      The same message action, for chaining convenience
      Throws:
      IllegalStateException - If this is an interaction webhook
    • createThread

      @Nonnull @CheckReturnValue WebhookMessageCreateAction<T> createThread(@Nonnull ThreadCreateMetadata threadMetadata)
      Create a new thread channel for this webhook message.
      This is currently limited to forum channels.
      Does nothing if a target thread is already configured.

      This cannot be used with InteractionHooks!

      Parameters:
      threadMetadata - The metadata for the thread
      Returns:
      The same message action, for chaining convenience
      Throws:
      IllegalStateException - If this is an interaction webhook
      IllegalArgumentException - If null is provided
      See Also:
    • createThread

      @Nonnull @CheckReturnValue default WebhookMessageCreateAction<T> createThread(@Nonnull String threadName, @Nonnull ForumTagSnowflake... tags)
      Create a new thread channel for this webhook message.
      This is currently limited to forum channels.
      Does nothing if a target thread is already configured.

      This cannot be used with InteractionHooks!

      Parameters:
      threadName - The thread title
      tags - The tags to apply to this forum post
      Returns:
      The same message action, for chaining convenience
      Throws:
      IllegalStateException - If this is an interaction webhook
      IllegalArgumentException - If null is provided or the name is not between 1 and 80 characters long
      See Also: