public final class CommandConfigBuilder
extends java.lang.Object
CommandConfig instance creation.| Constructor and Description |
|---|
CommandConfigBuilder(java.lang.String name)
Creates a configuration builder for a
AbstractCommand.The default setting are following: has no description is visible in list of commands, etc. doesn't require any discord permissions has no cooldown has no per guild cooldown has no arguments doesn't use raw arguments could be executed not only in guild chat shouldn't be executed if can't check cooldown (db problems) command's cooldown entries should be cleared on startup if they are outdated |
| Modifier and Type | Method and Description |
|---|---|
CommandConfigBuilder |
addAliases(java.util.List<java.lang.String> aliases)
Adds an alias to the command which will work like additional name.
|
CommandConfigBuilder |
addAliases(java.lang.String... aliases)
Adds an alias to the command which will work like additional name.
|
CommandConfigBuilder |
addArguments(CommandArgumentConfigBuilder... arg)
Adds arguments to this command.
|
CommandConfigBuilder |
addArguments(java.util.List<CommandArgumentConfigBuilder> args)
Adds arguments to this command.
|
CommandConfigBuilder |
addDiscordPermission(java.util.List<net.dv8tion.jda.api.Permission> perms)
Adds Discord permissions that will be required in order to execute the command.
|
CommandConfigBuilder |
addDiscordPermission(net.dv8tion.jda.api.Permission perm)
Adds a Discord permission that will be required in order to execute the command.
|
CommandConfig |
build() |
CommandConfigBuilder |
setCleanCooldownRecords(boolean bool)
Should outdated records of cooldown of the command be cleared.
Default is true. |
CommandConfigBuilder |
setCommandListType(CommandListType type)
Sets visibility of the command.
|
CommandConfigBuilder |
setCooldown(java.time.Duration cooldown)
The same user will have to wait the duration before being able to execute the command again
|
CommandConfigBuilder |
setDescription(java.lang.String desc)
Sets a description that will be displayed in list of commands and in commands information (inspection)
|
CommandConfigBuilder |
setExecuteIfCantCheckOrSaveCooldown(boolean bool)
Setting to true will allow the command to be used when there are problems with DB.
|
CommandConfigBuilder |
setExecuteInGuildOnly(boolean bool)
When set to true the command won't be accessible in DM chat.
|
CommandConfigBuilder |
setPerGuildCooldown(java.time.Duration cooldown)
The command will be accessible in the same guild only after the duration since the last use.
|
CommandConfigBuilder |
setRawArgsDesc(java.lang.String desc)
Sets description of the raw args which will be displayed in verbose description of the command
if usage of raw args is enabled.
|
CommandConfigBuilder |
setRawArgsName(java.lang.String name)
Sets name of the raw args which will be used in signature and description of the command, if usage of raw
args is enabled.
|
CommandConfigBuilder |
setUseRawArgs(boolean bool)
Sets this command to use raw args, which means the arguments values will be accessible as a one String
or as List of the string separated by spaces instead of IDs and all the features coming from
CommandArgumentConfigBuilder won't be available. |
CommandConfigBuilder |
setVerboseDescription(java.lang.String verbDesc)
The verbose description will be used in command inspection (command info command)
|
public CommandConfigBuilder(java.lang.String name)
AbstractCommand.name - the name will be used to call the command. It should not be null
nor have length of zero.public CommandConfigBuilder setCleanCooldownRecords(boolean bool)
public CommandConfigBuilder setExecuteIfCantCheckOrSaveCooldown(boolean bool)
public CommandConfigBuilder addArguments(java.util.List<CommandArgumentConfigBuilder> args)
CommandArguments objectpublic CommandConfigBuilder addArguments(CommandArgumentConfigBuilder... arg)
CommandArguments objectpublic CommandConfigBuilder setUseRawArgs(boolean bool)
CommandArgumentConfigBuilder won't be available.public CommandConfigBuilder setPerGuildCooldown(java.time.Duration cooldown)
public CommandConfigBuilder addDiscordPermission(net.dv8tion.jda.api.Permission perm)
public CommandConfigBuilder addDiscordPermission(java.util.List<net.dv8tion.jda.api.Permission> perms)
public CommandConfigBuilder setCooldown(java.time.Duration cooldown)
public CommandConfigBuilder addAliases(java.util.List<java.lang.String> aliases)
public CommandConfigBuilder addAliases(java.lang.String... aliases)
If a message from discord matches several different command names or aliases, then the longest one will be processed.
To avoid confusion it is generally better to not make overlapping aliases if the command has arguments. For example, pour water and pour, let's say the command takes one argument, which is name of target. Then, if the name of the target is water, the command will start processing without arguments, because the alias and the argument will match the full name, which will be preferred due to bigger length.
public CommandConfigBuilder setDescription(java.lang.String desc)
public CommandConfigBuilder setVerboseDescription(java.lang.String verbDesc)
public CommandConfigBuilder setCommandListType(CommandListType type)
public CommandConfigBuilder setExecuteInGuildOnly(boolean bool)
public CommandConfigBuilder setRawArgsDesc(java.lang.String desc)
public CommandConfigBuilder setRawArgsName(java.lang.String name)
public CommandConfig build()