Interface AccessValidator
- All Known Subinterfaces:
CommandContext,InstrumentedContext,InteractionCommandContext,LazyContext,MessageCommandContext,SlashCommandContext
- All Known Implementing Classes:
MessageContextImpl
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Validator that determines whether a caller has certain access rights in the
context of an invocation.
- Since:
- 1.0
- Version:
- 1.0
- API Note:
- This type should usually not be manually created during command handling; Rather, it should be obtained from the execution context in order to respect current configuration.
-
Method Summary
Modifier and TypeMethodDescriptionDetermines whether the invoking user in the current execution context (guild and channel) has access equivalent to the given group.default Mono<CommandResult>Determines whether the invoking user in the current execution context (guild and channel) has access equivalent to the given group, otherwise generating an appropriate result.
-
Method Details
-
hasAccess
Determines whether the invoking user in the current execution context (guild and channel) has access equivalent to the given group.Note that while the most straightforward implementation of this interface is to simply check if the caller
belongsto the given group, implementations are allowed to add other conditions under which a user has equivalent permissions despite not belonging to the group (or conversely does not have permissions despite belonging to the group).- Parameters:
group- The group required for access.- Returns:
- Whether the caller has access equivalent to the given group under the current execution context.
-
validate
Determines whether the invoking user in the current execution context (guild and channel) has access equivalent to the given group, otherwise generating an appropriate result.- Parameters:
group- The group required for access.- Returns:
- A Mono that is empty if the caller has access equivalent to the given group under the current execution context, or otherwise issues a failure result.
-