PermissionOverwrites
ClassOn this page
PermissionOverwrites is a DiscordLua class representing a Discord resource. Obtain it from a manager, an event payload, or the constructor when one is documented below.
Properties
- Name
allow- Type
any- Access
- readonly
- Description
- Instance field
PermissionOverwrites.allow. Read it after the object is constructed or wrapped from Gateway/REST data. - Availability
- Populated from the Gateway/REST payload or constructor for this PermissionOverwrites.
- Name
channel- Type
any- Access
- readonly
- Description
- Channel this PermissionOverwrites belongs to, when resolved from cache.
- Availability
- Populated from the Gateway/REST payload or constructor for this PermissionOverwrites.
- Name
client- Type
any- Access
- readonly
- Description
- Owning Client instance used for REST, cache, and event dispatch.
- Availability
- Populated from the Gateway/REST payload or constructor for this PermissionOverwrites.
- Name
deny- Type
any- Access
- readonly
- Description
- Instance field
PermissionOverwrites.deny. Read it after the object is constructed or wrapped from Gateway/REST data. - Availability
- Populated from the Gateway/REST payload or constructor for this PermissionOverwrites.
- Name
id- Type
any- Access
- readonly
- Description
- Snowflake id of this PermissionOverwrites.
- Availability
- Populated from the Gateway/REST payload or constructor for this PermissionOverwrites.
- Name
raw- Type
any- Access
- readonly
- Description
- Instance field
PermissionOverwrites.raw. Read it after the object is constructed or wrapped from Gateway/REST data. - Availability
- Populated from the Gateway/REST payload or constructor for this PermissionOverwrites.
- Name
type- Type
any- Access
- readonly
- Description
- Instance field
PermissionOverwrites.type. Read it after the object is constructed or wrapped from Gateway/REST data. - Availability
- Populated from the Gateway/REST payload or constructor for this PermissionOverwrites.
Methods
PermissionOverwrites:allowBits()
#Performs allow bits on this PermissionOverwrites. Call it from bot code when you need that operation on the current object.
Signature
PermissionOverwrites:allowBits() Parameters
No parameters.
Returns
PermissionOverwrites — the same instance, for chaining.
Example
local discord = require("discord")
-- object is a PermissionOverwrites
object:allowBits()PermissionOverwrites:delete()
#Permanently delete this resource through REST.
Signature
PermissionOverwrites:delete(reason, callback) Parameters
| Name | Type | Required | Behavior |
|---|---|---|---|
reason |
string |
optional | Audit-log reason sent as X-Audit-Log-Reason on REST mutations. |
callback |
function |
optional | Optional completion callback function(err, result). If omitted, failures raise a DiscordLua error. |
Returns
PermissionOverwrites — the same instance, for chaining.
Example
local discord = require("discord")
-- object is a PermissionOverwrites
object:delete(reason, function(err, result)
if err then error(err) end
end)PermissionOverwrites:denyBits()
#Performs deny bits on this PermissionOverwrites. Call it from bot code when you need that operation on the current object.
Signature
PermissionOverwrites:denyBits() Parameters
No parameters.
Returns
PermissionOverwrites — the same instance, for chaining.
Example
local discord = require("discord")
-- object is a PermissionOverwrites
object:denyBits()PermissionOverwrites:edit()
#Apply a REST update to this resource.
Signature
PermissionOverwrites:edit(options, extra, callback) Parameters
| Name | Type | Required | Behavior |
|---|---|---|---|
options |
table |
optional | Lua option table. Field names match the corresponding DiscordLua option type when one exists. |
extra |
any |
optional | Passed through to the implementation as written. |
callback |
function |
optional | Optional completion callback function(err, result). If omitted, failures raise a DiscordLua error. |
Returns
PermissionOverwrites — the same instance, for chaining.
Example
local discord = require("discord")
-- object is a PermissionOverwrites
object:edit({}, extra, function(err, result)
if err then error(err) end
end)PermissionOverwrites:isMember()
#Predicate that returns whether this PermissionOverwrites matches isMember. Use it to branch before calling type-specific methods.
Signature
PermissionOverwrites:isMember() Parameters
No parameters.
Returns
PermissionOverwrites — the same instance, for chaining.
Example
local discord = require("discord")
-- object is a PermissionOverwrites
object:isMember()PermissionOverwrites:isRole()
#Predicate that returns whether this PermissionOverwrites matches isRole. Use it to branch before calling type-specific methods.
Signature
PermissionOverwrites:isRole() Parameters
No parameters.
Returns
PermissionOverwrites — the same instance, for chaining.
Example
local discord = require("discord")
-- object is a PermissionOverwrites
object:isRole()Resolve a snowflake, object, or mention to a cached instance.
Signature
PermissionOverwrites.resolve(overwrite, guild) Parameters
| Name | Type | Required | Behavior |
|---|---|---|---|
overwrite |
any |
required | Passed through to the implementation as written. |
guild |
any |
required | Passed through to the implementation as written. |
Returns
any.
Example
local discord = require("discord")
-- object is a PermissionOverwrites
PermissionOverwrites.resolve(overwrite, guild)Performs resolve overwrite options on this PermissionOverwrites. Call it from bot code when you need that operation on the current object.
Signature
PermissionOverwrites.resolveOverwriteOptions(options, initial) Parameters
| Name | Type | Required | Behavior |
|---|---|---|---|
options |
table |
optional | Lua option table. Field names match the corresponding DiscordLua option type when one exists. |
initial |
any |
required | Passed through to the implementation as written. |
Returns
any.
Example
local discord = require("discord")
-- object is a PermissionOverwrites
PermissionOverwrites.resolveOverwriteOptions({}, initial)PermissionOverwrites:toJSON()
#Serialize this PermissionOverwrites into a Lua table suitable for REST or debugging.
Signature
PermissionOverwrites:toJSON() Parameters
No parameters.
Returns
any.
Example
local discord = require("discord")
-- object is a PermissionOverwrites
object:toJSON()Examples
Obtain this object from a manager, wrap helper, or event payload — it is not constructed directly in typical bot code.
Related APIs
ActionRow · Activity · ActivityInstance · ActivityLocation · AnonymousGuild · ApplicationCommand · ApplicationRoleConnectionMetadata · Attachment
Version: discord 1.2.4 · runtime 1.0.0