Interface Command
-
public interface Command
Represents a bot command.
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description reactor.core.publisher.Mono<Void>
execute(Context ctx)
Executes the commandstatic Command
forkedFrom(Command other, java.util.function.Function<Context,reactor.core.publisher.Mono<Void>> executeFunc)
Creates a new Command instance which action is the provided function, and other attributes (alias, error actions, allowed channels, permission level, etc) are inherited from the given base command.Set<String>
getAliases()
Gets the aliases for this command.default EnumSet<discord4j.core.object.entity.Channel.Type>
getChannelTypesAllowed()
Gets the type of channels this command is allowed for use in.String
getDescription()
Gets the description of the command.String
getLongDescription()
Gets the long description of the command.default PermissionLevel
getPermissionLevel()
Gets the permission level required to execute this command.Plugin
getPlugin()
Gets the plugin this command belongs to.default Set<Command>
getSubcommands()
Gets the subcommands.String
getSyntax()
Gets the syntax of the command.
-
-
-
Method Detail
-
execute
reactor.core.publisher.Mono<Void> execute(Context ctx)
Executes the command- Parameters:
ctx
- the context- Returns:
- a Mono that completes empty when the command is successful, and emits an error when something goes wrong.
-
getSubcommands
default Set<Command> getSubcommands()
Gets the subcommands.- Returns:
- the set of subcommands
-
getDescription
String getDescription()
Gets the description of the command. The description is shown in the help command list.- Returns:
- the description
-
getLongDescription
String getLongDescription()
Gets the long description of the command. The description is shown in the detailed help page of the command.- Returns:
- the description
-
getSyntax
String getSyntax()
Gets the syntax of the command. The syntax is shown in the help command, and explains which arguments can be passed to the command.- Returns:
- the syntax
-
getPermissionLevel
default PermissionLevel getPermissionLevel()
Gets the permission level required to execute this command.- Returns:
- the permission level
-
getChannelTypesAllowed
default EnumSet<discord4j.core.object.entity.Channel.Type> getChannelTypesAllowed()
Gets the type of channels this command is allowed for use in.- Returns:
- the set of allowed type of channels
-
getPlugin
Plugin getPlugin()
Gets the plugin this command belongs to.- Returns:
- the plugin
-
forkedFrom
static Command forkedFrom(Command other, java.util.function.Function<Context,reactor.core.publisher.Mono<Void>> executeFunc)
Creates a new Command instance which action is the provided function, and other attributes (alias, error actions, allowed channels, permission level, etc) are inherited from the given base command.- Parameters:
other
- the base commandexecuteFunc
- the action of the new command- Returns:
- a new Command
-
-