Interface ChannelEventContext

All Superinterfaces:
AccessContext, AccessValidator, ChannelAccessContext, ChannelAccessValidator, EventContext
All Known Subinterfaces:
ApplicationCommandEventContext, ButtonEventContext, ComponentEventContext, DeferrableInteractionEventContext, InteractionEventContext, MessageBasedContext, MessageCreateEventContext, MessageEventContext, MessageIncludedContext, ModalEventContext, RepliableContext, SlashCommandEventContext
All Known Implementing Classes:
AbstractChannelEventContext, AbstractRepliableContext

public interface ChannelEventContext extends EventContext, ChannelAccessContext, ChannelAccessValidator
The context of an user-triggered event that is bound to a specific channel.
Since:
1.0
Version:
1.0
  • Method Details

    • validator

      Description copied from interface: EventContext
      The access validator used in this context.
      Specified by:
      validator in interface EventContext
      Returns:
      The validator.
    • hasAccess

      default Mono<Boolean> hasAccess(Group group)
      Description copied from interface: ChannelAccessValidator
      Determines whether the invoking user in the current execution context has access equivalent to the given group.

      Note that while the most straightforward implementation of this interface is to simply check if the caller belongs to 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).

      Specified by:
      hasAccess in interface ChannelAccessValidator
      Parameters:
      group - The group required for access.
      Returns:
      Whether the caller has access equivalent to the given group under the current execution context.
      See Also:
      API Note:
      This is a convenience shortcut for using the context validator. It is equivalent to validator().hasAccess(group).
    • hasAccess

      default Mono<Boolean> hasAccess(GuildGroup group)
      Description copied from interface: AccessValidator
      Determines whether the invoking user in the current execution context has access equivalent to the given group.

      Note that while the most straightforward implementation of this interface is to simply check if the caller belongs to 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).

      Specified by:
      hasAccess in interface AccessValidator
      Specified by:
      hasAccess in interface ChannelAccessValidator
      Specified by:
      hasAccess in interface EventContext
      Parameters:
      group - The group required for access.
      Returns:
      Whether the caller has access equivalent to the given group under the current execution context.
      See Also:
    • validate

      default Mono<Void> validate(Group group)
      Description copied from interface: ChannelAccessValidator
      Determines whether the invoking user in the current execution context has access equivalent to the given group.
      Specified by:
      validate in interface ChannelAccessValidator
      Parameters:
      group - The group required for access.
      Returns:
      A Mono that completes empty if the caller has access equivalent to the given group under the current execution context, or otherwise issues an error of type AccessException.
      See Also:
      API Note:
      This is a convenience shortcut for using the context validator. It is equivalent to validator().validate(group).
    • belongs

      @SideEffectFree default Mono<Boolean> belongs(User user, Group group)
      Determines whether the given user belongs to the given group in the context of this event.
      Parameters:
      user - The user to check for.
      group - The group to check for.
      Returns:
      A Mono that emits true if the given user belongs to the given group under this event context, or false otherwise.
      API Note:
      This is a convenience method equivalent to group.belongs(user, this).
    • belongs

      default Mono<Boolean> belongs(User user, GuildGroup group)
      Description copied from interface: EventContext
      Determines whether the given user belongs to the given group in the context of this event.
      Specified by:
      belongs in interface EventContext
      Parameters:
      user - The user to check for.
      group - The group to check for.
      Returns:
      A Mono that emits true if the given user belongs to the given group under this event context, or false otherwise.
    • belongs

      @SideEffectFree default Mono<Boolean> belongs(Snowflake user, Group group)
      Determines whether the given user belongs to the given group in the context of this event.
      Parameters:
      user - The ID of the user to check for.
      group - The group to check for.
      Returns:
      A Mono that emits true if the given user belongs to the given group under this event context, or false otherwise.
      API Note:
      This is a convenience method equivalent to fetching the user then invoking group.belongs(user, this).
    • belongs

      default Mono<Boolean> belongs(Snowflake user, GuildGroup group)
      Description copied from interface: EventContext
      Determines whether the given user belongs to the given group in the context of this event.
      Specified by:
      belongs in interface EventContext
      Parameters:
      user - The ID of the user to check for.
      group - The group to check for.
      Returns:
      A Mono that emits true if the given user belongs to the given group under this event context, or false otherwise.