Package discord4j.core.spec
Class MessageEditSpec
- java.lang.Object
-
- discord4j.core.spec.MessageEditSpec
-
- All Implemented Interfaces:
Spec<discord4j.discordjson.json.MessageEditRequest>
public class MessageEditSpec extends Object implements Spec<discord4j.discordjson.json.MessageEditRequest>
Spec used to editMessage
entities this client has sent before.- See Also:
- Edit Message
-
-
Constructor Summary
Constructors Constructor Description MessageEditSpec()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description MessageEditSpec
addEmbed(Consumer<? super EmbedCreateSpec> spec)
Adds an embed to the edit request.discord4j.discordjson.json.MessageEditRequest
asRequest()
MessageEditSpec
removeEmbeds()
Removes all of the embeds on the message.MessageEditSpec
setAllowedMentions(AllowedMentions allowedMentions)
Sets the new allowed mentions for the editedMessage
.MessageEditSpec
setComponents(LayoutComponent... components)
Sets the components of the message.MessageEditSpec
setComponents(List<LayoutComponent> components)
Sets the components of the message.MessageEditSpec
setContent(String content)
Sets the new contents for the editedMessage
.MessageEditSpec
setEmbed(Consumer<? super EmbedCreateSpec> spec)
Deprecated.UseaddEmbed(Consumer)
orremoveEmbeds()
MessageEditSpec
setFlags(Message.Flag... flags)
Sets the flags for the editedMessage
.
-
-
-
Method Detail
-
setContent
public MessageEditSpec setContent(@Nullable String content)
Sets the new contents for the editedMessage
.- Parameters:
content
- This message contents.- Returns:
- This spec.
-
setEmbed
@Deprecated public MessageEditSpec setEmbed(@Nullable Consumer<? super EmbedCreateSpec> spec)
Deprecated.UseaddEmbed(Consumer)
orremoveEmbeds()
Sets the new rich content for the editedMessage
.- Parameters:
spec
- AnEmbedCreateSpec
consumer used to attach rich content when creating a message.- Returns:
- This spec.
-
addEmbed
public MessageEditSpec addEmbed(Consumer<? super EmbedCreateSpec> spec)
Adds an embed to the edit request.Warning: This method does not add an embed to the embeds already existing on the message. That is, if a message has embeds A and B, editing it with
addEmbed(C)
will result in the message having only embed C. To actually add embed C to the message, all embeds must be sent (i.e., doaddEmbed(A).addEmbed(B).addEmbed(C)
.- Parameters:
spec
- AnEmbedCreateSpec
consumer used to attach rich content when creating a message.- Returns:
- This spec.
-
removeEmbeds
public MessageEditSpec removeEmbeds()
Removes all of the embeds on the message.- Returns:
- This spec.
-
setAllowedMentions
public MessageEditSpec setAllowedMentions(@Nullable AllowedMentions allowedMentions)
Sets the new allowed mentions for the editedMessage
.- Parameters:
allowedMentions
- This message allowed mentions.- Returns:
- This spec.
-
setFlags
public MessageEditSpec setFlags(@Nullable Message.Flag... flags)
Sets the flags for the editedMessage
.- Parameters:
flags
- An array ofMessage.Flag
to set on the edited message.- Returns:
- This spec.
-
setComponents
public MessageEditSpec setComponents(LayoutComponent... components)
Sets the components of the message.- Parameters:
components
- The message components.- Returns:
- This spec.
-
setComponents
public MessageEditSpec setComponents(List<LayoutComponent> components)
Sets the components of the message.- Parameters:
components
- The message components.- Returns:
- This spec.
-
-