Package dev.sympho.bot_utils.event
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 Summary
Modifier and TypeMethodDescriptionDetermines whether the given user belongs to the given group in the context of this event.belongs(Snowflake user, GuildGroup group) Determines whether the given user belongs to the given group in the context of this event.Determines whether the given user belongs to the given group in the context of this event.belongs(User user, GuildGroup group) Determines whether the given user belongs to the given group in the context of this event.Determines whether the invoking user in the current execution context has access equivalent to the given group.hasAccess(GuildGroup group) Determines whether the invoking user in the current execution context has access equivalent to the given group.Determines whether the invoking user in the current execution context has access equivalent to the given group.The access validator used in this context.Methods inherited from interface dev.sympho.bot_utils.access.AccessContext
asGuild, guild, guildId, isPrivate, member, member, userMethods inherited from interface dev.sympho.bot_utils.access.ChannelAccessContext
asUser, channel, channelIdMethods inherited from interface dev.sympho.bot_utils.event.EventContext
client, event, validate
-
Method Details
-
validator
ChannelAccessValidator validator()Description copied from interface:EventContextThe access validator used in this context.- Specified by:
validatorin interfaceEventContext- Returns:
- The validator.
-
hasAccess
Description copied from interface:ChannelAccessValidatorDetermines 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
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).- Specified by:
hasAccessin interfaceChannelAccessValidator- 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 tovalidator().hasAccess(group).
-
hasAccess
Description copied from interface:AccessValidatorDetermines 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
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).- Specified by:
hasAccessin interfaceAccessValidator- Specified by:
hasAccessin interfaceChannelAccessValidator- Specified by:
hasAccessin interfaceEventContext- 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
Description copied from interface:ChannelAccessValidatorDetermines whether the invoking user in the current execution context has access equivalent to the given group.- Specified by:
validatein interfaceChannelAccessValidator- 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 tovalidator().validate(group).
-
belongs
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
trueif the given user belongs to the given group under this event context, orfalseotherwise. - API Note:
- This is a convenience method equivalent to
group.belongs(user, this).
-
belongs
Description copied from interface:EventContextDetermines whether the given user belongs to the given group in the context of this event.- Specified by:
belongsin interfaceEventContext- Parameters:
user- The user to check for.group- The group to check for.- Returns:
- A Mono that emits
trueif the given user belongs to the given group under this event context, orfalseotherwise.
-
belongs
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
trueif the given user belongs to the given group under this event context, orfalseotherwise. - API Note:
- This is a convenience method equivalent to fetching the user then invoking
group.belongs(user, this).
-
belongs
Description copied from interface:EventContextDetermines whether the given user belongs to the given group in the context of this event.- Specified by:
belongsin interfaceEventContext- Parameters:
user- The ID of the user to check for.group- The group to check for.- Returns:
- A Mono that emits
trueif the given user belongs to the given group under this event context, orfalseotherwise.
-