public class CommandClientImpl extends java.lang.Object implements CommandClient, net.dv8tion.jda.core.hooks.EventListener
CommandClient to be used by a bot.
 
 This is a listener usable with JDA, as it implements
 EventListener in order to catch and use different kinds of
 Events. The primary usage of this is where the CommandClient implementation
 takes MessageReceivedEvents, and automatically
 processes arguments, and provide them to a Command for
 running and execution.
| Constructor and Description | 
|---|
| CommandClientImpl(java.lang.String ownerId,
                 java.lang.String[] coOwnerIds,
                 java.lang.String prefix,
                 java.lang.String altprefix,
                 net.dv8tion.jda.core.entities.Game game,
                 net.dv8tion.jda.core.OnlineStatus status,
                 java.lang.String serverInvite,
                 java.lang.String success,
                 java.lang.String warning,
                 java.lang.String error,
                 java.lang.String carbonKey,
                 java.lang.String botsKey,
                 java.lang.String botsOrgKey,
                 java.util.ArrayList<Command> commands,
                 boolean useHelp,
                 java.util.function.Consumer<CommandEvent> helpConsumer,
                 java.lang.String helpWord,
                 java.util.concurrent.ScheduledExecutorService executor,
                 int linkedCacheSize,
                 AnnotatedModuleCompiler compiler,
                 GuildSettingsManager manager) | 
| Modifier and Type | Method and Description | 
|---|---|
| void | addAnnotatedModule(java.lang.Object module)Compiles the provided  Objectannotated withJDACommand.Moduleinto aListofCommands and adds them to this CommandClient in
 the order they are listed. | 
| void | addAnnotatedModule(java.lang.Object module,
                  java.util.function.Function<Command,java.lang.Integer> mapFunction)Compiles the provided  Objectannotated withJDACommand.Moduleinto aListofCommands and adds them to this CommandClient via
 theFunctionprovided. | 
| void | addCommand(Command command)Adds a single  Commandto this CommandClient's
 registered Commands. | 
| void | addCommand(Command command,
          int index)Adds a single  Commandto this CommandClient's
 registered Commands at the specified index. | 
| void | applyCooldown(java.lang.String name,
             int seconds)Applies the specified cooldown with the provided name. | 
| void | cleanCooldowns()Cleans up expired cooldowns to reduce memory. | 
| java.lang.String | getAltPrefix()Gets the Client's alternate prefix. | 
| java.util.List<Command> | getCommands()Returns the list of registered  Commands
 during this session. | 
| int | getCommandUses(Command command)Gets the number of uses for the provide  Commandduring this session, or0if the command is not registered to this CommandClient. | 
| int | getCommandUses(java.lang.String name)Gets the number of uses for a  Commandduring this session matching the provided String name, or0if there is no Command 
 with the name. | 
| java.time.OffsetDateTime | getCooldown(java.lang.String name)Gets the  OffsetDateTimethat the specified cooldown expires. | 
| java.lang.String[] | getCoOwnerIds()Gets the ID(s) of any CoOwners of this bot as a String Array. | 
| long[] | getCoOwnerIdsLong()Gets the ID(s) of any CoOwners of this bot as a  longArray. | 
| java.lang.String | getError()Gets the error emoji. | 
| java.lang.String | getHelpWord()Gets the word used to invoke a help DM. | 
| CommandListener | getListener()Returns the current  CommandListener. | 
| java.lang.String | getOwnerId()Gets the ID of the owner of this bot as a String. | 
| long | getOwnerIdLong()Gets the ID of the owner of this bot as a  long. | 
| java.lang.String | getPrefix()Gets the Client's prefix. | 
| int | getRemainingCooldown(java.lang.String name)Gets the remaining number of seconds on the specified cooldown. | 
| java.util.concurrent.ScheduledExecutorService | getScheduleExecutor()Gets the  ScheduledExecutorServiceheld by this client. | 
| java.lang.String | getServerInvite()Gets the invite to the bot's support server. | 
| <S> S | getSettingsFor(net.dv8tion.jda.core.entities.Guild guild)Returns an Object of the type parameter that should contain settings relating to the specified
  Guild. | 
| <M extends GuildSettingsManager> | getSettingsManager()Returns the type of  GuildSettingsManager,
 the same type of one provided when building this CommandClient, ornullif one was not provided there. | 
| java.time.OffsetDateTime | getStartTime()Gets the time this  CommandClientimplementation was created. | 
| java.lang.String | getSuccess()Gets the success emoji. | 
| java.lang.String | getTextualPrefix()Returns the visual representation of the bot's prefix. | 
| int | getTotalGuilds()Gets an a recently updated count of all the  Guilds 
 the bot is connected to on all shards. | 
| java.lang.String | getWarning()Gets the warning emoji. | 
| void | linkIds(long callId,
       net.dv8tion.jda.core.entities.Message message)DO NOT USE THIS! | 
| void | onEvent(net.dv8tion.jda.core.events.Event event) | 
| void | removeCommand(java.lang.String name)Removes a single  Commandfrom this CommandClient's
 registered Commands at the index linked to the provided name/alias. | 
