Package net.dv8tion.jda.api.entities
Interface IPermissionContainer
- All Superinterfaces:
Channel
,Comparable<GuildChannel>
,Formattable
,GuildChannel
,IMentionable
,ISnowflake
- All Known Subinterfaces:
BaseGuildMessageChannel
,Category
,ICategorizableChannel
,IThreadContainer
,NewsChannel
,StageChannel
,StoreChannel
,TextChannel
,VoiceChannel
Represents a
GuildChannel
that uses Permission Overrides
.
Channels that implement this interface can override permissions for specific users or roles.- See Also:
-
Method Summary
Modifier and TypeMethodDescriptiondefault PermissionOverrideAction
createPermissionOverride
(IPermissionHolder permissionHolder) Returns theChannelManager
for this GuildChannel.default List<PermissionOverride>
getPermissionOverride
(IPermissionHolder permissionHolder) Gets all of thePermissionOverrides
that are part of thisGuildChannel
.default List<PermissionOverride>
putPermissionOverride
(IPermissionHolder permissionHolder) default PermissionOverrideAction
upsertPermissionOverride
(IPermissionHolder permissionHolder) Creates a new override or updates an existing one.Methods inherited from interface net.dv8tion.jda.api.entities.Channel
formatTo, getAsMention, getJDA, getName, getType
Methods inherited from interface java.lang.Comparable
compareTo
Methods inherited from interface net.dv8tion.jda.api.entities.GuildChannel
delete, getGuild, getPermissionContainer
Methods inherited from interface net.dv8tion.jda.api.entities.ISnowflake
getId, getIdLong, getTimeCreated
-
Method Details
-
getManager
Description copied from interface:GuildChannel
Returns theChannelManager
for this GuildChannel.
In the ChannelManager, you can modify the name, topic and position of this GuildChannel. You modify multiple fields in one request by chaining setters before callingRestAction.queue()
.This is a lazy idempotent getter. The manager is retained after the first call. This getter is not thread-safe and would require guards by the user.
- Specified by:
getManager
in interfaceGuildChannel
- Returns:
- The ChannelManager of this GuildChannel
-
getPermissionOverride
ThePermissionOverride
relating to the specifiedMember
orRole
. If there is noPermissionOverride
for thisGuildChannel
relating to the provided Member or Role, then this returnsnull
.- Parameters:
permissionHolder
- TheMember
orRole
whosePermissionOverride
is requested.- Returns:
- Possibly-null
PermissionOverride
relating to the provided Member or Role. - Throws:
IllegalArgumentException
- If the provided permission holder is null, or from a different guild
-
getPermissionOverrides
Gets all of thePermissionOverrides
that are part of thisGuildChannel
.
This combinesMember
andRole
overrides. If you would like onlyMember
overrides or onlyRole
overrides, usegetMemberPermissionOverrides()
orgetRolePermissionOverrides()
respectively.This requires
CacheFlag.MEMBER_OVERRIDES
to be enabled! Without that CacheFlag, this list will only contain overrides for the currently logged in account and roles.- Returns:
- Possibly-empty immutable list of all
PermissionOverrides
for thisGuildChannel
.
-
getMemberPermissionOverrides
Gets all of theMember
PermissionOverrides
that are part of thisGuildChannel
.This requires
CacheFlag.MEMBER_OVERRIDES
to be enabled!- Returns:
- Possibly-empty immutable list of all
PermissionOverrides
forMember
for thisGuildChannel
.
-
getRolePermissionOverrides
- Returns:
- Possibly-empty immutable list of all
PermissionOverrides
forRoles
for thisGuildChannel
.
-
createPermissionOverride
@Nonnull @CheckReturnValue default PermissionOverrideAction createPermissionOverride(@Nonnull IPermissionHolder permissionHolder) Creates aPermissionOverride
for the specifiedMember
orRole
in this GuildChannel. You can useputPermissionOverride(IPermissionHolder)
to replace existing overrides.Possible ErrorResponses include:
UNKNOWN_CHANNEL
If this channel was already deletedMISSING_ACCESS
If we were removed from the Guild
- Parameters:
permissionHolder
- The Member or Role to create an override for- Returns:
PermissionOverrideAction
Provides the newly created PermissionOverride for the specified permission holder- Throws:
InsufficientPermissionException
- if we don't have the permission toMANAGE_PERMISSIONS
IllegalArgumentException
- if the specified permission holder is null or is not fromGuildChannel.getGuild()
IllegalStateException
- If the specified permission holder already has a PermissionOverride. UsegetPermissionOverride(IPermissionHolder)
to retrieve it. You can useputPermissionOverride(IPermissionHolder)
to replace existing overrides.
-
putPermissionOverride
@Nonnull @CheckReturnValue PermissionOverrideAction putPermissionOverride(@Nonnull IPermissionHolder permissionHolder) Creates aPermissionOverride
for the specifiedMember
orRole
in this GuildChannel.
If the permission holder already has an existing override it will be replaced.- Parameters:
permissionHolder
- The Member or Role to create the override for- Returns:
PermissionOverrideAction
Provides the newly created PermissionOverride for the specified permission holder- Throws:
InsufficientPermissionException
- if we don't have the permission toMANAGE_PERMISSIONS
IllegalArgumentException
- If the provided permission holder is null or from a different guild
-
upsertPermissionOverride
@Nonnull @CheckReturnValue default PermissionOverrideAction upsertPermissionOverride(@Nonnull IPermissionHolder permissionHolder) Creates a new override or updates an existing one.
This is similar to callingPermissionOverride.getManager()
if an override exists.- Parameters:
permissionHolder
- The Member/Role for the override- Returns:
PermissionOverrideAction
With the current settings of an existing override or a fresh override with no permissions set- Throws:
InsufficientPermissionException
- If we don't have the permission toMANAGE_PERMISSIONS
IllegalArgumentException
- If the provided permission holder is null or not from this guild- Since:
- 4.0.0
-