Class ReadonlyMessage
- java.lang.Object
-
- club.minnced.discord.webhook.receive.ReadonlyMessage
-
- All Implemented Interfaces:
org.json.JSONString
public class ReadonlyMessage extends Object implements org.json.JSONString
Readonly message representation used for responses ofWebhookClient
send methods.- See Also:
toWebhookMessage()
-
-
Constructor Summary
Constructors Constructor Description ReadonlyMessage(long id, long channelId, boolean mentionsEveryone, boolean tts, int flags, @NotNull ReadonlyUser author, @NotNull String content, @NotNull List<ReadonlyEmbed> embeds, @NotNull List<ReadonlyAttachment> attachments, @NotNull List<ReadonlyUser> mentionedUsers, @NotNull List<Long> mentionedRoles)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description @NotNull List<ReadonlyAttachment>
getAttachments()
The attachments of this message.@NotNull ReadonlyUser
getAuthor()
The author of this message, represented by aReadonlyUser
instance.long
getChannelId()
The channel id for the channel this message was sent in@NotNull String
getContent()
The content of this message, this is displayed above embeds and attachments.@NotNull List<ReadonlyEmbed>
getEmbeds()
The embeds in this message, a webhook can send up to 10 embeds in one message.int
getFlags()
The flags for this message.long
getId()
The id of this message.@NotNull List<Long>
getMentionedRoles()
List of mentioned role ids@NotNull List<ReadonlyUser>
getMentionedUsers()
Users mentioned by this message.boolean
isMentionsEveryone()
Whether this message mentioned everyone/hereboolean
isTTS()
Whether this message used Text-to-Speech (TTS)String
toJSONString()
String
toString()
JSON representation of this provider@NotNull WebhookMessage
toWebhookMessage()
Converts this message to a reduced webhook message.
-
-
-
Constructor Detail
-
ReadonlyMessage
public ReadonlyMessage(long id, long channelId, boolean mentionsEveryone, boolean tts, int flags, @NotNull @NotNull ReadonlyUser author, @NotNull @NotNull String content, @NotNull @NotNull List<ReadonlyEmbed> embeds, @NotNull @NotNull List<ReadonlyAttachment> attachments, @NotNull @NotNull List<ReadonlyUser> mentionedUsers, @NotNull @NotNull List<Long> mentionedRoles)
-
-
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 useMessageFlags
to determine which flags are set.- Returns:
- The flags
-
getAuthor
@NotNull public @NotNull ReadonlyUser getAuthor()
The author of this message, represented by aReadonlyUser
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
-
getAttachments
@NotNull public @NotNull List<ReadonlyAttachment> getAttachments()
The attachments of this message. This contains files added through methods such asWebhookMessageBuilder.addFile(java.io.File)
.
The attachments only contain meta-data and not the actual files.- Returns:
- List of attachments
-
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
-
toJSONString
public String toJSONString()
- Specified by:
toJSONString
in interfaceorg.json.JSONString
-
-