Class MessageEditSpec

  • All Implemented Interfaces:
    Spec<discord4j.discordjson.json.MessageEditRequest>

    public class MessageEditSpec
    extends Object
    implements Spec<discord4j.discordjson.json.MessageEditRequest>
    Spec used to edit Message entities this client has sent before.
    See Also:
    Edit Message
    • Constructor Detail

      • MessageEditSpec

        public MessageEditSpec()
    • Method Detail

      • setContent

        public MessageEditSpec setContent​(@Nullable
                                          String content)
        Sets the new contents for the edited Message.
        Parameters:
        content - This message contents.
        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., do addEmbed(A).addEmbed(B).addEmbed(C).

        Parameters:
        spec - An EmbedCreateSpec 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 edited Message.
        Parameters:
        allowedMentions - This message allowed mentions.
        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.
      • asRequest

        public discord4j.discordjson.json.MessageEditRequest asRequest()
        Specified by:
        asRequest in interface Spec<discord4j.discordjson.json.MessageEditRequest>