Class Groups
- Since:
- 1.0
- Version:
- 1.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final NamedGroupThe group of server admins (matches users with theadministratorpermission).static final NamedGroupThe group that matches a booster in the invoking server.static final NamedGroupThe group that only matches the bot owner.static final NamedGroupThe group of all Discord users (matches everyone).static final NamedGroupThe empty group (matches nobody).static final NamedGroupThe group that only matches the server owner. -
Method Summary
Modifier and TypeMethodDescriptionstatic GroupComposes multiple groups into a single group where a user is only a member if they are a member of all of the given groups.static GroupComposes multiple groups into a single group where a user is only a member if they are a member of all of the given groups.static GroupComposes multiple groups into a single group where a user is only a member if they are a member of all of the given groups.static GroupComposes multiple groups into a single group where a user is only a member if they are a member of all of the given groups.static GroupComposes multiple groups into a single group where a user is only a member if they are a member of any of the given groups.static GroupComposes multiple groups into a single group where a user is only a member if they are a member of any of the given groups.static GroupComposes multiple groups into a single group where a user is only a member if they are a member of any of the given groups.static GroupComposes multiple groups into a single group where a user is only a member if they are a member of any of the given groups.static GrouphasChannelPermissions(discord4j.rest.util.PermissionSet permissions) Creates a group defined as all users that have the given permissions in the channel.static GrouphasChannelPermissions(Supplier<discord4j.rest.util.PermissionSet> permissions) Creates a group defined as all users that have the given permissions in the channel.static GrouphasChannelPermissions(Mono<discord4j.rest.util.PermissionSet> permissions) Creates a group defined as all users that have the given permissions in the channel.static GrouphasGuildPermissions(discord4j.rest.util.PermissionSet permissions) Creates a group defined as all users that have the given permissions in the guild.static GrouphasGuildPermissions(Supplier<discord4j.rest.util.PermissionSet> permissions) Creates a group defined as all users that have the given permissions in the guild.static GrouphasGuildPermissions(Mono<discord4j.rest.util.PermissionSet> permissions) Creates a group defined as all users that have the given permissions in the guild.static GroupCreates a group defined as all users that have the given role.static GroupCreates a group defined as all users that have the given role.static GroupCreates a group defined as all users that have the given role.static GrouphasRolesAll(Snowflake... roles) Creates a group defined as all users that have all of the given roles.static GrouphasRolesAll(Collection<Snowflake> roles) Creates a group defined as all users that have all of the given roles.static GrouphasRolesAll(Supplier<? extends Collection<Snowflake>> roles) Creates a group defined as all users that have all of the given roles.static GrouphasRolesAll(Flux<Snowflake> roles) Creates a group defined as all users that have all of the given roles.static GrouphasRolesAll(Mono<? extends Collection<Snowflake>> roles) Creates a group defined as all users that have all of the given roles.static GrouphasRolesAny(Snowflake... roles) Creates a group defined as all users that have any of the given roles.static GrouphasRolesAny(Collection<Snowflake> roles) Creates a group defined as all users that have any of the given roles.static GrouphasRolesAny(Supplier<? extends Collection<Snowflake>> roles) Creates a group defined as all users that have any of the given roles.static GrouphasRolesAny(Flux<Snowflake> roles) Creates a group defined as all users that have any of the given roles.static GrouphasRolesAny(Mono<? extends Collection<Snowflake>> roles) Creates a group defined as all users that have any of the given roles.static GroupinWhitelist(Snowflake... users) Creates a group composed of a set of users.static GroupinWhitelist(Collection<Snowflake> users) Creates a group composed of a set of users.static GroupinWhitelist(Supplier<? extends Collection<Snowflake>> users) Creates a group composed of a set of users.static GroupinWhitelist(Flux<Snowflake> users) Creates a group composed of a set of users.static GroupinWhitelist(Mono<? extends Collection<Snowflake>> users) Creates a group composed of a set of users.static GroupCreates a group composed of a single user.static GroupCreates a group composed of a single user.static GroupCreates a group composed of a single user.static NamedGroupAdds a name to an existing group.static GroupDecorates a group so that membership is always checked in relation to the given guild, rather than the guild where the command was executed in.static GroupDecorates a group so that membership is always checked in relation to the given guild, rather than the guild where the command was executed in.static GroupDecorates a group so that membership is always checked in relation to the given guild, rather than the guild where the command was executed in.static NamedGroupremote(NamedGroup group, Snowflake guild) Decorates a group so that membership is always checked in relation to the given guild, rather than the guild where the command was executed in.static NamedGroupremote(NamedGroup group, Supplier<Snowflake> guild) Decorates a group so that membership is always checked in relation to the given guild, rather than the guild where the command was executed in.static NamedGroupremote(NamedGroup group, Mono<Snowflake> guild) Decorates a group so that membership is always checked in relation to the given guild, rather than the guild where the command was executed in.
-
Field Details
-
EVERYONE
The group of all Discord users (matches everyone). -
NOBODY
The empty group (matches nobody). -
ADMINS
The group of server admins (matches users with theadministratorpermission). -
SERVER_OWNER
The group that only matches the server owner. -
BOT_OWNER
The group that only matches the bot owner. -
BOOSTER
The group that matches a booster in the invoking server.Note that, unlike groups like
ADMINSorhasGuildPermissions(PermissionSet), this group will never match on a private channel, as usually the goal is paywalling a feature rather than limiting permissions.
-
-
Method Details
-
named
Adds a name to an existing group.- Parameters:
group- The group.name- The name.- Returns:
- The given group with the name set to the given name.
-
remote
Decorates a group so that membership is always checked in relation to the given guild, rather than the guild where the command was executed in.In other words, this overrides the
guildparameter provided to theGroup.belongs(Mono, Mono, User)method to the given guild, before delegating to the given group.This allows for permission checking on commands that always operate on some remote guild, and thus should be checked in relation to that guild.
- Parameters:
group- The group.guild- The guild where group membership should be checked for. The issued value may change over time.- Returns:
- The decorated group.
-
remote
Decorates a group so that membership is always checked in relation to the given guild, rather than the guild where the command was executed in.In other words, this overrides the
guildparameter provided to theGroup.belongs(Mono, Mono, User)method to the given guild, before delegating to the given group.This allows for permission checking on commands that always operate on some remote guild, and thus should be checked in relation to that guild.
The
nameof the group is passed through.- Parameters:
group- The group.guild- The guild where group membership should be checked for. The issued value may change over time.- Returns:
- The decorated group.
- API Note:
- If the name of the group will be overriden, an explicit cast to the
non-named variant may be used to avoid an unecessary wrapping layer:
named(remote((Group) group, guild), "some name")
-
remote
Decorates a group so that membership is always checked in relation to the given guild, rather than the guild where the command was executed in.This allows for permission checking on commands that always operate on some remote guild, and thus should be checked in relation to that guild.
- Parameters:
group- The group.guild- The guild where group membership should be checked for. The issued value may change over time.- Returns:
- The decorated group.
-
remote
Decorates a group so that membership is always checked in relation to the given guild, rather than the guild where the command was executed in.This allows for permission checking on commands that always operate on some remote guild, and thus should be checked in relation to that guild.
The
nameof the group is passed through.- Parameters:
group- The group.guild- The guild where group membership should be checked for. The issued value may change over time.- Returns:
- The decorated group.
- API Note:
- If the name of the group will be overriden, an explicit cast to the
non-named variant may be used to avoid an unecessary wrapping layer:
named(remote((Group) group, guild), "some name")
-
remote
Decorates a group so that membership is always checked in relation to the given guild, rather than the guild where the command was executed in.This allows for permission checking on commands that always operate on some remote guild, and thus should be checked in relation to that guild.
- Parameters:
group- The group.guild- The guild where group membership should be checked for.- Returns:
- The decorated group.
-
remote
Decorates a group so that membership is always checked in relation to the given guild, rather than the guild where the command was executed in.This allows for permission checking on commands that always operate on some remote guild, and thus should be checked in relation to that guild.
The
nameof the group is passed through.- Parameters:
group- The group.guild- The guild where group membership should be checked for.- Returns:
- The decorated group.
- API Note:
- If the name of the group will be overriden, an explicit cast to the
non-named variant may be used to avoid an unecessary wrapping layer:
named(remote((Group) group, guild), "some name")
-
any
Composes multiple groups into a single group where a user is only a member if they are a member of any of the given groups.- Parameters:
groups- The groups to compose. The issued values may change over time (between subscriptions).- Returns:
- The composed group.
-
any
Composes multiple groups into a single group where a user is only a member if they are a member of any of the given groups.- Parameters:
groups- The groups to compose.- Returns:
- The composed group.
-
any
Composes multiple groups into a single group where a user is only a member if they are a member of any of the given groups.- Parameters:
groups- The groups to compose.- Returns:
- The composed group.
-
any
Composes multiple groups into a single group where a user is only a member if they are a member of any of the given groups.- Parameters:
groups- The groups to compose.- Returns:
- The composed group.
-
all
Composes multiple groups into a single group where a user is only a member if they are a member of all of the given groups.- Parameters:
groups- The groups to compose. The issued values may change over time (between subscriptions).- Returns:
- The composed group.
-
all
Composes multiple groups into a single group where a user is only a member if they are a member of all of the given groups.- Parameters:
groups- The groups to compose.- Returns:
- The composed group.
-
all
Composes multiple groups into a single group where a user is only a member if they are a member of all of the given groups.- Parameters:
groups- The groups to compose.- Returns:
- The composed group.
-
all
Composes multiple groups into a single group where a user is only a member if they are a member of all of the given groups.- Parameters:
groups- The groups to compose.- Returns:
- The composed group.
-
isUser
Creates a group composed of a single user.- Parameters:
user- The user. The issued value may change over time.- Returns:
- The group.
-
isUser
Creates a group composed of a single user.- Parameters:
user- The user. The issued value may change over time.- Returns:
- The group.
-
isUser
Creates a group composed of a single user.- Parameters:
user- The user.- Returns:
- The group.
-
inWhitelist
Creates a group composed of a set of users.- Parameters:
users- The users that belong to the group. The issued values may vary over time (between subscriptions).- Returns:
- The group.
-
inWhitelist
Creates a group composed of a set of users.- Parameters:
users- The users that belong to the group. The issued values may vary over time (between subscriptions).- Returns:
- The group.
-
inWhitelist
Creates a group composed of a set of users.- Parameters:
users- The users that belong to the group. The issued values may vary over time (between requests).- Returns:
- The group.
-
inWhitelist
Creates a group composed of a set of users.- Parameters:
users- The users that belong to the group.- Returns:
- The group.
-
inWhitelist
Creates a group composed of a set of users.- Parameters:
users- The users that belong to the group.- Returns:
- The group.
-
hasRole
Creates a group defined as all users that have the given role.- Parameters:
role- The role. The issued value may vary over time.- Returns:
- The group.
-
hasRole
Creates a group defined as all users that have the given role.- Parameters:
role- The role. The issued value may vary over time.- Returns:
- The group.
-
hasRole
Creates a group defined as all users that have the given role.- Parameters:
role- The role.- Returns:
- The group.
-
hasRolesAny
Creates a group defined as all users that have any of the given roles.- Parameters:
roles- The roles. The issued values may vary over time (between subscriptions).- Returns:
- The group.
-
hasRolesAny
Creates a group defined as all users that have any of the given roles.- Parameters:
roles- The roles. The issued values may vary over time (between subscriptions).- Returns:
- The group.
-
hasRolesAny
Creates a group defined as all users that have any of the given roles.- Parameters:
roles- The roles. The issued values may vary over time.- Returns:
- The group.
-
hasRolesAny
Creates a group defined as all users that have any of the given roles.- Parameters:
roles- The roles.- Returns:
- The group.
-
hasRolesAny
Creates a group defined as all users that have any of the given roles.- Parameters:
roles- The roles.- Returns:
- The group.
-
hasRolesAll
Creates a group defined as all users that have all of the given roles.- Parameters:
roles- The roles. The issued values may vary over time (between subscriptions).- Returns:
- The group.
-
hasRolesAll
Creates a group defined as all users that have all of the given roles.- Parameters:
roles- The roles. The issued values may vary over time (between subscriptions).- Returns:
- The group.
-
hasRolesAll
Creates a group defined as all users that have all of the given roles.- Parameters:
roles- The roles. The issued values may vary over time.- Returns:
- The group.
-
hasRolesAll
Creates a group defined as all users that have all of the given roles.- Parameters:
roles- The roles.- Returns:
- The group.
-
hasRolesAll
Creates a group defined as all users that have all of the given roles.- Parameters:
roles- The roles.- Returns:
- The group.
-
hasGuildPermissions
Creates a group defined as all users that have the given permissions in the guild.- Parameters:
permissions- The permissions. The issued value may vary over time.- Returns:
- The group.
-
hasGuildPermissions
Creates a group defined as all users that have the given permissions in the guild.- Parameters:
permissions- The permissions. The issued value may vary over time.- Returns:
- The group.
-
hasGuildPermissions
Creates a group defined as all users that have the given permissions in the guild.- Parameters:
permissions- The permissions.- Returns:
- The group.
-
hasChannelPermissions
Creates a group defined as all users that have the given permissions in the channel.- Parameters:
permissions- The permissions. The issued value may vary over time.- Returns:
- The group.
-
hasChannelPermissions
Creates a group defined as all users that have the given permissions in the channel.- Parameters:
permissions- The permissions. The issued value may vary over time.- Returns:
- The group.
-
hasChannelPermissions
Creates a group defined as all users that have the given permissions in the channel.- Parameters:
permissions- The permissions.- Returns:
- The group.
-