public class MessageImpl extends java.lang.Object implements Message
Message.Attachment
Constructor and Description |
---|
MessageImpl(java.lang.String id,
MessageChannel channel) |
MessageImpl(java.lang.String id,
MessageChannel channel,
MessageType type) |
Modifier and Type | Method and Description |
---|---|
RestAction<java.lang.Void> |
deleteMessage()
Deletes this Message from the server.
|
RestAction<Message> |
editMessage(Message newContent)
Edits this Messages content to be the content of the provide message.
|
RestAction<Message> |
editMessage(java.lang.String newContent)
Edits this Messages content to the provided String.
|
boolean |
equals(java.lang.Object o) |
java.util.List<Message.Attachment> |
getAttachments()
An unmodifiable list of
Attachment that are attached to this message.Most likely this will only ever be 1 Attachment at most. |
User |
getAuthor()
The author of this Message
|
MessageChannel |
getChannel()
Returns the
MessageChannel that this message was sent in |
java.lang.String |
getContent()
The textual content of this message.
|
java.time.OffsetDateTime |
getEditedTime()
Gives a copy of the Object holding the time this message was last recently updated
If this message was never updated (
Message.isEdited() returns false), this will be NULL |
java.util.List<MessageEmbed> |
getEmbeds()
An unmodifiable list of
MessageEmbeds that are available to this message. |
Guild |
getGuild() |
java.lang.String |
getId()
The Snowflake id of this entity.
|
JDA |
getJDA()
Returns the
JDA instance of this Message |
java.util.List<TextChannel> |
getMentionedChannels()
A immutable list of all mentioned
TextChannels . |
java.util.List<Role> |
getMentionedRoles()
A immutable list of all mentioned
Roles . |
java.util.List<User> |
getMentionedUsers()
A immutable list of all mentioned users.
|
PrivateChannel |
getPrivateChannel() |
java.lang.String |
getRawContent()
The raw textual content of this message.
|
java.lang.String |
getStrippedContent()
The content, with all its formatting characters stripped.
|
TextChannel |
getTextChannel() |
MessageType |
getType()
This specifies the type of Message sent.
|
int |
hashCode() |
boolean |
isEdited()
Returns true, if this Message was edited as least once
|
boolean |
isMentioned(User user)
Checks if given user was mentioned in this message in any way (@User, @everyone, @here).
|
boolean |
isPinned()
Whether or not this Message has been pinned in its parent channel.
|
boolean |
isPrivate()
Checks, whether this Message was sent in a
PrivateChannel (Private Message),
or in a TextChannel (sent in Guild channel) |
boolean |
isTTS()
Is this Message supposed to be TTS (Text-to-speach)
|
boolean |
mentionsEveryone()
Is this Message mentioning everyone using @everyone or @here?
In
PrivateChannel's , this always returns false |
RestAction<java.lang.Void> |
pin()
This is a shortcut method to
MessageChannel.pinMessageById(String) .If this method returns true, then the action was successful and this Message's Message.isPinned() will now return true. |
MessageImpl |
setAttachments(java.util.List<Message.Attachment> attachments) |
MessageImpl |
setAuthor(User author) |
MessageImpl |
setContent(java.lang.String content) |
MessageImpl |
setEditedTime(java.time.OffsetDateTime editedTime) |
MessageImpl |
setEmbeds(java.util.List<MessageEmbed> embeds) |
MessageImpl |
setMentionedChannels(java.util.List<TextChannel> mentionedChannels) |
MessageImpl |
setMentionedRoles(java.util.List<Role> mentionedRoles) |
MessageImpl |
setMentionedUsers(java.util.List<User> mentionedUsers) |
MessageImpl |
setMentionsEveryone(boolean mentionsEveryone) |
MessageImpl |
setPinned(boolean pinned) |
MessageImpl |
setTime(java.time.OffsetDateTime time) |
MessageImpl |
setTTS(boolean TTS) |
java.lang.String |
toString() |
RestAction<java.lang.Void> |
unpin()
This is a shortcut method to
MessageChannel.unpinMessageById(String) .If this method returns true, then the action was successful and this Message's Message.isPinned() will now return false. |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getCreationTime
public MessageImpl(java.lang.String id, MessageChannel channel)
public MessageImpl(java.lang.String id, MessageChannel channel, MessageType type)
public JDA getJDA()
Message
JDA
instance of this Messagepublic boolean isPinned()
Message
public RestAction<java.lang.Void> pin()
Message
MessageChannel.pinMessageById(String)
.Message.isPinned()
will now return true.public RestAction<java.lang.Void> unpin()
Message
MessageChannel.unpinMessageById(String)
.Message.isPinned()
will now return false.public MessageImpl setPinned(boolean pinned)
public MessageType getType()
Message
public java.lang.String getId()
ISnowflake
getId
in interface ISnowflake
public java.util.List<User> getMentionedUsers()
Message
PrivateChannel's
, this always returns an empty ListgetMentionedUsers
in interface Message
public boolean isMentioned(User user)
Message
isMentioned
in interface Message
user
- The user to check on.public java.util.List<TextChannel> getMentionedChannels()
Message
TextChannels
. if none were mentioned, this list is empty
In PrivateChannel's
, this always returns an empty ListgetMentionedChannels
in interface Message
public java.util.List<Role> getMentionedRoles()
Message
Roles
. if none were mentioned, this list is empty
In PrivateChannel's
, this always returns an empty ListgetMentionedRoles
in interface Message
public boolean mentionsEveryone()
Message
PrivateChannel's
, this always returns falsementionsEveryone
in interface Message
public boolean isEdited()
Message
public java.time.OffsetDateTime getEditedTime()
Message
Message.isEdited()
returns false), this will be NULLgetEditedTime
in interface Message
public User getAuthor()
Message
public java.lang.String getContent()
Message
Message.getRawContent()
insteadgetContent
in interface Message
public java.lang.String getRawContent()
Message
getRawContent
in interface Message
public MessageChannel getChannel()
Message
MessageChannel
that this message was sent ingetChannel
in interface Message
public PrivateChannel getPrivateChannel()
getPrivateChannel
in interface Message
public TextChannel getTextChannel()
getTextChannel
in interface Message
public java.util.List<Message.Attachment> getAttachments()
Message
Attachment
that are attached to this message.Attachment
at most.getAttachments
in interface Message
Attachments
.public java.util.List<MessageEmbed> getEmbeds()
Message
MessageEmbeds
that are available to this message.public boolean isPrivate()
Message
PrivateChannel
(Private Message),
or in a TextChannel
(sent in Guild channel)public boolean isTTS()
Message
public RestAction<Message> editMessage(java.lang.String newContent)
Message
editMessage
in interface Message
newContent
- the new content of the Messagepublic RestAction<Message> editMessage(Message newContent)
Message
editMessage
in interface Message
newContent
- the new content of the Messagepublic RestAction<java.lang.Void> deleteMessage()
Message
MESSAGE_MANAGE Permission
will have no effectdeleteMessage
in interface Message
RestAction
public MessageImpl setMentionedUsers(java.util.List<User> mentionedUsers)
public MessageImpl setMentionedChannels(java.util.List<TextChannel> mentionedChannels)
public MessageImpl setMentionedRoles(java.util.List<Role> mentionedRoles)
public MessageImpl setMentionsEveryone(boolean mentionsEveryone)
public MessageImpl setTTS(boolean TTS)
public MessageImpl setTime(java.time.OffsetDateTime time)
public MessageImpl setEditedTime(java.time.OffsetDateTime editedTime)
public MessageImpl setAuthor(User author)
public MessageImpl setContent(java.lang.String content)
public MessageImpl setAttachments(java.util.List<Message.Attachment> attachments)
public MessageImpl setEmbeds(java.util.List<MessageEmbed> embeds)
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String getStrippedContent()
Message
getStrippedContent
in interface Message