Class MessageReceivedEvent
java.lang.Object
net.dv8tion.jda.api.events.Event
net.dv8tion.jda.api.events.message.GenericMessageEvent
net.dv8tion.jda.api.events.message.MessageReceivedEvent
- All Implemented Interfaces:
GenericEvent
Indicates that a Message was received in a
This includes
MessageChannel
.
This includes
TextChannel
and PrivateChannel
!
Can be used to detect that a Message is received in either a guild- or private channel. Providing a MessageChannel and Message.
Requirements
This event requires at least one of the following intents (Will not fire at all if neither is enabled):
GUILD_MESSAGES
to work in guild text channelsDIRECT_MESSAGES
to work in private channels
-
Constructor Summary
-
Method Summary
Methods inherited from class net.dv8tion.jda.api.events.message.GenericMessageEvent
getChannel, getChannelType, getGuild, getGuildChannel, getMessageId, getMessageIdLong, getNewsChannel, getPrivateChannel, getTextChannel, getThreadChannel, isFromGuild, isFromThread, isFromType
Methods inherited from class net.dv8tion.jda.api.events.Event
getJDA, getResponseNumber
-
Constructor Details
-
MessageReceivedEvent
-
-
Method Details
-
getMessage
The receivedMessage
object.- Returns:
- The received
Message
object.
-
getAuthor
The Author of the Message received asUser
object.
This will be never-null but might be a fake user if Message was sent via Webhook (Guild only). SeeWebhook.getDefaultUser()
.- Returns:
- The Author of the Message.
- See Also:
-
getMember
The Author of the Message received asMember
object.
This will benull
in case of Message being received in aPrivateChannel
orisWebhookMessage()
returningtrue
.- Returns:
- The Author of the Message as null-able Member object.
- See Also:
-
isWebhookMessage
public boolean isWebhookMessage()Whether or not the Message received was sent via a Webhook.
This is a shortcut forgetMessage().isWebhookMessage()
.- Returns:
- True, if the Message was sent via Webhook
-