Class MessageCreateSpec

    • Constructor Detail

      • MessageCreateSpec

        public MessageCreateSpec()
    • Method Detail

      • setContent

        public MessageCreateSpec setContent​(String content)
        Sets the created Message contents, up to 2000 characters.
        Parameters:
        content - The message contents.
        Returns:
        This spec.
      • setNonce

        public MessageCreateSpec setNonce​(Snowflake nonce)
        Sets a nonce that can be used for optimistic message sending.
        Parameters:
        nonce - An identifier.
        Returns:
        This spec.
      • setTts

        public MessageCreateSpec setTts​(boolean tts)
        Sets whether the created Message is a TTS message.
        Parameters:
        tts - If this message is a TTS message.
        Returns:
        This spec.
      • addEmbed

        public MessageCreateSpec addEmbed​(Consumer<? super EmbedCreateSpec> spec)
        Adds an embed to the message.

        A message may have up to 10 embeds.

        Parameters:
        spec - An EmbedCreateSpec consumer used to attach rich content when creating a message.
        Returns:
        This spec.
      • addFile

        public MessageCreateSpec addFile​(String fileName,
                                         InputStream file)
        Adds a file as attachment to the created Message.
        Parameters:
        fileName - The filename used in the file being sent.
        file - The file contents.
        Returns:
        This spec.
      • addFileSpoiler

        public MessageCreateSpec addFileSpoiler​(String fileName,
                                                InputStream file)
        Adds a spoiler file as attachment to the created Message.
        Parameters:
        fileName - The filename used in the file being sent.
        file - The file contents.
        Returns:
        This spec.
      • setAllowedMentions

        public MessageCreateSpec setAllowedMentions​(@Nullable
                                                    AllowedMentions allowedMentions)
        Sets an allowed mentions object to the message spec. Can be null to reset a configuration added by default.
        Parameters:
        allowedMentions - The allowed mentions to add.
        Returns:
        This spec.
      • setMessageReference

        public MessageCreateSpec setMessageReference​(Snowflake messageId)
        Adds a message ID to reply to. This requires the Permission.READ_MESSAGE_HISTORY permission, and the referenced message must exist and cannot be a system message.
        Parameters:
        messageId - The ID of the message to reply to.
        Returns:
        This spec.
      • setComponents

        public MessageCreateSpec setComponents​(LayoutComponent... components)
        Sets the components of the message.
        Parameters:
        components - The message components.
        Returns:
        This spec.
      • setComponents

        public MessageCreateSpec setComponents​(List<LayoutComponent> components)
        Sets the components of the message.
        Parameters:
        components - The message components.
        Returns:
        This spec.