Interface CommandKernel


  • public interface CommandKernel
    The kernel for all bot commands. Command instances are stored, managed and executed here.
    • Method Detail

      • parseCommandLine

        Optional<reactor.util.function.Tuple2<Command,​List<String>>> parseCommandLine​(String commandLine)
        Reads the command line and retrieves the corresponding Command instance. Arguments passed to the command are also returned as a list.
        Parameters:
        commandLine - the command line
        Returns:
        the command with its arguments, if present
      • parseCommandLine

        Optional<reactor.util.function.Tuple2<Command,​List<String>>> parseCommandLine​(List<String> commandLine)
        Reads the command line and retrieves the corresponding Command instance. Arguments passed to the command are also returned as a list.
        Parameters:
        commandLine - the command line as a list of string containing the command name as first element and arguments then
        Returns:
        the command with its arguments, if present
      • getCommands

        Set<Command> getCommands()
        Gets an unmodifiable set of all commands available in the kernel.
        Returns:
        a Set of Command
      • invokeCommand

        reactor.core.publisher.Mono<Void> invokeCommand​(Command cmd,
                                                        Context ctx)
        Invokes a command with the specified context.
        Parameters:
        cmd - the command to invoke
        ctx - the context of the command
        Returns:
        a Mono that completes when the command has terminated. Any errors that may occur when running the command are transmitted through this Mono.