Class CommandEvent
MessageReceivedEvent,
CommandClient, and String user arguments
compatible with all Commands.
From here, developers can invoke several useful and specialized methods to assist in Command function and development. There are also "extension" methods for all methods found in MessageReceivedEvent.
Methods with "reply" in their name can be used to instantly send a Message
response to the MessageChannel the MessageReceivedEvent was in.
All RestAction returned by sending a response using these
methods automatically RestAction#queue(), and no further developer
input is required.
- Author:
- John Grosh (jagrosh)
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCommandEvent(net.dv8tion.jda.api.events.message.MessageReceivedEvent event, String prefix, String args, CommandClient client) Constructor for a CommandEvent. -
Method Summary
Modifier and TypeMethodDescriptionvoidUses theclient's executorto run the providedRunnableasynchronously without blocking the thread this is called in.getArgs()Returns the user's String arguments for the command.net.dv8tion.jda.api.entities.UserGets theUserwho triggered this CommandEvent.net.dv8tion.jda.api.entities.channel.middleman.MessageChannelGets theMessageChannelthat the CommandEvent was triggered on.net.dv8tion.jda.api.entities.channel.ChannelTypeGets theChannelTypeof theMessageChannelthat the CommandEvent was triggered on.Returns theCommandClientthat initiated this CommandEvent.net.dv8tion.jda.api.events.message.MessageReceivedEventgetEvent()Returns the underlyingMessageReceivedEventfor this CommandEvent.net.dv8tion.jda.api.entities.GuildgetGuild()Gets theGuildthat this CommandEvent was triggered on.net.dv8tion.jda.api.entities.channel.middleman.GuildMessageChannelGets theGuildMessageChannelthat this CommandEvent may have taken place on, ornullif it didn't happen on a GuildMessageChannel.net.dv8tion.jda.api.JDAgetJDA()Gets the instance ofJDAthat this CommandEvent was caught by.net.dv8tion.jda.api.entities.MemberGets theMemberthat triggered this CommandEvent.net.dv8tion.jda.api.entities.MessageGets theMessageresponsible for triggering this CommandEvent.Returns the prefix used when this event was raised.net.dv8tion.jda.api.entities.channel.concrete.PrivateChannelGets thePrivateChannelthat this CommandEvent may have taken place on, ornullif it didn't happen on a PrivateChannel.longGets the response number for theMessageReceivedEvent.net.dv8tion.jda.api.entities.MemberGets aMemberrepresenting the bot, or null if the event does not take place on aGuild.net.dv8tion.jda.api.entities.SelfUserGets aSelfUserrepresenting the bot.net.dv8tion.jda.api.entities.channel.concrete.TextChannelGets theTextChannelthat this CommandEvent may have taken place on, ornullif it didn't happen on a TextChannel.booleanisFromType(net.dv8tion.jda.api.entities.channel.ChannelType channelType) Compares a providedChannelTypewith the one this CommandEvent occurred on, returningtrueif they are the same ChannelType.booleanisOwner()Tests whether or not theUserwho triggered this event is an owner of the bot.voidlinkId(net.dv8tion.jda.api.entities.Message message) Links aMessagewith the calling Message contained by this CommandEvent.voidAdds an error reaction to the callingMessage.voidAdds a success reaction to the callingMessage.voidAdds a warning reaction to the callingMessage.voidReplies with aFilewith the provided name, or a default name if left null.voidReplies with a String message.voidReplies with a String message and aFilewith the provided name, or a default name if left null.voidReplies with a String message and then queues aConsumer.voidreply(String message, Consumer<net.dv8tion.jda.api.entities.Message> success, Consumer<Throwable> failure) Replies with a String message and then queues aConsumer.voidreply(net.dv8tion.jda.api.entities.MessageEmbed embed) Replies with aMessageEmbed.voidreply(net.dv8tion.jda.api.entities.MessageEmbed embed, Consumer<net.dv8tion.jda.api.entities.Message> success) Replies with aMessageEmbedand then queues aConsumer.voidreply(net.dv8tion.jda.api.entities.MessageEmbed embed, Consumer<net.dv8tion.jda.api.entities.Message> success, Consumer<Throwable> failure) Replies with aMessageEmbedand then queues aConsumer.voidreply(net.dv8tion.jda.api.utils.messages.MessageCreateData message) Replies with aMessage.voidreply(net.dv8tion.jda.api.utils.messages.MessageCreateData message, Consumer<net.dv8tion.jda.api.entities.Message> success) Replies with aMessageand then queues aConsumer.voidreply(net.dv8tion.jda.api.utils.messages.MessageCreateData message, Consumer<net.dv8tion.jda.api.entities.Message> success, Consumer<Throwable> failure) Replies with aMessageand then queues aConsumer.voidreplyError(String message) Replies with a String message and a prefixed error emoji.voidreplyError(String message, Consumer<net.dv8tion.jda.api.entities.Message> queue) Replies with a String message and a prefixed error emoji and then queues aConsumer.voidreplyFormatted(String format, Object... args) Replies with a formatted String message using the provided arguments.voidReplies with a String message sent to the callingUser'sPrivateChannel.voidReplies with a String message and aFilewith the provided name, or a default name if left null, and sent to the callingUser'sPrivateChannel.voidReplies with a String message sent to the callingUser'sPrivateChannel.voidreplyInDm(String message, Consumer<net.dv8tion.jda.api.entities.Message> success, Consumer<Throwable> failure) Replies with a String message sent to the callingUser'sPrivateChannel.voidreplyInDm(net.dv8tion.jda.api.entities.MessageEmbed embed) Replies with aMessageEmbedsent to the callingUser'sPrivateChannel.voidreplyInDm(net.dv8tion.jda.api.entities.MessageEmbed embed, Consumer<net.dv8tion.jda.api.entities.Message> success) Replies with aMessageEmbedsent to the callingUser'sPrivateChannel.voidreplyInDm(net.dv8tion.jda.api.entities.MessageEmbed embed, Consumer<net.dv8tion.jda.api.entities.Message> success, Consumer<Throwable> failure) Replies with aMessageEmbedsent to the callingUser'sPrivateChannel.voidreplyInDm(net.dv8tion.jda.api.entities.Message message, Consumer<net.dv8tion.jda.api.entities.Message> success, Consumer<Throwable> failure) Replies with aMessagesent to the callingUser'sPrivateChannel.voidreplyInDm(net.dv8tion.jda.api.utils.messages.MessageCreateData message) Replies with aMessagesent to the callingUser'sPrivateChannel.voidreplyInDm(net.dv8tion.jda.api.utils.messages.MessageCreateData message, Consumer<net.dv8tion.jda.api.entities.Message> success) Replies with aMessagesent to the callingUser'sPrivateChannel.voidreplyOrAlternate(String message, File file, String filename, String alternateMessage) Replies with a String message and aFilewith the provided name, or a default name if left null.voidreplyOrAlternate(net.dv8tion.jda.api.entities.MessageEmbed embed, String alternateMessage) Replies with aMessageEmbedif possible, or just a String message if it cannot send the embed.voidreplySuccess(String message) Replies with a String message, and a prefixed success emoji.voidreplySuccess(String message, Consumer<net.dv8tion.jda.api.entities.Message> queue) Replies with a String message and a prefixed success emoji and then queues aConsumer.voidreplyWarning(String message) Replies with a String message, and a prefixed warning emoji.voidreplyWarning(String message, Consumer<net.dv8tion.jda.api.entities.Message> queue) Replies with a String message and a prefixed warning emoji and then queues aConsumer.splitMessage(String stringtoSend) Splits a String into one or more Strings who's length does not exceed 2000 characters.
-
Field Details
-
MAX_MESSAGES
public static int MAX_MESSAGES
-
-
Constructor Details
-
CommandEvent
public CommandEvent(net.dv8tion.jda.api.events.message.MessageReceivedEvent event, String prefix, String args, CommandClient client) Constructor for a CommandEvent.You should not call this!
It is a generated wrapper for aMessageReceivedEvent.- Parameters:
event- The initial MessageReceivedEventprefix- The prefix used to execute this commandargs- The String arguments after the command callclient- TheCommandClient
-
-
Method Details
-
getArgs
Returns the user's String arguments for the command.
If no arguments have been supplied, then this will return an empty String.- Returns:
- Never-null arguments that a user has supplied to a command
-
getPrefix
Returns the prefix used when this event was raised. Useful for figuring out what people invoked.- Returns:
- Never null prefix used to raise event
-
getEvent
public net.dv8tion.jda.api.events.message.MessageReceivedEvent getEvent()Returns the underlyingMessageReceivedEventfor this CommandEvent.- Returns:
- The underlying MessageReceivedEvent
-
getClient
Returns theCommandClientthat initiated this CommandEvent.- Returns:
- The initiating CommandClient
-
linkId
public void linkId(net.dv8tion.jda.api.entities.Message message) Links aMessagewith the calling Message contained by this CommandEvent.This method is exposed for those who wish to use linked deletion but may require usage of
MessageChannel#sendMessage()or for other reasons cannot use the standardreply()methods.If the Message provided is not from the bot (IE:
SelfUser), anIllegalArgumentExceptionwill be thrown.- Parameters:
message- The Message to add, must be from the SelfUser while linked deletion is being used.- Throws:
IllegalArgumentException- If the Message provided is not from the bot.
-
reply
Replies with a String message.The
RestActionreturned by sending the response as aMessageautomatically doesRestAction#queue().NOTE: This message can exceed the 2000 character cap, and will be sent in two split Messages.
- Parameters:
message- A String message to reply with
-
reply
Replies with a String message and then queues aConsumer.The
RestActionreturned by sending the response as aMessageautomatically doesRestAction#queue()with the provided Consumer as it's success callback.NOTE: This message can exceed the 2000 character cap, and will be sent in two split Messages.
The Consumer will be applied to the last message sent if this occurs.- Parameters:
message- A String message to reply withsuccess- The Consumer to queue after sending the Message is sent.
-
reply
public void reply(String message, Consumer<net.dv8tion.jda.api.entities.Message> success, Consumer<Throwable> failure) Replies with a String message and then queues aConsumer.The
RestActionreturned by sending the response as aMessageautomatically doesRestAction#queue()with the first Consumer as it's success callback and the second Consumer as the failure callback.NOTE: This message can exceed the 2000 character cap, and will be sent in two split Messages.
Either Consumer will be applied to the last message sent if this occurs.- Parameters:
message- A String message to reply withsuccess- The Consumer to queue after sending the Message is sent.failure- The Consumer to run if an error occurs when sending the Message.
-
reply
public void reply(net.dv8tion.jda.api.entities.MessageEmbed embed) Replies with aMessageEmbed.The
RestActionreturned by sending the response as aMessageautomatically doesRestAction#queue().- Parameters:
embed- The MessageEmbed to reply with
-
reply
public void reply(net.dv8tion.jda.api.entities.MessageEmbed embed, Consumer<net.dv8tion.jda.api.entities.Message> success) Replies with aMessageEmbedand then queues aConsumer.The
RestActionreturned by sending the response as aMessageautomatically doesRestAction#queue()with the provided Consumer as it's success callback.- Parameters:
embed- The MessageEmbed to reply withsuccess- The Consumer to queue after sending the Message is sent.
-
reply
public void reply(net.dv8tion.jda.api.entities.MessageEmbed embed, Consumer<net.dv8tion.jda.api.entities.Message> success, Consumer<Throwable> failure) Replies with aMessageEmbedand then queues aConsumer.The
RestActionreturned by sending the response as aMessageautomatically doesRestAction#queue()with the first Consumer as it's success callback and the second Consumer as the failure callback.- Parameters:
embed- The MessageEmbed to reply withsuccess- The Consumer to queue after sending the Message is sent.failure- The Consumer to run if an error occurs when sending the Message.
-
reply
public void reply(net.dv8tion.jda.api.utils.messages.MessageCreateData message) Replies with aMessage.The
RestActionreturned by sending the response as aMessageautomatically doesRestAction#queue().- Parameters:
message- The Message to reply with
-
reply
public void reply(net.dv8tion.jda.api.utils.messages.MessageCreateData message, Consumer<net.dv8tion.jda.api.entities.Message> success) Replies with aMessageand then queues aConsumer.The
RestActionreturned by sending the response as aMessageautomatically doesRestAction#success()with the provided Consumer as it's success callback.- Parameters:
message- The Message to reply withsuccess- The Consumer to success after sending the Message is sent.
-
reply
public void reply(net.dv8tion.jda.api.utils.messages.MessageCreateData message, Consumer<net.dv8tion.jda.api.entities.Message> success, Consumer<Throwable> failure) Replies with aMessageand then queues aConsumer.The
RestActionreturned by sending the response as aMessageautomatically doesRestAction#queue()with the first Consumer as it's success callback and the second Consumer as the failure callback.- Parameters:
message- The Message to reply withsuccess- The Consumer to queue after sending the Message is sent.failure- The Consumer to run if an error occurs when sending the Message.
-
reply
Replies with aFilewith the provided name, or a default name if left null.The
RestActionreturned by sending the response as aMessageautomatically doesRestAction#queue().This method uses
MessageChannel#sendFile(FileUpload...)to send the File. For more information on what a bot may send using this, you may find the info in that method.- Parameters:
file- The File to reply withfilename- The filename that Discord should display (null for default).
-
reply
Replies with a String message and aFilewith the provided name, or a default name if left null.The
RestActionreturned by sending the response as aMessageautomatically doesRestAction#queue().This method uses
MessageChannel#sendFile(FileUpload...)to send the File. For more information on what a bot may send using this, you may find the info in that method.- Parameters:
message- A String message to reply withfile- The File to reply withfilename- The filename that Discord should display (null for default).
-
replyFormatted
Replies with a formatted String message using the provided arguments.The
RestActionreturned by sending the response as aMessageautomatically doesRestAction#queue().NOTE: This message can exceed the 2000 character cap, and will be sent in two split Messages.
- Parameters:
format- A formatted Stringargs- The arguments to use with the format
-
replyOrAlternate
public void replyOrAlternate(net.dv8tion.jda.api.entities.MessageEmbed embed, String alternateMessage) Replies with aMessageEmbedif possible, or just a String message if it cannot send the embed.The
RestActionreturned by sending the response as aMessageautomatically doesRestAction#queue().NOTE: This alternate String message can exceed the 2000 character cap, and will be sent in two split Messages.
- Parameters:
embed- The MessageEmbed to reply withalternateMessage- A String message to reply with if the provided MessageEmbed cannot be sent
-
replyOrAlternate
Replies with a String message and aFilewith the provided name, or a default name if left null.The
RestActionreturned by sending the response as aMessageautomatically doesRestAction#queue().This method uses
MessageChannel#sendFile(FileUpload...)to send the File. For more information on what a bot may send using this, you may find the info in that method.NOTE: This alternate String message can exceed the 2000 character cap, and will be sent in two split Messages.
It is also worth noting that unlike
CommandEvent#reply(File, String)andCommandEvent#reply(String, File, String), this method does not throw aIOException. This is because the cause of the alternate String message being sent comes directly from a thrownException, and thus a thrown IOException is grounds for the sending of the alternate message.- Parameters:
message- A String message to reply withfile- The File to reply withfilename- The filename that Discord should display (null for default).alternateMessage- A String message to reply with if the file cannot be uploaded, or anIOExceptionis thrown
-
replyInDm
Replies with a String message sent to the callingUser'sPrivateChannel.If the User to be Direct Messaged does not already have a PrivateChannel open to send messages to, this method will automatically open one.
The
RestActionreturned by sending the response as aMessageautomatically doesRestAction#queue().NOTE: This alternate String message can exceed the 2000 character cap, and will be sent in two split Messages.
- Parameters:
message- A String message to reply with
-
replyInDm
Replies with a String message sent to the callingUser'sPrivateChannel.If the User to be Direct Messaged does not already have a PrivateChannel open to send messages to, this method will automatically open one.
The
RestActionreturned by sending the response as aMessageautomatically doesRestAction#queue()with the provided Consumer as it's success callback.NOTE: This alternate String message can exceed the 2000 character cap, and will be sent in two split Messages.
- Parameters:
message- A String message to reply withsuccess- The Consumer to queue after sending the Message is sent.
-
replyInDm
public void replyInDm(String message, Consumer<net.dv8tion.jda.api.entities.Message> success, Consumer<Throwable> failure) Replies with a String message sent to the callingUser'sPrivateChannel.If the User to be Direct Messaged does not already have a PrivateChannel open to send messages to, this method will automatically open one.
The
RestActionreturned by sending the response as aMessageautomatically doesRestAction#queue()with the first Consumer as it's success callback and the second Consumer as the failure callback.NOTE: This alternate String message can exceed the 2000 character cap, and will be sent in two split Messages.
- Parameters:
message- A String message to reply withsuccess- The Consumer to queue after sending the Message is sent.failure- The Consumer to run if an error occurs when sending the Message.
-
replyInDm
public void replyInDm(net.dv8tion.jda.api.entities.MessageEmbed embed) Replies with aMessageEmbedsent to the callingUser'sPrivateChannel.If the User to be Direct Messaged does not already have a PrivateChannel open to send messages to, this method will automatically open one.
The
RestActionreturned by sending the response as aMessageautomatically doesRestAction#queue().- Parameters:
embed- The MessageEmbed to reply with
-
replyInDm
public void replyInDm(net.dv8tion.jda.api.entities.MessageEmbed embed, Consumer<net.dv8tion.jda.api.entities.Message> success) Replies with aMessageEmbedsent to the callingUser'sPrivateChannel.If the User to be Direct Messaged does not already have a PrivateChannel open to send messages to, this method will automatically open one.
The
RestActionreturned by sending the response as aMessageautomatically doesRestAction#queue()with the provided Consumer as it's success callback.- Parameters:
embed- The MessageEmbed to reply withsuccess- The Consumer to queue after sending the Message is sent.
-
replyInDm
public void replyInDm(net.dv8tion.jda.api.entities.MessageEmbed embed, Consumer<net.dv8tion.jda.api.entities.Message> success, Consumer<Throwable> failure) Replies with aMessageEmbedsent to the callingUser'sPrivateChannel.If the User to be Direct Messaged does not already have a PrivateChannel open to send messages to, this method will automatically open one.
The
RestActionreturned by sending the response as aMessageautomatically doesRestAction#queue()with the first Consumer as it's success callback and the second Consumer as the failure callback.- Parameters:
embed- The MessageEmbed to reply withsuccess- The Consumer to queue after sending the Message is sent.failure- The Consumer to run if an error occurs when sending the Message.
-
replyInDm
public void replyInDm(net.dv8tion.jda.api.utils.messages.MessageCreateData message) Replies with aMessagesent to the callingUser'sPrivateChannel.If the User to be Direct Messaged does not already have a PrivateChannel open to send messages to, this method will automatically open one.
The
RestActionreturned by sending the response as aMessageautomatically doesRestAction#queue().- Parameters:
message- The Message to reply with
-
replyInDm
public void replyInDm(net.dv8tion.jda.api.utils.messages.MessageCreateData message, Consumer<net.dv8tion.jda.api.entities.Message> success) Replies with aMessagesent to the callingUser'sPrivateChannel.If the User to be Direct Messaged does not already have a PrivateChannel open to send messages to, this method will automatically open one.
The
RestActionreturned by sending the response as aMessageautomatically doesRestAction#queue()with the provided Consumer as it's success callback.- Parameters:
message- The Message to reply withsuccess- The Consumer to queue after sending the Message is sent.
-
replyInDm
public void replyInDm(net.dv8tion.jda.api.entities.Message message, Consumer<net.dv8tion.jda.api.entities.Message> success, Consumer<Throwable> failure) Replies with aMessagesent to the callingUser'sPrivateChannel.If the User to be Direct Messaged does not already have a PrivateChannel open to send messages to, this method will automatically open one.
The
RestActionreturned by sending the response as aMessageautomatically doesRestAction#queue()with the first Consumer as it's success callback and the second Consumer as the failure callback.- Parameters:
message- The Message to reply withsuccess- The Consumer to queue after sending the Message is sent.failure- The Consumer to run if an error occurs when sending the Message.
-
replyInDm
Replies with a String message and aFilewith the provided name, or a default name if left null, and sent to the callingUser'sPrivateChannel.If the User to be Direct Messaged does not already have a PrivateChannel open to send messages to, this method will automatically open one.
The
RestActionreturned by sending the response as aMessageautomatically doesRestAction#queue().This method uses
MessageChannel#sendFile(FileUpload...)to send the File. For more information on what a bot may send using this, you may find the info in that method.- Parameters:
message- A String message to reply withfile- TheFileto reply withfilename- The filename that Discord should display (null for default).
-
replySuccess
Replies with a String message, and a prefixed success emoji.The
RestActionreturned by sending the response as aMessageautomatically doesRestAction#queue().NOTE: This message can exceed the 2000 character cap, and will be sent in two split Messages.
- Parameters:
message- A String message to reply with
-
replySuccess
Replies with a String message and a prefixed success emoji and then queues aConsumer.The
RestActionreturned by sending the response as aMessageautomatically doesRestAction#queue()with the provided Consumer as it's success callback.NOTE: This message can exceed the 2000 character cap, and will be sent in two split Messages.
- Parameters:
message- A String message to reply withqueue- The Consumer to queue after sending the Message is sent.
-
replyWarning
Replies with a String message, and a prefixed warning emoji.The
RestActionreturned by sending the response as aMessageautomatically doesRestAction#queue().NOTE: This message can exceed the 2000 character cap, and will be sent in two split Messages.
- Parameters:
message- A String message to reply with
-
replyWarning
Replies with a String message and a prefixed warning emoji and then queues aConsumer.The
RestActionreturned by sending the response as aMessageautomatically doesRestAction#queue()with the provided Consumer as it's success callback.NOTE: This message can exceed the 2000 character cap, and will be sent in two split Messages.
- Parameters:
message- A String message to reply withqueue- The Consumer to queue after sending the Message is sent.
-
replyError
Replies with a String message and a prefixed error emoji.The
RestActionreturned by sending the response as aMessageautomatically doesRestAction#queue().NOTE: This message can exceed the 2000 character cap, and will be sent in two split Messages.
- Parameters:
message- A String message to reply with
-
replyError
Replies with a String message and a prefixed error emoji and then queues aConsumer.The
RestActionreturned by sending the response as aMessageautomatically doesRestAction#queue()with the provided Consumer as it's success callback.NOTE: This message can exceed the 2000 character cap, and will be sent in two split Messages.
- Parameters:
message- A String message to reply withqueue- The Consumer to queue after sending the Message is sent.
-
reactSuccess
public void reactSuccess()Adds a success reaction to the callingMessage. -
reactWarning
public void reactWarning()Adds a warning reaction to the callingMessage. -
reactError
public void reactError()Adds an error reaction to the callingMessage. -
async
Uses theclient's executorto run the providedRunnableasynchronously without blocking the thread this is called in.The ScheduledExecutorService this runs on can be configured using
CommandClientBuilder#setScheduleExecutor(ScheduledExecutorService).- Parameters:
runnable- The runnable to run async
-
splitMessage
Splits a String into one or more Strings who's length does not exceed 2000 characters.
Also nullifies usages of@hereand@everyoneso that they do not mention anyone.
Useful for splitting long messages so that they can be sent in more than oneMessageat maximum potential length.- Parameters:
stringtoSend- The String to split and send- Returns:
- An
ArrayListcontaining one or more Strings, with nullified occurrences of@hereand@everyone, and that do not exceed 2000 characters in length
-
getSelfUser
public net.dv8tion.jda.api.entities.SelfUser getSelfUser()Gets aSelfUserrepresenting the bot.
This is the same as invokingevent.getJDA().getSelfUser().- Returns:
- A User representing the bot
-
getSelfMember
public net.dv8tion.jda.api.entities.Member getSelfMember()Gets aMemberrepresenting the bot, or null if the event does not take place on aGuild.
This is the same as invokingevent.getGuild().getSelfMember().- Returns:
- A possibly-null Member representing the bot
-
isOwner
public boolean isOwner()Tests whether or not theUserwho triggered this event is an owner of the bot.- Returns:
trueif the User is the Owner, elsefalse
-
getAuthor
public net.dv8tion.jda.api.entities.User getAuthor()Gets theUserwho triggered this CommandEvent.- Returns:
- The User who triggered this CommandEvent
-
getChannel
public net.dv8tion.jda.api.entities.channel.middleman.MessageChannel getChannel()Gets theMessageChannelthat the CommandEvent was triggered on.- Returns:
- The MessageChannel that the CommandEvent was triggered on
-
getChannelType
public net.dv8tion.jda.api.entities.channel.ChannelType getChannelType()Gets theChannelTypeof theMessageChannelthat the CommandEvent was triggered on.- Returns:
- The ChannelType of the MessageChannel that this CommandEvent was triggered on
-
getGuild
public net.dv8tion.jda.api.entities.Guild getGuild()Gets theGuildthat this CommandEvent was triggered on.- Returns:
- The Guild that this CommandEvent was triggered on
-
getJDA
public net.dv8tion.jda.api.JDA getJDA()Gets the instance ofJDAthat this CommandEvent was caught by.- Returns:
- The instance of JDA that this CommandEvent was caught by
-
getMember
public net.dv8tion.jda.api.entities.Member getMember()Gets theMemberthat triggered this CommandEvent.- Returns:
- The Member that triggered this CommandEvent
-
getMessage
public net.dv8tion.jda.api.entities.Message getMessage()Gets theMessageresponsible for triggering this CommandEvent.- Returns:
- The Message responsible for the CommandEvent
-
getPrivateChannel
public net.dv8tion.jda.api.entities.channel.concrete.PrivateChannel getPrivateChannel()Gets thePrivateChannelthat this CommandEvent may have taken place on, ornullif it didn't happen on a PrivateChannel.- Returns:
- The PrivateChannel that this CommandEvent may have taken place on, or null if it did not happen on a PrivateChannel.
-
getResponseNumber
public long getResponseNumber()Gets the response number for theMessageReceivedEvent.- Returns:
- The response number for the MessageReceivedEvent
-
getTextChannel
public net.dv8tion.jda.api.entities.channel.concrete.TextChannel getTextChannel()Gets theTextChannelthat this CommandEvent may have taken place on, ornullif it didn't happen on a TextChannel.- Returns:
- The TextChannel this CommandEvent may have taken place on, or null if it did not happen on a TextChannel.
-
getGuildChannel
public net.dv8tion.jda.api.entities.channel.middleman.GuildMessageChannel getGuildChannel()Gets theGuildMessageChannelthat this CommandEvent may have taken place on, ornullif it didn't happen on a GuildMessageChannel.- Returns:
- The GuildMessageChannel this CommandEvent may have taken place on, or null if it did not happen on a GuildMessageChannel.
-
isFromType
public boolean isFromType(net.dv8tion.jda.api.entities.channel.ChannelType channelType) Compares a providedChannelTypewith the one this CommandEvent occurred on, returningtrueif they are the same ChannelType.- Parameters:
channelType- The ChannelType to compare- Returns:
trueif the CommandEvent originated from aMessageChannelof the provided ChannelType, otherwisefalse.
-