| void | setListener(CommandListener listener)Sets the  CommandListenerto catch
 command-related events thrown by thisCommandClient. | 
| boolean | usesLinkedDeletion()Gets whether this CommandClient uses linked deletion. | 
public CommandClientImpl(java.lang.String ownerId,
                         java.lang.String[] coOwnerIds,
                         java.lang.String prefix,
                         java.lang.String altprefix,
                         net.dv8tion.jda.core.entities.Game game,
                         net.dv8tion.jda.core.OnlineStatus status,
                         java.lang.String serverInvite,
                         java.lang.String success,
                         java.lang.String warning,
                         java.lang.String error,
                         java.lang.String carbonKey,
                         java.lang.String botsKey,
                         java.lang.String botsOrgKey,
                         java.util.ArrayList<Command> commands,
                         boolean useHelp,
                         java.util.function.Consumer<CommandEvent> helpConsumer,
                         java.lang.String helpWord,
                         java.util.concurrent.ScheduledExecutorService executor,
                         int linkedCacheSize,
                         AnnotatedModuleCompiler compiler,
                         GuildSettingsManager manager)
public void setListener(CommandListener listener)
CommandClientCommandListener to catch
 command-related events thrown by this CommandClient.setListener in interface CommandClientlistener - The CommandListenerpublic CommandListener getListener()
CommandClientCommandListener.getListener in interface CommandClientpublic java.util.List<Command> getCommands()
CommandClientCommands
 during this session.getCommands in interface CommandClientpublic java.time.OffsetDateTime getStartTime()
CommandClientCommandClient
 implementation was created.getStartTime in interface CommandClientpublic java.time.OffsetDateTime getCooldown(java.lang.String name)
CommandClientOffsetDateTime that the specified cooldown expires.getCooldown in interface CommandClientname - The cooldown namepublic int getRemainingCooldown(java.lang.String name)
CommandClientgetRemainingCooldown in interface CommandClientname - The cooldown namepublic void applyCooldown(java.lang.String name,
                          int seconds)
CommandClientapplyCooldown in interface CommandClientname - The cooldown nameseconds - The time to make the cooldown lastpublic void cleanCooldowns()
CommandClientcleanCooldowns in interface CommandClientpublic int getCommandUses(Command command)
CommandClientCommand
 during this session, or 0 if the command is not registered to this CommandClient.getCommandUses in interface CommandClientcommand - The Commandpublic int getCommandUses(java.lang.String name)
CommandClientCommand
 during this session matching the provided String name, or 0 if there is no Command 
 with the name.
 NOTE: this method WILL NOT get uses for a command if an
 alias is provided! Also note that
 child commands ARE NOT
 tracked and providing names or effective names of child commands will return 0.
getCommandUses in interface CommandClientname - The name of the Command0 if the name does not match with a Commandpublic void addCommand(Command command)
CommandClientCommand to this CommandClient's
 registered Commands.
 For CommandClient's containing 20 commands or less, command calls by users will have the bot iterate
 through the entire ArrayList to find the command called. As expected, this
 can get fairly hefty if a bot has a lot of Commands registered to it.
 
To prevent delay a CommandClient that has more that 20 Commands registered to it will begin to use
 indexed calls.
 
Indexed calls use a HashMap which links their
 name and their
 aliases to the index that which they
 are located at in the ArrayList they are stored.
 
This means that all insertion and removal of Commands must reorganize the index maintained by the HashMap.
 
For this particular insertion, the Command provided is inserted at the end of the index, meaning it will
 become the "rightmost" Command in the ArrayList.
addCommand in interface CommandClientcommand - The Command to addpublic void addCommand(Command command, int index)
CommandClientCommand to this CommandClient's
 registered Commands at the specified index.
 For CommandClient's containing 20 commands or less, command calls by users will have the bot iterate
 through the entire ArrayList to find the command called. As expected, this
 can get fairly hefty if a bot has a lot of Commands registered to it.
 
To prevent delay a CommandClient that has more that 20 Commands registered to it will begin to use
 indexed calls.
 
Indexed calls use a HashMap which links their
 name and their
 aliases to the index that which they
 are located at in the ArrayList they are stored.
 
This means that all insertion and removal of Commands must reorganize the index maintained by the HashMap.
 
For this particular insertion, the Command provided is inserted at the index specified, meaning it will
 become the Command located at that index in the ArrayList. This will shift the Command previously located at
 that index as well as any located at greater indices, right one index (size()+1).
addCommand in interface CommandClientcommand - The Command to addindex - The index to add the Command at (must follow the specifications 0<=index<=size())public void removeCommand(java.lang.String name)
CommandClientCommand from this CommandClient's
 registered Commands at the index linked to the provided name/alias.
 For CommandClient's containing 20 commands or less, command calls by users will have the bot iterate
 through the entire ArrayList to find the command called. As expected, this
 can get fairly hefty if a bot has a lot of Commands registered to it.
 
To prevent delay a CommandClient that has more that 20 Commands registered to it will begin to use
 indexed calls.
 
Indexed calls use a HashMap which links their
 name and their
 aliases to the index that which they
 are located at in the ArrayList they are stored.
 
