Package com.mewna.catnip.entity.message
Interface Message
- All Superinterfaces:
Entity
,HasChannel
,Snowflake
,Timestamped
- All Known Implementing Classes:
MessageImpl
A single message in Discord.
- Since:
- 9/4/18.
- Author:
- amy
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic interface
static interface
static interface
static interface
Nested classes/interfaces inherited from interface com.mewna.catnip.entity.partials.Timestamped
Timestamped.TimestampStyle
-
Method Summary
Modifier and TypeMethodDescriptionactivity()
default MessageReference
List of files sent with the message.author()
Guild-agnostic representation of the author of the message.default io.reactivex.rxjava3.core.Maybe<MessageChannel>
channel()
The channel this message was sent in.content()
The message's content.default io.reactivex.rxjava3.core.Completable
delete()
default io.reactivex.rxjava3.core.Completable
default io.reactivex.rxjava3.core.Single<Message>
default io.reactivex.rxjava3.core.Single<Message>
default io.reactivex.rxjava3.core.Single<Message>
edit
(MessageOptions options) default io.reactivex.rxjava3.core.Single<Message>
When the message was last edited, if ever.embeds()
List of embeds in the message.default Set<MessageFlag>
flags()
int
flagsRaw()
default io.reactivex.rxjava3.core.Maybe<Guild>
guild()
The guild this message was sent in.default String
guildId()
The snowflake ID of the guild this message was sent in.long
The snowflake ID of the guild this message was sent in.default boolean
isGnome()
default boolean
member()
The author of the message, as a member of the guild.A list of members mentioned by this 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.default io.reactivex.rxjava3.core.Observable<Role>
List of roles @mentioned by this message.List of users @mentioned by this message.boolean
Whether the message mentions everyone.nonce()
The message's nonce snowflake.boolean
pinned()
Whether the message is pinned.default io.reactivex.rxjava3.core.Completable
Adds a reaction to this message.default io.reactivex.rxjava3.core.Completable
Adds a reaction to this message.List of reactions added to the message.The message that was referenced by this message.default io.reactivex.rxjava3.core.Single<Message>
Reply to this message.default io.reactivex.rxjava3.core.Single<Message>
reply
(MessageOptions options, boolean ping) Reply to this message.default io.reactivex.rxjava3.core.Single<Message>
Reply to this message.default io.reactivex.rxjava3.core.Single<Message>
Reply to this message.default io.reactivex.rxjava3.core.Single<Message>
Send a message in the same channel as this message.default io.reactivex.rxjava3.core.Single<Message>
Send a message in the same channel as this message.default io.reactivex.rxjava3.core.Single<Message>
respond
(MessageOptions options) Send a message in the same channel as this message.default io.reactivex.rxjava3.core.Single<Message>
Send a message in the same channel as this message.stickers()
When the message was sent.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.type()
The type of message.default String
The snowflake ID of the webhook this message was sent by.long
The snowflake ID of the webhook this message was sent by.Methods inherited from interface com.mewna.catnip.entity.partials.HasChannel
channelId, channelIdAsLong
Methods inherited from interface com.mewna.catnip.entity.partials.Snowflake
creationTime, creationTimestamp, id, idAsLong
Methods inherited from interface com.mewna.catnip.entity.partials.Timestamped
asDiscordTimestamp, parseTimestamp
-
Method Details
-
type
The type of message. Use this to tell normal messages from system messages.- Returns:
- enum representing the message type. Never null.
-
tts
@CheckReturnValue 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.- Returns:
- True if the message is to be spoken, false otherwise.
-
timestamp
When the message was sent.- Returns:
Date and time
the message was sent.
-
pinned
@CheckReturnValue boolean pinned()Whether the message is pinned.
This will always be false on new messages.- Returns:
- True if the message is pinned, false otherwise.
-
mentionsEveryone
@CheckReturnValue boolean mentionsEveryone()Whether the message mentions everyone.- Returns:
- True if the message mentions everyone, false otherwise.
-
nonce
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.- Returns:
- unique String nonce for the message. Can be null.
-
mentionedUsers
List of users @mentioned by this message.- Returns:
- List of Users. Never null.
-
mentionedMembers
A list of members mentioned by this message. Will contain the same users asmentionedUsers()
. Will always be empty for DMs.- Returns:
- List of members. Never null.
-
referencedMessage
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.- Returns:
- A message reference.
-
mentionedRoles
List of roles @mentioned by this message.
All users with these roles will also be mentioned- Returns:
- List of roles. Never null.
-
mentionedRoleIds
List of the ids of all roles @mentioned by this message.
All users with at least one of these roles will also be mentioned.- Returns:
- List of role ids. Never null.
-
member
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.- Returns:
- Member representation of the
author
. Can be null.
-
embeds
List of embeds in the message.- Returns:
- List of embeds. Never null.
-
editedTimestamp
When the message was last edited, if ever.
Previous edits are not exposed, only the most recent.- Returns:
- The
date and time
the message was last edited. Null if the message was never edited.
-
content
The message's content. Is just an empty string for embed-only messages.- Returns:
- String containing the message body. Never null.
-
channel
The channel this message was sent in.- Returns:
- The
MessageChannel
object representing the channel this message was sent in. Should not be null.
-
author
Guild-agnostic representation of the author of the message.- Returns:
- The author of the message. Never null.
- See Also:
-
attachments
List of files sent with the message.- Returns:
- List of files sent with the message. Never null.
-
reactions
List of reactions added to the message.
This list will not be updated.- Returns:
- List of reactions added to the message. Never null.
-
activity
- Returns:
- The message's activity. Sent in Rich Presence-related embeds. May be null.
-
application
- Returns:
- The message's application. Sent in Rich Presence-related embeds. May be null.
-
messageReference
- Returns:
- Reference data sent with crossposted messages.
-
flagsRaw
@CheckReturnValue int flagsRaw()- Returns:
- Raw bits of flags set on this message.
-
stickers
- Returns:
- The stickers sent with this message.
-
flags
- Returns:
- The set of flags set on this message.
-
mentionedChannels
- 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.
-
components
- Returns:
- All components attached to this message. Top-level components
must be
ActionRow
s.
-
guildId
The snowflake ID of the guild this message was sent in.- Returns:
- String representing the guild ID. Null if sent in DMs, or if fetched/created via REST API.
-
guildIdAsLong
@CheckReturnValue long guildIdAsLong()The snowflake ID of the guild this message was sent in.- Returns:
- Long representing the guild ID. Null if sent in DMs.
-
guild
The guild this message was sent in. May be null.- Returns:
- The
Guild
object for the guild this message was sent in. Will be null if the message is a DM.
-
webhookId
The snowflake ID of the webhook this message was sent by.- Returns:
- String representing the webhook ID. Null if not sent by a webhook.
-
webhookIdAsLong
@CheckReturnValue long webhookIdAsLong()The snowflake ID of the webhook this message was sent by.- Returns:
- Long representing the webhook ID.
0
if not sent by a webhook.
-
asReference
- Returns:
- A reference to this message, usable for ex. quoting.
-
react
Adds a reaction to this message.
Note: this object will not be updated.- Parameters:
emoji
- Emoji to react with.- Returns:
- Future for the reaction.
-
react
Adds a reaction to this message.
Note: this object will not be updated.- Parameters:
emoji
- Emoji to react with.- Returns:
- Future for the reaction.
-
delete
-
delete
@Nonnull @CheckReturnValue default io.reactivex.rxjava3.core.Completable delete() -
edit
-
edit
-
edit
-
edit
@Nonnull @CheckReturnValue default io.reactivex.rxjava3.core.Single<Message> edit(@Nonnull MessageOptions options) -
respond
@Nonnull @CheckReturnValue default io.reactivex.rxjava3.core.Single<Message> respond(@Nonnull String content) Send a message in the same channel as this message. This does not send a reply; seereply(String, boolean)
for that functionality.- Parameters:
content
- The message data to respond with.- Returns:
- A
Single
that completes with the newly-created message.
-
respond
@Nonnull @CheckReturnValue default io.reactivex.rxjava3.core.Single<Message> respond(@Nonnull Embed embed) Send a message in the same channel as this message. This does not send a reply; seereply(Embed, boolean)
for that functionality.- Parameters:
embed
- The message data to respond with.- Returns:
- A
Single
that completes with the newly-created message.
-
respond
@Nonnull @CheckReturnValue default io.reactivex.rxjava3.core.Single<Message> respond(@Nonnull Message message) Send a message in the same channel as this message. This does not send a reply; seereply(Message, boolean)
for that functionality.- Parameters:
message
- The message data to respond with.- Returns:
- A
Single
that completes with the newly-created message.
-
respond
@Nonnull @CheckReturnValue default io.reactivex.rxjava3.core.Single<Message> respond(@Nonnull MessageOptions options) Send a message in the same channel as this message. This does not send a reply; seereply(MessageOptions, boolean)
for that functionality.- Parameters:
options
- The message data to respond with.- Returns:
- A
Single
that completes with the newly-created message.
-
reply
@Nonnull @CheckReturnValue default io.reactivex.rxjava3.core.Single<Message> reply(@Nonnull String content, boolean ping) Reply to this message. This uses Discord's inline replies feature.- Parameters:
content
- The message data to reply with.ping
- Whether or not the reply should ping the user.- Returns:
- A
Single
that completes with the newly-created message.
-
reply
@Nonnull @CheckReturnValue default io.reactivex.rxjava3.core.Single<Message> reply(@Nonnull Embed embed, boolean ping) Reply to this message. This uses Discord's inline replies feature.- Parameters:
embed
- The message data to reply with.ping
- Whether or not the reply should ping the user.- Returns:
- A
Single
that completes with the newly-created message.
-
reply
@Nonnull @CheckReturnValue default io.reactivex.rxjava3.core.Single<Message> reply(@Nonnull Message message, boolean ping) Reply to this message. This uses Discord's inline replies feature.- Parameters:
message
- The message data to reply with.ping
- Whether or not the reply should ping the user.- Returns:
- A
Single
that completes with the newly-created message.
-
reply
@Nonnull @CheckReturnValue default io.reactivex.rxjava3.core.Single<Message> reply(@Nonnull MessageOptions options, boolean ping) Reply to this message. This uses Discord's inline replies feature.- Parameters:
options
- The message data to reply with.- Returns:
- A
Single
that completes with the newly-created message.
-
isRickRoll
default boolean isRickRoll() -
isGnome
default boolean isGnome()
-