Class MessageImpl
java.lang.Object
com.mewna.catnip.entity.impl.message.MessageImpl
- All Implemented Interfaces:
Entity
,Message
,HasChannel
,Snowflake
,Timestamped
,RequiresCatnip
- Since:
- 9/2/18.
- Author:
- amy
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.mewna.catnip.entity.message.Message
Message.Attachment, Message.MessageActivity, Message.MessageApplication, Message.Reaction
Nested classes/interfaces inherited from interface com.mewna.catnip.entity.partials.Timestamped
Timestamped.TimestampStyle
-
Constructor Summary
ConstructorDescriptionMessageImpl
(Catnip catnip, long idAsLong, long channelIdAsLong, User author, String content, String timestamp, String editedTimestamp, boolean tts, boolean mentionsEveryone, List<User> mentionedUsers, List<Member> mentionedMembers, List<String> mentionedRoleIds, List<Message.Attachment> attachments, List<Embed> embeds, List<Message.Reaction> reactions, Message.MessageActivity activity, Message.MessageApplication application, MessageReference messageReference, String nonce, boolean pinned, long webhookIdAsLong, MessageType type, Member member, long guildIdAsLong, int flagsRaw, List<ChannelMention> mentionedChannels, Message referencedMessage, List<Sticker> stickers, List<MessageComponent> components) -
Method Summary
Modifier and TypeMethodDescriptionactivity()
activity
(Message.MessageActivity activity) application
(Message.MessageApplication application) List of files sent with the message.attachments
(List<Message.Attachment> attachments) author()
Guild-agnostic representation of the author of the message.builder()
catnip()
Returns the catnip instance associated with this entity.void
long
channelIdAsLong
(long channelIdAsLong) components
(List<MessageComponent> components) content()
The message's content.When the message was last edited, if ever.editedTimestamp
(String editedTimestamp) embeds()
List of embeds in the message.boolean
int
flagsRaw()
flagsRaw
(int flagsRaw) long
The snowflake ID of the guild this message was sent in.guildIdAsLong
(long guildIdAsLong) int
hashCode()
long
idAsLong()
The ID of this snowflake, as a long.idAsLong
(long idAsLong) member()
The author of the message, as a member of the guild.mentionedChannels
(List<ChannelMention> mentionedChannels) A list of members mentioned by this message.mentionedMembers
(List<Member> mentionedMembers) List of the ids of all roles @mentioned by this message.
All users with at least one of these roles will also be mentioned.mentionedRoleIds
(List<String> mentionedRoleIds) List of users @mentioned by this message.mentionedUsers
(List<User> mentionedUsers) boolean
Whether the message mentions everyone.mentionsEveryone
(boolean mentionsEveryone) messageReference
(MessageReference messageReference) nonce()
The message's nonce snowflake.boolean
pinned()
Whether the message is pinned.pinned
(boolean pinned) List of reactions added to the message.reactions
(List<Message.Reaction> reactions) The message that was referenced by this message.referencedMessage
(Message referencedMessage) stickers()
When the message was sent.toString()
boolean
tts()
Whether or not the message was sent using the /TTS command, making clients read
the message aloud using their text-to-speech engine.tts
(boolean tts) type()
The type of message.type
(MessageType type) long
The snowflake ID of the webhook this message was sent by.webhookIdAsLong
(long webhookIdAsLong) Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.mewna.catnip.entity.partials.HasChannel
channelId
Methods inherited from interface com.mewna.catnip.entity.message.Message
asReference, channel, delete, delete, edit, edit, edit, edit, flags, guild, guildId, isGnome, isRickRoll, mentionedRoles, react, react, reply, reply, reply, reply, respond, respond, respond, respond, webhookId
Methods inherited from interface com.mewna.catnip.entity.partials.Snowflake
creationTime, creationTimestamp, id
Methods inherited from interface com.mewna.catnip.entity.partials.Timestamped
asDiscordTimestamp, parseTimestamp
-
Constructor Details
-
MessageImpl
public MessageImpl() -
MessageImpl
public MessageImpl(Catnip catnip, long idAsLong, long channelIdAsLong, User author, String content, String timestamp, String editedTimestamp, boolean tts, boolean mentionsEveryone, List<User> mentionedUsers, List<Member> mentionedMembers, List<String> mentionedRoleIds, List<Message.Attachment> attachments, List<Embed> embeds, List<Message.Reaction> reactions, Message.MessageActivity activity, Message.MessageApplication application, MessageReference messageReference, String nonce, boolean pinned, long webhookIdAsLong, MessageType type, Member member, long guildIdAsLong, int flagsRaw, List<ChannelMention> mentionedChannels, Message referencedMessage, List<Sticker> stickers, List<MessageComponent> components)
-
-
Method Details
-
catnip
- Specified by:
catnip
in interfaceRequiresCatnip
-
timestamp
Description copied from interface:Message
When the message was sent.- Specified by:
timestamp
in interfaceMessage
- Returns:
Date and time
the message was sent.
-
editedTimestamp
Description copied from interface:Message
When the message was last edited, if ever.
Previous edits are not exposed, only the most recent.- Specified by:
editedTimestamp
in interfaceMessage
- Returns:
- The
date and time
the message was last edited. Null if the message was never edited.
-
attachments
Description copied from interface:Message
List of files sent with the message.- Specified by:
attachments
in interfaceMessage
- Returns:
- List of files sent with the message. Never null.
-
reactions
Description copied from interface:Message
List of reactions added to the message.
This list will not be updated. -
hashCode
public int hashCode() -
equals
-
toString
-
builder
-
catnip
Description copied from interface:Entity
Returns the catnip instance associated with this entity. -
idAsLong
public long idAsLong()Description copied from interface:Snowflake
The ID of this snowflake, as a long. -
channelIdAsLong
public long channelIdAsLong()- Specified by:
channelIdAsLong
in interfaceHasChannel
-
author
Description copied from interface:Message
Guild-agnostic representation of the author of the message. -
content
Description copied from interface:Message
The message's content. Is just an empty string for embed-only messages. -
tts
public boolean tts()Description copied from interface:Message
Whether or not the message was sent using the /TTS command, making clients read
the message aloud using their text-to-speech engine. -
mentionsEveryone
public boolean mentionsEveryone()Description copied from interface:Message
Whether the message mentions everyone.- Specified by:
mentionsEveryone
in interfaceMessage
- Returns:
- True if the message mentions everyone, false otherwise.
-
mentionedUsers
Description copied from interface:Message
List of users @mentioned by this message.- Specified by:
mentionedUsers
in interfaceMessage
- Returns:
- List of Users. Never null.
-
mentionedMembers
Description copied from interface:Message
A list of members mentioned by this message. Will contain the same users asMessage.mentionedUsers()
. Will always be empty for DMs.- Specified by:
mentionedMembers
in interfaceMessage
- Returns:
- List of members. Never null.
-
mentionedRoleIds
Description copied from interface:Message
List of the ids of all roles @mentioned by this message.
All users with at least one of these roles will also be mentioned.- Specified by:
mentionedRoleIds
in interfaceMessage
- Returns:
- List of role ids. Never null.
-
embeds
Description copied from interface:Message
List of embeds in the message. -
activity
-
application
- Specified by:
application
in interfaceMessage
- Returns:
- The message's application. Sent in Rich Presence-related embeds. May be null.
-
messageReference
- Specified by:
messageReference
in interfaceMessage
- Returns:
- Reference data sent with crossposted messages.
-
nonce
Description copied from interface:Message
The message's nonce snowflake.
Nonces are used to validating messages have been sent, as two identical messages
with the same nonce are considered to be re-sent due to network errors. -
pinned
public boolean pinned()Description copied from interface:Message
Whether the message is pinned.
This will always be false on new messages. -
webhookIdAsLong
public long webhookIdAsLong()Description copied from interface:Message
The snowflake ID of the webhook this message was sent by.- Specified by:
webhookIdAsLong
in interfaceMessage
- Returns:
- Long representing the webhook ID.
0
if not sent by a webhook.
-
type
Description copied from interface:Message
The type of message. Use this to tell normal messages from system messages. -
member
Description copied from interface:Message
The author of the message, as a member of the guild.
Can be null if the author is no longer in the guild, or if the message was sent
by a fake user. -
guildIdAsLong
public long guildIdAsLong()Description copied from interface:Message
The snowflake ID of the guild this message was sent in.- Specified by:
guildIdAsLong
in interfaceMessage
- Returns:
- Long representing the guild ID. Null if sent in DMs.
-
flagsRaw
public int flagsRaw() -
mentionedChannels
- Specified by:
mentionedChannels
in interfaceMessage
- Returns:
- All channels mentioned in this message. Not all messages will have this, nor will all channels mentioned in a message have a corresponding mention object.
-
referencedMessage
Description copied from interface:Message
The message that was referenced by this message. Used for inline replies. Ifnull
, the message was deleted. If present and notnull
, it is the message that this message is replying to. If not present and the type isMessageType.REPLY
, the backend couldn't fetch the relevant message.- Specified by:
referencedMessage
in interfaceMessage
- Returns:
- A message reference.
-
stickers
-
components
- Specified by:
components
in interfaceMessage
- Returns:
- All components attached to this message. Top-level components
must be
ActionRow
s.
-
idAsLong
- Returns:
this
.
-
channelIdAsLong
- Returns:
this
.
-
author
- Returns:
this
.
-
content
- Returns:
this
.
-
timestamp
- Returns:
this
.
-
editedTimestamp
- Returns:
this
.
-
tts
- Returns:
this
.
-
mentionsEveryone
- Returns:
this
.
-
mentionedUsers
- Returns:
this
.
-
mentionedMembers
- Returns:
this
.
-
mentionedRoleIds
- Returns:
this
.
-
attachments
- Returns:
this
.
-
embeds
- Returns:
this
.
-
reactions
- Returns:
this
.
-
activity
- Returns:
this
.
-
application
- Returns:
this
.
-
messageReference
- Returns:
this
.
-
nonce
- Returns:
this
.
-
pinned
- Returns:
this
.
-
webhookIdAsLong
- Returns:
this
.
-
type
- Returns:
this
.
-
member
- Returns:
this
.
-
guildIdAsLong
- Returns:
this
.
-
flagsRaw
- Returns:
this
.
-
mentionedChannels
- Returns:
this
.
-
referencedMessage
- Returns:
this
.
-
stickers
- Returns:
this
.
-
components
- Returns:
this
.
-