Interface CommandProvider<T>

  • Functional Interface:
    This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

    @FunctionalInterface
    public interface CommandProvider<T>
    This represents a generic command provider.
    • Method Detail

      • provide

        Publisher<ProviderContext<T>> provide​(discord4j.core.event.domain.message.MessageCreateEvent context,
                                              String commandName,
                                              int commandStartIndex,
                                              int commandEndIndex)
        This is called to provide a matching command based on the event context. This context is composed of the raw event object, the command name (as determined by the CommandDispatcher, and the indices which are used to indicate which sub-sequence of the message string should be considered for command execution (this, by convention, excludes the: prefix, command name, etc).
        Parameters:
        context - The raw event context.
        commandName - The expected command name parsed. Note: this is expected to be a single word only!
        commandStartIndex - The start index (inclusive) of where naive parsing of arguments should occur relative to the string held in the sent message.
        commandEndIndex - The end index (exclusive) of where naive parsing of arguments should occur relative to the string held in the sent message.
        Returns:
        The matched command based on the context, or empty if no command matched.
        See Also:
        CommandDispatcher.dispatch(discord4j.core.event.domain.message.MessageCreateEvent, java.util.Set, CommandErrorHandler)