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.
      • getBlacklist

        Set<Long> getBlacklist()
        Gets an unmodifiable set of IDs that are not allowed to perform operations on the command kernel.
        Returns:
        an unmodifiable set of IDs
      • blacklist

        void blacklist​(long id)
        Blacklists a new ID.
        Parameters:
        id - the ID of a user, a channel or a guild that won't be allowed to run commands from this kernel.
      • unblacklist

        void unblacklist​(long id)
        Removes an ID from the blacklist.
        Parameters:
        id - the ID of a user, a channel or a guild that will be allowed to run commands from this kernel again.