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,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 PermissionOverrideActioncreatePermissionOverride(IPermissionHolder permissionHolder) Returns theChannelManagerfor this GuildChannel.default List<PermissionOverride>getPermissionOverride(IPermissionHolder permissionHolder) Gets all of thePermissionOverridesthat are part of thisGuildChannel.default List<PermissionOverride>putPermissionOverride(IPermissionHolder permissionHolder) default PermissionOverrideActionupsertPermissionOverride(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, getTypeMethods inherited from interface java.lang.Comparable
compareToMethods inherited from interface net.dv8tion.jda.api.entities.GuildChannel
delete, getGuild, getPermissionContainerMethods inherited from interface net.dv8tion.jda.api.entities.ISnowflake
getId, getIdLong, getTimeCreated
-
Method Details
-
getManager
Description copied from interface:GuildChannelReturns theChannelManagerfor 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:
getManagerin interfaceGuildChannel- Returns:
- The ChannelManager of this GuildChannel
-
getPermissionOverride
ThePermissionOverriderelating to the specifiedMemberorRole. If there is noPermissionOverridefor thisGuildChannelrelating to the provided Member or Role, then this returnsnull.- Parameters:
permissionHolder- TheMemberorRolewhosePermissionOverrideis requested.- Returns:
- Possibly-null
PermissionOverriderelating to the provided Member or Role. - Throws:
IllegalArgumentException- If the provided permission holder is null, or from a different guild
-
getPermissionOverrides
Gets all of thePermissionOverridesthat are part of thisGuildChannel.
This combinesMemberandRoleoverrides. If you would like onlyMemberoverrides or onlyRoleoverrides, usegetMemberPermissionOverrides()orgetRolePermissionOverrides()respectively.This requires
CacheFlag.MEMBER_OVERRIDESto 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
PermissionOverridesfor thisGuildChannel.
-
getMemberPermissionOverrides
Gets all of theMemberPermissionOverridesthat are part of thisGuildChannel.This requires
CacheFlag.MEMBER_OVERRIDESto be enabled!- Returns:
- Possibly-empty immutable list of all
PermissionOverridesforMemberfor thisGuildChannel.
-
getRolePermissionOverrides
- Returns:
- Possibly-empty immutable list of all
PermissionOverridesforRolesfor thisGuildChannel.
-
createPermissionOverride
@Nonnull @CheckReturnValue default PermissionOverrideAction createPermissionOverride(@Nonnull IPermissionHolder permissionHolder) Creates aPermissionOverridefor the specifiedMemberorRolein 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:
PermissionOverrideActionProvides the newly created PermissionOverride for the specified permission holder- Throws:
InsufficientPermissionException- if we don't have the permission toMANAGE_PERMISSIONSIllegalArgumentException- 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 aPermissionOverridefor the specifiedMemberorRolein 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:
PermissionOverrideActionProvides the newly created PermissionOverride for the specified permission holder- Throws:
InsufficientPermissionException- if we don't have the permission toMANAGE_PERMISSIONSIllegalArgumentException- 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_PERMISSIONSIllegalArgumentException- If the provided permission holder is null or not from this guild- Since:
- 4.0.0
-