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.
Validator that checks that a command's invocation is appropriate
as per the command's defined parameters.
- Since:
- 1.0
- Version:
- 1.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract User
Retrieves the command's caller from the triggering event.protected abstract Mono<MessageChannel>
getChannel
(E event) Retrieves the channel where the command was invoked from the triggering event.Retrieves the guild where the command was invoked from the triggering event.validateAccess
(AccessValidator validator, List<? extends Command<?>> chain) Validates that the user that invoked a command has sufficient access to do so.validateSettings
(E event, List<? extends Command<?>> chain) Validates that a command invocation is appropriate as per the command's settings.
-
Constructor Details
-
InvocationValidator
public InvocationValidator()
-
-
Method Details
-
getCaller
Retrieves the command's caller from the triggering event.- Parameters:
event
- The triggering event.- Returns:
- The user that invoked the command.
-
getChannel
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
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
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.
-