Interface IMessageEditCallback
- All Superinterfaces:
IDeferrableCallback
,Interaction
,ISnowflake
- All Known Subinterfaces:
ButtonInteraction
,ComponentInteraction
,SelectMenuInteraction
- All Known Implementing Classes:
ButtonInteractionEvent
,GenericComponentInteractionCreateEvent
,SelectMenuInteractionEvent
Editing a message using these methods will automatically acknowledge the interaction.
Deferred Edits
Similar toIReplyCallback
, message edits can be deferred and performed later with deferEdit()
.
A deferred edit tells Discord, that you intend to edit the message this interaction was performed on, but will do so later.
However, you can defer the edit and never do it, which is effectively a no-operation acknowledgement of the interaction.
If an edit is deferred
, it becomes the original message of the interaction hook.
This means all the methods with original
in the name, such as InteractionHook.editOriginal(String)
,
will affect that original message you edited.
-
Method Summary
Modifier and TypeMethodDescriptionNo-op acknowledgement of this interaction.default MessageEditCallbackAction
editComponents
(Collection<? extends LayoutComponent> components) Acknowledgement of this interaction with a message update.default MessageEditCallbackAction
editComponents
(LayoutComponent... components) Acknowledgement of this interaction with a message update.default MessageEditCallbackAction
editMessage
(String content) Acknowledgement of this interaction with a message update.default MessageEditCallbackAction
editMessage
(Message message) Acknowledgement of this interaction with a message update.default MessageEditCallbackAction
editMessageEmbeds
(Collection<? extends MessageEmbed> embeds) Acknowledgement of this interaction with a message update.default MessageEditCallbackAction
editMessageEmbeds
(MessageEmbed... embeds) Acknowledgement of this interaction with a message update.default MessageEditCallbackAction
editMessageFormat
(String format, Object... args) Acknowledgement of this interaction with a message update.Methods inherited from interface net.dv8tion.jda.api.interactions.callbacks.IDeferrableCallback
getHook
Methods inherited from interface net.dv8tion.jda.api.interactions.Interaction
getChannel, getChannelType, getGuild, getGuildChannel, getGuildLocale, getJDA, getMember, getMessageChannel, getNewsChannel, getPrivateChannel, getTextChannel, getThreadChannel, getToken, getType, getTypeRaw, getUser, getUserLocale, getVoiceChannel, isAcknowledged, isFromGuild
Methods inherited from interface net.dv8tion.jda.api.entities.ISnowflake
getId, getIdLong, getTimeCreated
-
Method Details
-
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 theInteractionHook
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 receiveErrorResponse.UNKNOWN_INTERACTION
.Use
editMessage(String)
to edit it directly.- Returns:
MessageEditCallbackAction
that can be used to update the message- See Also:
-
editMessage
Acknowledgement of this interaction with a message update.
You can useIDeferrableCallback.getHook()
to edit the message further.You can only use deferEdit() or editMessage() once per interaction! Use
IDeferrableCallback.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 receiveErrorResponse.UNKNOWN_INTERACTION
.- Parameters:
message
- The new message content to use- Returns:
MessageEditCallbackAction
that can be used to further update the message- Throws:
IllegalArgumentException
- If the provided message is null
-
editMessage
Acknowledgement of this interaction with a message update.
You can useIDeferrableCallback.getHook()
to edit the message further.You can only use deferEdit() or editMessage() once per interaction! Use
IDeferrableCallback.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 receiveErrorResponse.UNKNOWN_INTERACTION
.- Parameters:
content
- The new message content to use- Returns:
MessageEditCallbackAction
that can be used to further update the message- Throws:
IllegalArgumentException
- If the provided content is null
-
editComponents
@Nonnull @CheckReturnValue default MessageEditCallbackAction editComponents(@Nonnull Collection<? extends LayoutComponent> components) Acknowledgement of this interaction with a message update.
You can useIDeferrableCallback.getHook()
to edit the message further.You can only use deferEdit() or editMessage() once per interaction! Use
IDeferrableCallback.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 receiveErrorResponse.UNKNOWN_INTERACTION
.- Parameters:
components
- The new message components, such asActionRow
- Returns:
MessageEditCallbackAction
that can be used to further update the message- Throws:
IllegalArgumentException
- If the provided components are null
-
editComponents
@Nonnull @CheckReturnValue default MessageEditCallbackAction editComponents(@Nonnull LayoutComponent... components) Acknowledgement of this interaction with a message update.
You can useIDeferrableCallback.getHook()
to edit the message further.You can only use deferEdit() or editMessage() once per interaction! Use
IDeferrableCallback.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 receiveErrorResponse.UNKNOWN_INTERACTION
.- Parameters:
components
- The new message components, such asActionRow
- Returns:
MessageEditCallbackAction
that can be used to further update the message- Throws:
IllegalArgumentException
- If the provided components are null
-
editMessageEmbeds
@Nonnull @CheckReturnValue default MessageEditCallbackAction editMessageEmbeds(@Nonnull Collection<? extends MessageEmbed> embeds) Acknowledgement of this interaction with a message update.
You can useIDeferrableCallback.getHook()
to edit the message further.You can only use deferEdit() or editMessage() once per interaction! Use
IDeferrableCallback.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 receiveErrorResponse.UNKNOWN_INTERACTION
.- Parameters:
embeds
- The newMessageEmbeds
- Returns:
MessageEditCallbackAction
that can be used to further update the message- Throws:
IllegalArgumentException
- If any of the provided embeds is null
-
editMessageEmbeds
@Nonnull @CheckReturnValue default MessageEditCallbackAction editMessageEmbeds(@Nonnull MessageEmbed... embeds) Acknowledgement of this interaction with a message update.
You can useIDeferrableCallback.getHook()
to edit the message further.You can only use deferEdit() or editMessage() once per interaction! Use
IDeferrableCallback.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 receiveErrorResponse.UNKNOWN_INTERACTION
.- Parameters:
embeds
- The new message embeds to include in the message- Returns:
MessageEditCallbackAction
that can be used to further update the message- Throws:
IllegalArgumentException
- If any of the provided embeds is null
-
editMessageFormat
@Nonnull @CheckReturnValue default MessageEditCallbackAction editMessageFormat(@Nonnull String format, @Nonnull Object... args) Acknowledgement of this interaction with a message update.
You can useIDeferrableCallback.getHook()
to edit the message further.You can only use deferEdit() or editMessage() once per interaction! Use
IDeferrableCallback.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 receiveErrorResponse.UNKNOWN_INTERACTION
.- Parameters:
format
- The format string for the new message contentargs
- The format arguments- Returns:
MessageEditCallbackAction
that can be used to further update the message- Throws:
IllegalArgumentException
- If the provided format is null
-