Skip to content

PermissionOverwrite

SinisterRectus edited this page Nov 16, 2019 · 19 revisions

extends Snowflake

Represents an object that is used to allow or deny specific permissions for a role or member in a Discord guild channel.

Instances of this class should not be constructed by users.

Properties Inherited From Snowflake

Name Type Description
client Client A shortcut to the client object to which this container is visible.
createdAt number The Unix time in seconds at which this object was created by Discord. Additional decimal points may be present, though only the first 3 (milliseconds) should be considered accurate. Equivalent to Date.parseSnowflake(Snowflake.id).
id string The Snowflake ID that can be used to identify the object. This is guaranteed to be unique except in cases where an object shares the ID of its parent.
parent Container/Client The parent object of to which this container is a child. For example, the parent of a role is the guild in which the role exists.
timestamp string The date and time at which this object was created by Discord, represented as an ISO 8601 string plus microseconds when available. Equivalent to Date.fromSnowflake(Snowflake.id):toISO().

Properties

Name Type Description
allowedPermissions number The number representing the total permissions allowed by this overwrite.
channel GuildChannel The channel in which this overwrite exists.
deniedPermissions number The number representing the total permissions denied by this overwrite.
guild Guild The guild in which this overwrite exists. Equivalent to PermissionOverwrite.channel.guild.
type string The overwrite type; either "role" or "member".

Methods Inherited From Snowflake

__eq()

Defines the behavior of the == operator. Allows containers to be directly compared according to their type and __hash return values.

Returns: boolean


__hash()

Returns Snowflake.id

Returns: string


__tostring()

Defines the behavior of the tostring function. All containers follow the format ClassName: hash.

Returns: string


getDate()

Returns a unique Date object that represents when the object was created by Discord. Equivalent to Date.fromSnowflake(Snowflake.id)

This method only operates on data in memory.

Returns: Date


Methods

allowAllPermissions()

Allows all permissions in this overwrite.

This method always makes an HTTP request.

Returns: boolean


allowPermissions(...)

Parameter Type
... Permission-Resolvables

Allows individual permissions in this overwrite.

This method always makes an HTTP request.

Returns: boolean


clearAllPermissions()

Clears all permissions in this overwrite.

This method always makes an HTTP request.

Returns: boolean


clearPermissions(...)

Parameter Type
... Permission-Resolvables

Clears individual permissions in this overwrite.

This method always makes an HTTP request.

Returns: boolean


delete()

Deletes the permission overwrite. This can be undone by creating a new version of the same overwrite.

This method always makes an HTTP request.

Returns: boolean


denyAllPermissions()

Denies all permissions in this overwrite.

This method always makes an HTTP request.

Returns: boolean


denyPermissions(...)

Parameter Type
... Permission-Resolvables

Denies individual permissions in this overwrite.

This method always makes an HTTP request.

Returns: boolean


getAllowedPermissions()

Returns a permissions object that represents the permissions that this overwrite explicitly allows.

This method only operates on data in memory.

Returns: Permissions


getDeniedPermissions()

Returns a permissions object that represents the permissions that this overwrite explicitly denies.

This method only operates on data in memory.

Returns: Permissions


getObject()

Returns the object associated with this overwrite, either a role or member. This may make an HTTP request if the object is not cached.

This method may make an HTTP request.

Returns: Role/Member


setAllowedPermissions(allowed)

Parameter Type
allowed Permissions-Resolvables

Sets the permissions that this overwrite explicitly allows.

This method always makes an HTTP request.

Returns: boolean


setDeniedPermissions(denied)

Parameter Type
denied Permissions-Resolvables

Sets the permissions that this overwrite explicitly denies.

This method always makes an HTTP request.

Returns: boolean


setPermissions(allowed, denied)

Parameter Type
allowed Permissions-Resolvables
denied Permissions-Resolvables

Sets the permissions that this overwrite explicitly allows and denies. This method does NOT resolve conflicts. Please be sure to use the correct parameters.

This method always makes an HTTP request.

Returns: boolean


Clone this wiki locally