Class GuildMessageReceivedEvent
- java.lang.Object
-
- net.dv8tion.jda.api.events.Event
-
- net.dv8tion.jda.api.events.guild.GenericGuildEvent
-
- net.dv8tion.jda.api.events.message.guild.GenericGuildMessageEvent
-
- net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent
-
- All Implemented Interfaces:
GenericEvent
public class GuildMessageReceivedEvent extends GenericGuildMessageEvent
Indicates that a Message is received in aTextChannel
.Can be used to retrieve the affected TextChannel and Message.
Requirements
This event requires the
GUILD_MESSAGES
intent to be enabled.
-
-
Constructor Summary
Constructors Constructor Description GuildMessageReceivedEvent(JDA api, long responseNumber, Message message)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description User
getAuthor()
The Author of the Message received asUser
object.Member
getMember()
The Author of the Message received asMember
object.Message
getMessage()
The receivedMessage
object.boolean
isWebhookMessage()
Whether or not the Message received was sent via a Webhook.-
Methods inherited from class net.dv8tion.jda.api.events.message.guild.GenericGuildMessageEvent
getChannel, getMessageId, getMessageIdLong
-
Methods inherited from class net.dv8tion.jda.api.events.guild.GenericGuildEvent
getGuild
-
Methods inherited from class net.dv8tion.jda.api.events.Event
getJDA, getResponseNumber
-
-
-
-
Method Detail
-
getMessage
@Nonnull public Message getMessage()
The receivedMessage
object.- Returns:
- The received
Message
object.
-
getAuthor
@Nonnull public User 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. SeeWebhook.getDefaultUser()
.- Returns:
- The Author of the Message.
- See Also:
isWebhookMessage()
-
getMember
@Nullable public Member getMember()
The Author of the Message received asMember
object.
This will benull
in case ofisWebhookMessage()
returningtrue
.- Returns:
- The Author of the Message as Member object.
- See Also:
isWebhookMessage()
-
isWebhookMessage
public boolean isWebhookMessage()
Whether or not the Message received was sent via a Webhook.
This is a shortcut forgetMessage().isWebhookMessage()
.- Returns:
- Whether or not the Message was sent via Webhook
-
-