Class DiscordOverwrite
Represents a permission overwrite for a channel.
Namespace: DisCatSharp.Entities
Assembly: DisCatSharp.dll
Syntax
public class DiscordOverwrite : SnowflakeObject
Properties
| Improve this Doc View SourceAllowed
Gets the allowed permission set.
Declaration
public Permissions Allowed { get; }
Property Value
Type | Description |
---|---|
Permissions |
Denied
Gets the denied permission set.
Declaration
public Permissions Denied { get; }
Property Value
Type | Description |
---|---|
Permissions |
Type
Gets the type of the overwrite. Either "role" or "member".
Declaration
public OverwriteType Type { get; }
Property Value
Type | Description |
---|---|
OverwriteType |
Methods
| Improve this Doc View SourceCheckPermission(Permissions)
Checks whether given permissions are allowed, denied, or not set.
Declaration
public PermissionLevel CheckPermission(Permissions permission)
Parameters
Type | Name | Description |
---|---|---|
Permissions | permission | Permissions to check. |
Returns
Type | Description |
---|---|
PermissionLevel | Whether given permissions are allowed, denied, or not set. |
DeleteAsync(String)
Deletes this channel overwrite.
Declaration
public Task DeleteAsync(string reason = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | reason | Reason as to why this overwrite gets deleted. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
Exceptions
Type | Condition |
---|---|
UnauthorizedException | Thrown when the client does not have the ManageRoles permission. |
NotFoundException | Thrown when the overwrite does not exist. |
BadRequestException | Thrown when an invalid parameter was provided. |
ServerErrorException | Thrown when Discord is unable to process the request. |
GetMemberAsync()
Gets the DiscordMember that is affected by this overwrite.
Declaration
public async Task<DiscordMember> GetMemberAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<DiscordMember> | The DiscordMember that is affected by this overwrite |
Exceptions
Type | Condition |
---|---|
UnauthorizedException | Thrown when the client does not have the AccessChannels permission. |
NotFoundException | Thrown when the overwrite does not exist. |
BadRequestException | Thrown when an invalid parameter was provided. |
ServerErrorException | Thrown when Discord is unable to process the request. |
GetRoleAsync()
Gets the DiscordRole that is affected by this overwrite.
Declaration
public async Task<DiscordRole> GetRoleAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<DiscordRole> | The DiscordRole that is affected by this overwrite |
Exceptions
Type | Condition |
---|---|
NotFoundException | Thrown when the role does not exist. |
BadRequestException | Thrown when an invalid parameter was provided. |
ServerErrorException | Thrown when Discord is unable to process the request. |
UpdateAsync(Nullable<Permissions>, Nullable<Permissions>, String)
Updates this channel overwrite.
Declaration
public Task UpdateAsync(Permissions? allow = null, Permissions? deny = null, string reason = null)
Parameters
Type | Name | Description |
---|---|---|
System.Nullable<Permissions> | allow | Permissions that are allowed. |
System.Nullable<Permissions> | deny | Permissions that are denied. |
System.String | reason | Reason as to why you made this change. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
Exceptions
Type | Condition |
---|---|
UnauthorizedException | Thrown when the client does not have the ManageRoles permission. |
NotFoundException | Thrown when the overwrite does not exist. |
BadRequestException | Thrown when an invalid parameter was provided. |
ServerErrorException | Thrown when Discord is unable to process the request. |