Package org.javacord.api.event.message
Interface OptionalMessageEvent
-
- All Superinterfaces:
ChannelEvent
,Event
,MessageEvent
,TextChannelEvent
- All Known Subinterfaces:
MessageDeleteEvent
,ReactionAddEvent
,ReactionEvent
,ReactionRemoveAllEvent
,ReactionRemoveEvent
,RequestableMessageEvent
,SingleReactionEvent
public interface OptionalMessageEvent extends MessageEvent
A message event where the message is NOT guaranteed to be in the cache.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default java.util.Optional<java.lang.Boolean>
canYouReadMessageContent()
Gets whether you can read the content of the message.java.util.Optional<Message>
getMessage()
Gets the message from the cache.default java.util.Optional<java.util.List<MessageAttachment>>
getMessageAttachments()
Gets all attachments of the event's message.default java.util.Optional<MessageAuthor>
getMessageAuthor()
Gets the author of the event's message.default java.util.Optional<java.lang.String>
getMessageContent()
Gets the content of the event's message.default java.util.Optional<java.net.URL>
getMessageLink()
Gets the link of the event's message.default java.util.Optional<java.lang.String>
getReadableMessageContent()
Gets the readable content of the event's message.-
Methods inherited from interface org.javacord.api.event.message.MessageEvent
addReactionsToMessage, addReactionsToMessage, addReactionToMessage, addReactionToMessage, deleteMessage, deleteMessage, editMessage, editMessage, editMessage, editMessage, editMessage, getMessageId, getServer, pinMessage, removeAllReactionsFromMessage, removeOwnReactionByEmojiFromMessage, removeOwnReactionByEmojiFromMessage, removeOwnReactionsByEmojiFromMessage, removeOwnReactionsByEmojiFromMessage, removeReactionByEmojiFromMessage, removeReactionByEmojiFromMessage, removeReactionByEmojiFromMessage, removeReactionByEmojiFromMessage, removeReactionsByEmojiFromMessage, removeReactionsByEmojiFromMessage, removeReactionsByEmojiFromMessage, removeReactionsByEmojiFromMessage, unpinMessage
-
Methods inherited from interface org.javacord.api.event.channel.TextChannelEvent
getChannel, getPrivateChannel, getServerTextChannel, getServerThreadChannel
-
-
-
-
Method Detail
-
getMessage
java.util.Optional<Message> getMessage()
Gets the message from the cache.- Returns:
- The message from the cache.
-
canYouReadMessageContent
default java.util.Optional<java.lang.Boolean> canYouReadMessageContent()
Gets whether you can read the content of the message.- Returns:
- Whether you can read the content of the message.
- See Also:
Message.canYouReadContent()
-
getMessageAuthor
default java.util.Optional<MessageAuthor> getMessageAuthor()
Gets the author of the event's message.- Returns:
- The author of the event's message.
- See Also:
Message.getAuthor()
-
getMessageAttachments
default java.util.Optional<java.util.List<MessageAttachment>> getMessageAttachments()
Gets all attachments of the event's message.- Returns:
- All attachments of the event's message.
- Throws:
MissingIntentException
- If the message is present and not a single of the following requirements is met:- The bot has been mentioned in the message.
- Your are the author of the message.
- The message is a DM.
- The
Intent.MESSAGE_CONTENT
has been enabled in your code and Discord Developer dashboard
- See Also:
Message.getAttachments()
-
getMessageContent
default java.util.Optional<java.lang.String> getMessageContent()
Gets the content of the event's message.- Returns:
- The content of the event's message.
- Throws:
MissingIntentException
- If the message is present and not a single of the following requirements is met:- The bot has been mentioned in the message.
- Your are the author of the message.
- The message is a DM.
- The
Intent.MESSAGE_CONTENT
has been enabled in your code and Discord Developer dashboard
- See Also:
Message.getContent()
-
getReadableMessageContent
default java.util.Optional<java.lang.String> getReadableMessageContent()
Gets the readable content of the event's message.- Returns:
- The readable content of the event's message.
- Throws:
MissingIntentException
- If the message is present and not a single of the following requirements is met:- The bot has been mentioned in the message.
- Your are the author of the message.
- The message is a DM.
- The
Intent.MESSAGE_CONTENT
has been enabled in your code and Discord Developer dashboard
- See Also:
Message.getReadableContent()
-
getMessageLink
default java.util.Optional<java.net.URL> getMessageLink()
Gets the link of the event's message.- Returns:
- The link of the event's message.
- See Also:
Message.getLink()
-
-