Class ReadonlyMessage

  • All Implemented Interfaces:
    org.json.JSONString

    public class ReadonlyMessage
    extends Object
    implements org.json.JSONString
    Readonly message representation used for responses of WebhookClient send methods.
    See Also:
    toWebhookMessage()
    • Constructor Detail

    • Method Detail

      • getId

        public long getId()
        The id of this message.
        If this message is the beginning of a thread, then this is the thread id.
        Returns:
        The id
      • getChannelId

        public long getChannelId()
        The channel id for the channel this message was sent in
        Returns:
        The channel id
      • isMentionsEveryone

        public boolean isMentionsEveryone()
        Whether this message mentioned everyone/here
        Returns:
        True, if this message mentioned everyone/here
      • isTTS

        public boolean isTTS()
        Whether this message used Text-to-Speech (TTS)
        Returns:
        True, if this message used TTS
      • getFlags

        public int getFlags()
        The flags for this message.
        You can use MessageFlags to determine which flags are set.
        Returns:
        The flags
      • getAuthor

        @NotNull
        public @NotNull ReadonlyUser getAuthor()
        The author of this message, represented by a ReadonlyUser instance.
        Returns:
        The author
      • getContent

        @NotNull
        public @NotNull String getContent()
        The content of this message, this is displayed above embeds and attachments.
        Returns:
        The content
      • getEmbeds

        @NotNull
        public @NotNull List<ReadonlyEmbed> getEmbeds()
        The embeds in this message, a webhook can send up to 10 embeds in one message. Additionally this contains embeds generated from links.
        Returns:
        List of embeds for this message
      • getMentionedUsers

        @NotNull
        public @NotNull List<ReadonlyUser> getMentionedUsers()
        Users mentioned by this message.
        This will not contain all users when using an everyone/here mention, it only contains directly mentioned users.
        Returns:
        List of mentioned users.
      • getMentionedRoles

        @NotNull
        public @NotNull List<Long> getMentionedRoles()
        List of mentioned role ids
        Returns:
        List of ids for directly mentioned roles
      • toWebhookMessage

        @NotNull
        public @NotNull WebhookMessage toWebhookMessage()
        Converts this message to a reduced webhook message.
        This can be used for sending.
        Returns:
        WebhookMessage
      • toString

        public String toString()
        JSON representation of this provider
        Overrides:
        toString in class Object
        Returns:
        The JSON representation
      • toJSONString

        public String toJSONString()
        Specified by:
        toJSONString in interface org.json.JSONString