Class InvocationValidator<E extends Event>

java.lang.Object
dev.sympho.modular_commands.execute.InvocationValidator<E>
Type Parameters:
E - The type of event that triggers the commands.

public abstract class InvocationValidator<E extends Event> extends Object
Validator that checks that a command's invocation is appropriate as per the command's defined parameters.
Since:
1.0
Version:
1.0
  • Constructor Details

    • InvocationValidator

      public InvocationValidator()
  • Method Details

    • getCaller

      protected abstract User getCaller(E event)
      Retrieves the command's caller from the triggering event.
      Parameters:
      event - The triggering event.
      Returns:
      The user that invoked the command.
    • getChannel

      protected abstract Mono<MessageChannel> getChannel(E event)
      Retrieves the channel where the command was invoked from the triggering event.
      Parameters:
      event - The triggering event.
      Returns:
      The channel where the event was invoked.
    • getGuild

      protected abstract Mono<Guild> getGuild(E event)
      Retrieves the guild where the command was invoked from the triggering event.
      Parameters:
      event - The triggering event.
      Returns:
      The guild where the event was invoked.
    • validateSettings

      public Mono<CommandResult> validateSettings(E event, List<? extends Command<?>> chain)
      Validates that a command invocation is appropriate as per the command's settings.
      Parameters:
      event - The triggering event.
      chain - The execution chain.
      Returns:
      A Mono that completes empty if the requirement was satisfied or disabled for that command, otherwise issuing a failure result.
    • validateAccess

      public Mono<CommandResult> validateAccess(AccessValidator validator, List<? extends Command<?>> chain)
      Validates that the user that invoked a command has sufficient access to do so.
      Parameters:
      validator - The validator to use to check access.
      chain - The execution chain.
      Returns:
      A Mono that completes empty if the user has the required access, otherwise issuing a failure result.