Class ExecutableCommand
java.lang.Object
com.github.alex1304.ultimategdbot.api.command.ExecutableCommand
public class ExecutableCommand extends Object
Represents a command ready to be executed, meaning that the context and the
error handler of the command are already defined.
-
Constructor Summary
Constructors Constructor Description ExecutableCommand(Command command, Context context, CommandErrorHandler errorHandler)
-
Method Summary
Modifier and Type Method Description reactor.core.publisher.Mono<Void>
execute()
Executes the command by taking into account the context and by applying the error handler.Command
getCommand()
Gets the underlying command instance.Context
getContext()
Gets the context of the command.CommandErrorHandler
getErrorHandler()
Gets the error handler applied to this command.
-
Constructor Details
-
Method Details
-
execute
Executes the command by taking into account the context and by applying the error handler. Scope and permission checks are performed here. If the command is not in scope, the execution completes immediately without any side effect. If the user is not granted the permission to use the command, the command will fail with aPermissionDeniedException
.- Returns:
- a Mono completing when the command execution is complete. Errors caused by a failed permission check or an abnormal termination of the command will be forwarded through this Mono.
-
getCommand
Gets the underlying command instance.- Returns:
- the command
-
getContext
Gets the context of the command.- Returns:
- the context
-
getErrorHandler
Gets the error handler applied to this command.- Returns:
- the error handler
-