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_MESSAGESto work in guild text channelsDIRECT_MESSAGESto work in private channels
-
Constructor Summary
Constructors -
Method Summary
Methods inherited from class net.dv8tion.jda.api.events.message.GenericMessageEvent
getChannel, getChannelType, getGuild, getGuildChannel, getJumpUrl, getMessageId, getMessageIdLong, isFromGuild, isFromThread, isFromTypeMethods inherited from class net.dv8tion.jda.api.events.Event
getJDA, getRawData, getResponseNumber, toString
-
Constructor Details
-
MessageReceivedEvent
-
-
Method Details
-
getMessage
The receivedMessageobject.- Returns:
- The received
Messageobject.
-
getAuthor
The Author of the Message received asUserobject.
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 asMemberobject.
This will benullin case of Message being received in aPrivateChannelorisWebhookMessage()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
-