Class CommandEvent

java.lang.Object
com.jagrosh.jdautilities.command.CommandEvent

public class CommandEvent extends Object
A wrapper class for a 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
    Modifier and Type
    Field
    Description
    static int
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    CommandEvent(net.dv8tion.jda.api.events.message.MessageReceivedEvent event, String prefix, String args, CommandClient client)
    Constructor for a CommandEvent.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    async(Runnable runnable)
    Uses the client's executor to run the provided Runnable asynchronously without blocking the thread this is called in.
    Returns the user's String arguments for the command.
    net.dv8tion.jda.api.entities.User
    Gets the User who triggered this CommandEvent.
    net.dv8tion.jda.api.entities.MessageChannel
    Gets the MessageChannel that the CommandEvent was triggered on.
    net.dv8tion.jda.api.entities.ChannelType
    Gets the ChannelType of the MessageChannel that the CommandEvent was triggered on.
    Returns the CommandClient that initiated this CommandEvent.
    net.dv8tion.jda.api.events.message.MessageReceivedEvent
    Returns the underlying MessageReceivedEvent for this CommandEvent.
    net.dv8tion.jda.api.entities.Guild
    Gets the Guild that this CommandEvent was triggered on.
    net.dv8tion.jda.api.JDA
    Gets the instance of JDA that this CommandEvent was caught by.
    net.dv8tion.jda.api.entities.Member
    Gets the Member that triggered this CommandEvent.
    net.dv8tion.jda.api.entities.Message
    Gets the Message responsible for triggering this CommandEvent.
    Returns the prefix used when this event was raised.
    net.dv8tion.jda.api.entities.PrivateChannel
    Gets the PrivateChannel that this CommandEvent may have taken place on, or null if it didn't happen on a PrivateChannel.
    long
    Gets the response number for the MessageReceivedEvent.
    net.dv8tion.jda.api.entities.Member
    Gets a Member representing the bot, or null if the event does not take place on a Guild.
    net.dv8tion.jda.api.entities.SelfUser
    Gets a SelfUser representing the bot.
    net.dv8tion.jda.api.entities.TextChannel
    Gets the TextChannel that this CommandEvent may have taken place on, or null if it didn't happen on a TextChannel.
    boolean
    isFromType(net.dv8tion.jda.api.entities.ChannelType channelType)
    Compares a provided ChannelType with the one this CommandEvent occurred on, returning true if they are the same ChannelType.
    boolean
    Tests whether or not the User who triggered this event is an owner of the bot.
    void
    linkId(net.dv8tion.jda.api.entities.Message message)
    Links a Message with the calling Message contained by this CommandEvent.
    void
    Adds an error reaction to the calling Message.
    void
    Adds a success reaction to the calling Message.
    void
    Adds a warning reaction to the calling Message.
    void
    reply(File file, String filename)
    Replies with a File with the provided name, or a default name if left null.
    void
    reply(String message)
    Replies with a String message.
    void
    reply(String message, File file, String filename)
    Replies with a String message and a File with the provided name, or a default name if left null.
    void
    reply(String message, Consumer<net.dv8tion.jda.api.entities.Message> success)
    Replies with a String message and then queues a Consumer.
    void
    reply(String message, Consumer<net.dv8tion.jda.api.entities.Message> success, Consumer<Throwable> failure)
    Replies with a String message and then queues a Consumer.
    void
    reply(net.dv8tion.jda.api.entities.Message message)
    Replies with a Message.
    void
    reply(net.dv8tion.jda.api.entities.MessageEmbed embed)
    Replies with a MessageEmbed.
    void
    reply(net.dv8tion.jda.api.entities.MessageEmbed embed, Consumer<net.dv8tion.jda.api.entities.Message> success)
    Replies with a MessageEmbed and then queues a Consumer.
    void
    reply(net.dv8tion.jda.api.entities.MessageEmbed embed, Consumer<net.dv8tion.jda.api.entities.Message> success, Consumer<Throwable> failure)
    Replies with a MessageEmbed and then queues a Consumer.
    void
    reply(net.dv8tion.jda.api.entities.Message message, Consumer<net.dv8tion.jda.api.entities.Message> success)
    Replies with a Message and then queues a Consumer.
    void
    reply(net.dv8tion.jda.api.entities.Message message, Consumer<net.dv8tion.jda.api.entities.Message> success, Consumer<Throwable> failure)
    Replies with a Message and then queues a Consumer.
    void
    replyError(String message)
    Replies with a String message and a prefixed error emoji.
    void
    replyError(String message, Consumer<net.dv8tion.jda.api.entities.Message> queue)
    Replies with a String message and a prefixed error emoji and then queues a Consumer.
    void
    replyFormatted(String format, Object... args)
    Replies with a formatted String message using the provided arguments.
    void
    replyInDm(String message)
    Replies with a String message sent to the calling User's PrivateChannel.
    void
    replyInDm(String message, File file, String filename)
    Replies with a String message and a File with the provided name, or a default name if left null, and sent to the calling User's PrivateChannel.
    void
    replyInDm(String message, Consumer<net.dv8tion.jda.api.entities.Message> success)
    Replies with a String message sent to the calling User's PrivateChannel.
    void
    replyInDm(String message, Consumer<net.dv8tion.jda.api.entities.Message> success, Consumer<Throwable> failure)
    Replies with a String message sent to the calling User's PrivateChannel.
    void
    replyInDm(net.dv8tion.jda.api.entities.Message message)
    Replies with a Message sent to the calling User's PrivateChannel.
    void
    replyInDm(net.dv8tion.jda.api.entities.MessageEmbed embed)
    Replies with a MessageEmbed sent to the calling User's PrivateChannel.
    void
    replyInDm(net.dv8tion.jda.api.entities.MessageEmbed embed, Consumer<net.dv8tion.jda.api.entities.Message> success)
    Replies with a MessageEmbed sent to the calling User's PrivateChannel.
    void
    replyInDm(net.dv8tion.jda.api.entities.MessageEmbed embed, Consumer<net.dv8tion.jda.api.entities.Message> success, Consumer<Throwable> failure)
    Replies with a MessageEmbed sent to the calling User's PrivateChannel.
    void
    replyInDm(net.dv8tion.jda.api.entities.Message message, Consumer<net.dv8tion.jda.api.entities.Message> success)
    Replies with a Message sent to the calling User's PrivateChannel.
    void
    replyInDm(net.dv8tion.jda.api.entities.Message message, Consumer<net.dv8tion.jda.api.entities.Message> success, Consumer<Throwable> failure)
    Replies with a Message sent to the calling User's PrivateChannel.
    void
    replyOrAlternate(String message, File file, String filename, String alternateMessage)
    Replies with a String message and a File with the provided name, or a default name if left null.
    void
    replyOrAlternate(net.dv8tion.jda.api.entities.MessageEmbed embed, String alternateMessage)
    Replies with a MessageEmbed if possible, or just a String message if it cannot send the embed.
    void
    Replies with a String message, and a prefixed success emoji.
    void
    replySuccess(String message, Consumer<net.dv8tion.jda.api.entities.Message> queue)
    Replies with a String message and a prefixed success emoji and then queues a Consumer.
    void
    Replies with a String message, and a prefixed warning emoji.
    void
    replyWarning(String message, Consumer<net.dv8tion.jda.api.entities.Message> queue)
    Replies with a String message and a prefixed warning emoji and then queues a Consumer.
    splitMessage(String stringtoSend)
    Splits a String into one or more Strings who's length does not exceed 2000 characters.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 a MessageReceivedEvent.

      Parameters:
      event - The initial MessageReceivedEvent
      prefix - The prefix used to execute this command
      args - The String arguments after the command call
      client - The CommandClient
  • Method Details

    • getArgs

      public String 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

      public String 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 underlying MessageReceivedEvent for this CommandEvent.
      Returns:
      The underlying MessageReceivedEvent
    • getClient

      public CommandClient getClient()
      Returns the CommandClient that initiated this CommandEvent.
      Returns:
      The initiating CommandClient
    • linkId

      public void linkId(net.dv8tion.jda.api.entities.Message message)
      Links a Message with 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 standard reply() methods.

      If the Message provided is not from the bot (IE: SelfUser), an IllegalArgumentException will 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

      public void reply(String message)
      Replies with a String message.

      The RestAction returned by sending the response as a Message automatically does RestAction#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

      public void reply(String message, Consumer<net.dv8tion.jda.api.entities.Message> success)
      Replies with a String message and then queues a Consumer.

      The RestAction returned by sending the response as a Message automatically does RestAction#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 with
      success - 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 a Consumer.

      The RestAction returned by sending the response as a Message automatically does RestAction#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 with
      success - 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 a MessageEmbed.

      The RestAction returned by sending the response as a Message automatically does RestAction#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 a MessageEmbed and then queues a Consumer.

      The RestAction returned by sending the response as a Message automatically does RestAction#queue() with the provided Consumer as it's success callback.

      Parameters:
      embed - The MessageEmbed to reply with
      success - 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 a MessageEmbed and then queues a Consumer.

      The RestAction returned by sending the response as a Message automatically does RestAction#queue() with the first Consumer as it's success callback and the second Consumer as the failure callback.

      Parameters:
      embed - The MessageEmbed to reply with
      success - 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.Message message)
      Replies with a Message.

      The RestAction returned by sending the response as a Message automatically does RestAction#queue().

      Parameters:
      message - The Message to reply with
    • reply

      public void reply(net.dv8tion.jda.api.entities.Message message, Consumer<net.dv8tion.jda.api.entities.Message> success)
      Replies with a Message and then queues a Consumer.

      The RestAction returned by sending the response as a Message automatically does RestAction#success() with the provided Consumer as it's success callback.

      Parameters:
      message - The Message to reply with
      success - The Consumer to success after sending the Message is sent.
    • reply

      public void reply(net.dv8tion.jda.api.entities.Message message, Consumer<net.dv8tion.jda.api.entities.Message> success, Consumer<Throwable> failure)
      Replies with a Message and then queues a Consumer.

      The RestAction returned by sending the response as a Message automatically does RestAction#queue() with the first Consumer as it's success callback and the second Consumer as the failure callback.

      Parameters:
      message - The Message to reply with
      success - 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(File file, String filename)
      Replies with a File with the provided name, or a default name if left null.

      The RestAction returned by sending the response as a Message automatically does RestAction#queue().

      This method uses MessageChannel#sendFile(File, String, AttachmentOption...) 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 with
      filename - The filename that Discord should display (null for default).
    • reply

      public void reply(String message, File file, String filename)
      Replies with a String message and a File with the provided name, or a default name if left null.

      The RestAction returned by sending the response as a Message automatically does RestAction#queue().

      This method uses MessageChannel#sendFile(File, String, AttachmentOption...) 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 with
      file - The File to reply with
      filename - The filename that Discord should display (null for default).
    • replyFormatted

      public void replyFormatted(String format, Object... args)
      Replies with a formatted String message using the provided arguments.

      The RestAction returned by sending the response as a Message automatically does RestAction#queue().

      NOTE: This message can exceed the 2000 character cap, and will be sent in two split Messages.

      Parameters:
      format - A formatted String
      args - The arguments to use with the format
    • replyOrAlternate

      public void replyOrAlternate(net.dv8tion.jda.api.entities.MessageEmbed embed, String alternateMessage)
      Replies with a MessageEmbed if possible, or just a String message if it cannot send the embed.

      The RestAction returned by sending the response as a Message automatically does RestAction#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 with
      alternateMessage - A String message to reply with if the provided MessageEmbed cannot be sent
    • replyOrAlternate

      public void replyOrAlternate(String message, File file, String filename, String alternateMessage)
      Replies with a String message and a File with the provided name, or a default name if left null.

      The RestAction returned by sending the response as a Message automatically does RestAction#queue().

      This method uses MessageChannel#sendFile(File, String, AttachmentOption...) 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) and CommandEvent#reply(String, File, String), this method does not throw a IOException. This is because the cause of the alternate String message being sent comes directly from a thrown Exception, and thus a thrown IOException is grounds for the sending of the alternate message.

      Parameters:
      message - A String message to reply with
      file - The File to reply with
      filename - The filename that Discord should display (null for default).
      alternateMessage - A String message to reply with if the file cannot be uploaded, or an IOException is thrown
    • replyInDm

      public void replyInDm(String message)
      Replies with a String message sent to the calling User's PrivateChannel.

      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 RestAction returned by sending the response as a Message automatically does RestAction#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

      public void replyInDm(String message, Consumer<net.dv8tion.jda.api.entities.Message> success)
      Replies with a String message sent to the calling User's PrivateChannel.

      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 RestAction returned by sending the response as a Message automatically does RestAction#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 with
      success - 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 calling User's PrivateChannel.

      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 RestAction returned by sending the response as a Message automatically does RestAction#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 with
      success - 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 a MessageEmbed sent to the calling User's PrivateChannel.

      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 RestAction returned by sending the response as a Message automatically does RestAction#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 a MessageEmbed sent to the calling User's PrivateChannel.

      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 RestAction returned by sending the response as a Message automatically does RestAction#queue() with the provided Consumer as it's success callback.

      Parameters:
      embed - The MessageEmbed to reply with
      success - 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 a MessageEmbed sent to the calling User's PrivateChannel.

      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 RestAction returned by sending the response as a Message automatically does RestAction#queue() with the first Consumer as it's success callback and the second Consumer as the failure callback.

      Parameters:
      embed - The MessageEmbed to reply with
      success - 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.Message message)
      Replies with a Message sent to the calling User's PrivateChannel.

      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 RestAction returned by sending the response as a Message automatically does RestAction#queue().

      Parameters:
      message - The Message to reply with
    • replyInDm

      public void replyInDm(net.dv8tion.jda.api.entities.Message message, Consumer<net.dv8tion.jda.api.entities.Message> success)
      Replies with a Message sent to the calling User's PrivateChannel.

      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 RestAction returned by sending the response as a Message automatically does RestAction#queue() with the provided Consumer as it's success callback.

      Parameters:
      message - The Message to reply with
      success - 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 a Message sent to the calling User's PrivateChannel.

      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 RestAction returned by sending the response as a Message automatically does RestAction#queue() with the first Consumer as it's success callback and the second Consumer as the failure callback.

      Parameters:
      message - The Message to reply with
      success - 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(String message, File file, String filename)
      Replies with a String message and a File with the provided name, or a default name if left null, and sent to the calling User's PrivateChannel.

      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 RestAction returned by sending the response as a Message automatically does RestAction#queue().

      This method uses MessageChannel#sendFile(File, String, AttachmentOption...) 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 with
      file - The File to reply with
      filename - The filename that Discord should display (null for default).
    • replySuccess

      public void replySuccess(String message)
      Replies with a String message, and a prefixed success emoji.

      The RestAction returned by sending the response as a Message automatically does RestAction#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

      public void replySuccess(String message, Consumer<net.dv8tion.jda.api.entities.Message> queue)
      Replies with a String message and a prefixed success emoji and then queues a Consumer.

      The RestAction returned by sending the response as a Message automatically does RestAction#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 with
      queue - The Consumer to queue after sending the Message is sent.
    • replyWarning

      public void replyWarning(String message)
      Replies with a String message, and a prefixed warning emoji.

      The RestAction returned by sending the response as a Message automatically does RestAction#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

      public void replyWarning(String message, Consumer<net.dv8tion.jda.api.entities.Message> queue)
      Replies with a String message and a prefixed warning emoji and then queues a Consumer.

      The RestAction returned by sending the response as a Message automatically does RestAction#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 with
      queue - The Consumer to queue after sending the Message is sent.
    • replyError

      public void replyError(String message)
      Replies with a String message and a prefixed error emoji.

      The RestAction returned by sending the response as a Message automatically does RestAction#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

      public void replyError(String message, Consumer<net.dv8tion.jda.api.entities.Message> queue)
      Replies with a String message and a prefixed error emoji and then queues a Consumer.

      The RestAction returned by sending the response as a Message automatically does RestAction#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 with
      queue - The Consumer to queue after sending the Message is sent.
    • reactSuccess

      public void reactSuccess()
      Adds a success reaction to the calling Message.
    • reactWarning

      public void reactWarning()
      Adds a warning reaction to the calling Message.
    • reactError

      public void reactError()
      Adds an error reaction to the calling Message.
    • async

      public void async(Runnable runnable)
      Uses the client's executor to run the provided Runnable asynchronously 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

      public static ArrayList<String> splitMessage(String stringtoSend)
      Splits a String into one or more Strings who's length does not exceed 2000 characters.
      Also nullifies usages of @here and @everyone so that they do not mention anyone.
      Useful for splitting long messages so that they can be sent in more than one Message at maximum potential length.
      Parameters:
      stringtoSend - The String to split and send
      Returns:
      An ArrayList containing one or more Strings, with nullified occurrences of @here and @everyone, and that do not exceed 2000 characters in length
    • getSelfUser

      public net.dv8tion.jda.api.entities.SelfUser getSelfUser()
      Gets a SelfUser representing the bot.
      This is the same as invoking event.getJDA().getSelfUser().
      Returns:
      A User representing the bot
    • getSelfMember

      public net.dv8tion.jda.api.entities.Member getSelfMember()
      Gets a Member representing the bot, or null if the event does not take place on a Guild.
      This is the same as invoking event.getGuild().getSelfMember().
      Returns:
      A possibly-null Member representing the bot
    • isOwner

      public boolean isOwner()
      Tests whether or not the User who triggered this event is an owner of the bot.
      Returns:
      true if the User is the Owner, else false
    • getAuthor

      public net.dv8tion.jda.api.entities.User getAuthor()
      Gets the User who triggered this CommandEvent.
      Returns:
      The User who triggered this CommandEvent
    • getChannel

      public net.dv8tion.jda.api.entities.MessageChannel getChannel()
      Gets the MessageChannel that the CommandEvent was triggered on.
      Returns:
      The MessageChannel that the CommandEvent was triggered on
    • getChannelType

      public net.dv8tion.jda.api.entities.ChannelType getChannelType()
      Gets the ChannelType of the MessageChannel that 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 the Guild that 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 of JDA that 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 the Member that triggered this CommandEvent.
      Returns:
      The Member that triggered this CommandEvent
    • getMessage

      public net.dv8tion.jda.api.entities.Message getMessage()
      Gets the Message responsible for triggering this CommandEvent.
      Returns:
      The Message responsible for the CommandEvent
    • getPrivateChannel

      public net.dv8tion.jda.api.entities.PrivateChannel getPrivateChannel()
      Gets the PrivateChannel that this CommandEvent may have taken place on, or null if 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 the MessageReceivedEvent.
      Returns:
      The response number for the MessageReceivedEvent
    • getTextChannel

      public net.dv8tion.jda.api.entities.TextChannel getTextChannel()
      Gets the TextChannel that this CommandEvent may have taken place on, or null if 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.
    • isFromType

      public boolean isFromType(net.dv8tion.jda.api.entities.ChannelType channelType)
      Compares a provided ChannelType with the one this CommandEvent occurred on, returning true if they are the same ChannelType.
      Parameters:
      channelType - The ChannelType to compare
      Returns:
      true if the CommandEvent originated from a MessageChannel of the provided ChannelType, otherwise false.