PermissionOverwriteManager
ManagerOn this page
PermissionOverwriteManager is the cache and REST facade for PermissionOverwrite objects owned by the parent. Typical calls are fetch, create, edit, delete, resolve, and resolveId.
Constructor
PermissionOverwriteManager.new(client, channel) The class table is callable, so PermissionOverwriteManager(client, channel) is the same as .new.
| Name | Type | Required | Behavior |
|---|---|---|---|
client |
any |
required | Passed through to the implementation as written. |
channel |
any |
required | Passed through to the implementation as written. |
local discord = require("discord")
local object = discord.PermissionOverwriteManager({}, {})Properties
- Name
channel- Type
any- Access
- readonly
- Description
- Channel this PermissionOverwriteManager belongs to, when resolved from cache.
- Availability
- Populated from the Gateway/REST payload or constructor for this PermissionOverwriteManager.
Methods
PermissionOverwriteManager:create()
#Create a new resource through REST and cache the result.
Signature
PermissionOverwriteManager:create(userOrRole, options, extra, callback) Parameters
| Name | Type | Required | Behavior |
|---|---|---|---|
userOrRole |
any |
required | Passed through to the implementation as written. |
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
PermissionOverwriteManager — the same instance, for chaining.
Example
local discord = require("discord")
-- object is a PermissionOverwriteManager
object:create(userOrRole, {}, extra, function(err, result)
if err then error(err) end
end)PermissionOverwriteManager:delete()
#Permanently delete this resource through REST.
Signature
PermissionOverwriteManager:delete(userOrRole, reason, callback) Parameters
| Name | Type | Required | Behavior |
|---|---|---|---|
userOrRole |
any |
required | Passed through to the implementation as written. |
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
any.
Example
local discord = require("discord")
-- object is a PermissionOverwriteManager
object:delete(userOrRole, reason, function(err, result)
if err then error(err) end
end)PermissionOverwriteManager:edit()
#Apply a REST update to this resource.
Signature
PermissionOverwriteManager:edit(userOrRole, options, extra, callback) Parameters
| Name | Type | Required | Behavior |
|---|---|---|---|
userOrRole |
any |
required | Passed through to the implementation as written. |
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
PermissionOverwriteManager — the same instance, for chaining.
Example
local discord = require("discord")
-- object is a PermissionOverwriteManager
object:edit(userOrRole, {}, extra, function(err, result)
if err then error(err) end
end)Performs encode on this PermissionOverwriteManager. Call it from bot code when you need that operation on the current object.
Signature
PermissionOverwriteManager.encode(options, existing) Parameters
| Name | Type | Required | Behavior |
|---|---|---|---|
options |
table |
optional | Lua option table. Field names match the corresponding DiscordLua option type when one exists. |
existing |
any |
required | Passed through to the implementation as written. |
Returns
PermissionOverwriteManager — the same instance, for chaining.
Example
local discord = require("discord")
-- object is a PermissionOverwriteManager
PermissionOverwriteManager.encode({}, existing)PermissionOverwriteManager:resolveId()
#Resolve a snowflake, object, or mention to an id string.
Signature
PermissionOverwriteManager:resolveId(userOrRole) Parameters
| Name | Type | Required | Behavior |
|---|---|---|---|
userOrRole |
any |
required | Passed through to the implementation as written. |
Returns
any.
Example
local discord = require("discord")
-- object is a PermissionOverwriteManager
object:resolveId(userOrRole)PermissionOverwriteManager:set()
#Performs set on this PermissionOverwriteManager. Call it from bot code when you need that operation on the current object.
Signature
PermissionOverwriteManager:set(overwrites, reason, callback) Parameters
| Name | Type | Required | Behavior |
|---|---|---|---|
overwrites |
any |
required | Passed through to the implementation as written. |
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
any.
Example
local discord = require("discord")
-- object is a PermissionOverwriteManager
object:set(overwrites, reason, function(err, result)
if err then error(err) end
end)Examples
local discord = require("discord")
local object = discord.PermissionOverwriteManager({})Related APIs
ApplicationCommandManager · ApplicationCommandPermissionsManager · ApplicationEmojiManager · AutoModerationRuleManager · BaseGuildEmojiManager · BaseManager · CachedManager · CategoryChannelChildManager
Version: discord 1.2.4 · runtime 1.0.0