Interface WebhookMessageCreateAction<T>
- All Superinterfaces:
AbstractWebhookMessageAction<T,
,WebhookMessageCreateAction<T>> FluentRestAction<T,
,WebhookMessageCreateAction<T>> MessageCreateRequest<WebhookMessageCreateAction<T>>
,MessageData
,MessageRequest<WebhookMessageCreateAction<T>>
,RestAction<T>
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 Summary
Modifier and TypeMethodDescriptiondefault WebhookMessageCreateAction
<T> createThread
(String threadName, ForumTagSnowflake... tags) Create a new thread channel for this webhook message.createThread
(ThreadCreateMetadata threadMetadata) Create a new thread channel for this webhook message.setAvatarUrl
(String iconUrl) Set the apparent avatar for the message author.setEphemeral
(boolean ephemeral) Set whether this message should be visible to other users.setUsername
(String name) Set the apparent username for the message author.Methods inherited from interface net.dv8tion.jda.api.requests.restaction.AbstractWebhookMessageAction
setThread, setThreadId, setThreadId
Methods inherited from interface net.dv8tion.jda.api.requests.FluentRestAction
addCheck, deadline, setCheck, timeout
Methods inherited from interface net.dv8tion.jda.api.utils.messages.MessageCreateRequest
addActionRow, addActionRow, addComponents, addComponents, addContent, addEmbeds, addEmbeds, addFiles, addFiles, applyData, applyEditData, applyMessage, getAttachments, getPoll, setPoll, setSuppressedNotifications, setTTS, setVoiceMessage
Methods inherited from interface net.dv8tion.jda.api.utils.messages.MessageData
getAllowedMentions, getComponents, getContent, getEmbeds, getMentionedRoles, getMentionedUsers, isMentionRepliedUser, isSuppressEmbeds
Methods inherited from interface net.dv8tion.jda.api.utils.messages.MessageRequest
mention, mention, mentionRepliedUser, mentionRoles, mentionRoles, mentionRoles, mentionUsers, mentionUsers, mentionUsers, setActionRow, setActionRow, setAllowedMentions, setComponents, setComponents, setContent, setEmbeds, setEmbeds, setFiles, setFiles, setSuppressEmbeds
Methods inherited from interface net.dv8tion.jda.api.requests.RestAction
and, and, complete, complete, completeAfter, delay, delay, delay, delay, flatMap, flatMap, getCheck, getJDA, map, mapToResult, onErrorFlatMap, onErrorFlatMap, onErrorMap, onErrorMap, onSuccess, queue, queue, queue, queueAfter, queueAfter, queueAfter, queueAfter, queueAfter, queueAfter, submit, submit, submitAfter, submitAfter, zip
-
Method Details
-
setEphemeral
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:- Cannot be reacted to
- Cannot be retrieved
This only works on
InteractionHooks
! For adeferred reply
, this is not supported. When a reply is deferred, the very first message sent through theInteractionHook
, inherits the ephemeral state of the initial reply. To send an ephemeral deferred reply, you must usedeferReply(true)
instead.- 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
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
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 atarget 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 webhookIllegalArgumentException
- 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 atarget thread
is already configured.This cannot be used with
InteractionHooks
!- Parameters:
threadName
- The thread titletags
- The tags to apply to this forum post- Returns:
- The same message action, for chaining convenience
- Throws:
IllegalStateException
- If this is an interaction webhookIllegalArgumentException
- If null is provided or the name is not between 1 and 80 characters long- See Also:
-