Class Groups
- Since:
- 1.0
- Version:
- 1.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final NamedGuildGroupThe group of server admins (matches users with theadministratorpermission).static final NamedGuildGroupThe group that matches a booster in the invoking server.static final NamedGuildGroupThe group that only matches the bot owner.static final NamedGuildGroupThe group of all Discord users (matches everyone).static final NamedGuildGroupThe empty group (matches nobody).static final NamedGuildGroupThe 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 GuildGroupall(GuildGroup... groups) 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.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 GuildGroupallGuild(GuildGroup... groups) 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.static GuildGroupallGuild(Iterable<GuildGroup> groups) 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.static GuildGroupallGuild(Stream<GuildGroup> groups) 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.static GuildGroupallGuild(Flux<GuildGroup> groups) 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.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 GuildGroupany(GuildGroup... groups) 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.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 GuildGroupanyGuild(GuildGroup... groups) 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.static GuildGroupanyGuild(Iterable<GuildGroup> groups) 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.static GuildGroupanyGuild(Stream<GuildGroup> groups) 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.static GuildGroupanyGuild(Flux<GuildGroup> groups) 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.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 GuildGrouphasGuildPermissions(discord4j.rest.util.PermissionSet permissions) Creates a group defined as all users that have the given permissions in the guild.static GuildGrouphasGuildPermissions(Supplier<discord4j.rest.util.PermissionSet> permissions) Creates a group defined as all users that have the given permissions in the guild.static GuildGrouphasGuildPermissions(Mono<discord4j.rest.util.PermissionSet> permissions) Creates a group defined as all users that have the given permissions in the guild.static GuildGroupCreates a group defined as all users that have the given role.static GuildGroupCreates a group defined as all users that have the given role.static GuildGroupCreates a group defined as all users that have the given role.static GuildGrouphasRolesAll(Snowflake... roles) Creates a group defined as all users that have all of the given roles.static GuildGrouphasRolesAll(Collection<Snowflake> roles) Creates a group defined as all users that have all of the given roles.static GuildGrouphasRolesAll(Supplier<? extends Collection<Snowflake>> roles) Creates a group defined as all users that have all of the given roles.static GuildGrouphasRolesAll(Flux<Snowflake> roles) Creates a group defined as all users that have all of the given roles.static GuildGrouphasRolesAll(Mono<? extends Collection<Snowflake>> roles) Creates a group defined as all users that have all of the given roles.static GuildGrouphasRolesAny(Snowflake... roles) Creates a group defined as all users that have any of the given roles.static GuildGrouphasRolesAny(Collection<Snowflake> roles) Creates a group defined as all users that have any of the given roles.static GuildGrouphasRolesAny(Supplier<? extends Collection<Snowflake>> roles) Creates a group defined as all users that have any of the given roles.static GuildGrouphasRolesAny(Flux<Snowflake> roles) Creates a group defined as all users that have any of the given roles.static GuildGrouphasRolesAny(Mono<? extends Collection<Snowflake>> roles) Creates a group defined as all users that have any of the given roles.static GuildGroupinWhitelist(Snowflake... users) Creates a group composed of a set of users.static GuildGroupinWhitelist(Collection<Snowflake> users) Creates a group composed of a set of users.static GuildGroupinWhitelist(Supplier<? extends Collection<Snowflake>> users) Creates a group composed of a set of users.static GuildGroupinWhitelist(Flux<Snowflake> users) Creates a group composed of a set of users.static GuildGroupinWhitelist(Mono<? extends Collection<Snowflake>> users) Creates a group composed of a set of users.static GuildGroupCreates a group composed of a single user.static GuildGroupCreates a group composed of a single user.static GuildGroupCreates a group composed of a single user.static NamedGroupAdds a name to an existing group.static NamedGuildGroupnamed(GuildGroup group, String name) Adds a name to an existing group.static GuildGroupremote(GuildGroup 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 GuildGroupremote(GuildGroup 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 GuildGroupremote(GuildGroup 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.static NamedGuildGroupremote(NamedGuildGroup 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 NamedGuildGroupremote(NamedGuildGroup 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 NamedGuildGroupremote(NamedGuildGroup 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.
-
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(ChannelAccessContext)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, but may not be empty.- 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(ChannelAccessContext)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, but may not be empty.- 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((GuildGroup) 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((GuildGroup) 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.
-
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.
-
anyGuild
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.
-
anyGuild
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.
-
anyGuild
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.
-
anyGuild
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.
-
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.
-
allGuild
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.
-
allGuild
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.
-
allGuild
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.
-
allGuild
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
public static GuildGroup hasGuildPermissions(Supplier<discord4j.rest.util.PermissionSet> permissions) 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.
-