This means that all insertion and removal of Commands must reorganize the index maintained by the HashMap.
 
For this particular removal, the Command removed is that of the corresponding index retrieved by the name
 provided. This will shift any Commands located at greater indices, left one index (size()-1).
removeCommand in interface CommandClientname - The name or an alias of the Command to removepublic void addAnnotatedModule(java.lang.Object module)
CommandClientObject annotated with JDACommand.Module into a List of Commands and adds them to this CommandClient in
 the order they are listed.
 This is done through the AnnotatedModuleCompiler provided when building this CommandClient.
addAnnotatedModule in interface CommandClientmodule - An object annotated with JDACommand.Module to compile into commands to be added.public void addAnnotatedModule(java.lang.Object module,
                               java.util.function.Function<Command,java.lang.Integer> mapFunction)
CommandClientObject annotated with JDACommand.Module into a List of Commands and adds them to this CommandClient via
 the Function provided.
 This is done through the AnnotatedModuleCompiler provided when building this CommandClient.
 
The Function will apply each Command in the compiled list and request an int in return.
 
Using this int, the command provided will be applied to the CommandClient via CommandClient#addCommand(Command, int).
addAnnotatedModule in interface CommandClientmodule - An object annotated with JDACommand.Module to compile into commands to be added.mapFunction - The Function to get indexes for each compiled Command with when adding them to the CommandClient.public java.lang.String getOwnerId()
CommandClientgetOwnerId in interface CommandClientpublic long getOwnerIdLong()
CommandClientlong.getOwnerIdLong in interface CommandClientlong ID of the owner of the botpublic java.lang.String[] getCoOwnerIds()
CommandClientgetCoOwnerIds in interface CommandClientpublic long[] getCoOwnerIdsLong()
CommandClientlong Array.getCoOwnerIdsLong in interface CommandClientlong ID(s) of any CoOwners of this botpublic java.lang.String getSuccess()
CommandClientgetSuccess in interface CommandClientpublic java.lang.String getWarning()
CommandClientgetWarning in interface CommandClientpublic java.lang.String getError()
CommandClientgetError in interface CommandClientpublic java.util.concurrent.ScheduledExecutorService getScheduleExecutor()
CommandClientScheduledExecutorService held by this client.
 This is used for methods such as CommandEvent#async(Runnable) run code asynchronously.
getScheduleExecutor in interface CommandClientpublic java.lang.String getServerInvite()
CommandClientgetServerInvite in interface CommandClientpublic java.lang.String getPrefix()
CommandClientgetPrefix in interface CommandClientpublic java.lang.String getAltPrefix()
CommandClientgetAltPrefix in interface CommandClientpublic java.lang.String getTextualPrefix()
CommandClientThis is the same as CommandClient.getPrefix() unless the prefix is the default,
 in which case it appears as @Botname.
getTextualPrefix in interface CommandClientpublic int getTotalGuilds()
CommandClientGuilds 
 the bot is connected to on all shards.
 
 NOTE: This may not always or should not be assumed accurate! Any time a shard joins or leaves a guild it will update the number retrieved by this method but will not update when other shards join or leave guilds. This means that shards will not always retrieve the same value. For instance:
This feature requires a Discord Bots API Key to be set!
 
To set your Discord Bots API Key, you'll have to retrieve it from the
 Discord Bots website.
getTotalGuilds in interface CommandClientpublic java.lang.String getHelpWord()
CommandClientgetHelpWord in interface CommandClientpublic boolean usesLinkedDeletion()
CommandClientLinking calls is the basic principle of pairing bot responses with their calling
 Messages.
 
Using this with a basic function such as deletion, this causes bots to delete their
 Messages as a response to the calling Message being deleted.
usesLinkedDeletion in interface CommandClienttrue if the bot uses linked deletion, false otherwise.CommandClientBuilder#setLinkedCacheSize(int)public <S> S getSettingsFor(net.dv8tion.jda.core.entities.Guild guild)
CommandClientGuild.
 The returning object for this is specified via provision of a
 GuildSettingsManager to
 CommandClientBuilder#setGuildSettingsManager(GuildSettingsManager), more specifically
 GuildSettingsManager#getSettings(Guild).
getSettingsFor in interface CommandClientS - The type of settings the GuildSettingsManager providesguild - The Guild to get Settings forGuildSettingsManager#getSettings(Guild), can be null if the implementation
         allows it.public <M extends GuildSettingsManager> M getSettingsManager()
CommandClientGuildSettingsManager,
 the same type of one provided when building this CommandClient, or null if one was not provided there.
 This is good if you want to use non-abstract methods specific to your implementation.
getSettingsManager in interface CommandClientM - The type of the GuildSettingsManagernull if one was not provided when building this CommandClient.public void onEvent(net.dv8tion.jda.core.events.Event event)
onEvent in interface net.dv8tion.jda.core.hooks.EventListenerpublic void linkIds(long callId,
                    net.dv8tion.jda.core.entities.Message message)
This is a method necessary for linking a bot's response messages
 to their corresponding call message ID.
 
Using this anywhere in your code can and will break your bot.
callId - The ID of the call Messagemessage - The Message to link to the ID