DiscordLua
discorddiscord
v1.2.4
Install

EntitlementManager

Manager
On this page

EntitlementManager is the cache and REST facade for Entitlement objects owned by the parent. Typical calls are fetch, create, edit, delete, resolve, and resolveId.

manager Module 1.2.4 REST Source

Constructor

EntitlementManager.new(client, application)

The class table is callable, so EntitlementManager(client, application) is the same as .new.

NameTypeRequiredBehavior
client any required Passed through to the implementation as written.
application any required Passed through to the implementation as written.
lua
local discord = require("discord")
local object = discord.EntitlementManager({}, {})

Properties

EntitlementManager.application

# readonly
Name
application
Type
any
Access
readonly
Description
Application object for the logged-in bot, available after ready.
Availability
Populated from the Gateway/REST payload or constructor for this EntitlementManager.

Methods

EntitlementManager:consume()

#

Performs consume on this EntitlementManager. Call it from bot code when you need that operation on the current object.

Signature

EntitlementManager:consume(id, callback)

Parameters

NameTypeRequiredBehavior
id string required Snowflake id string.
callback function optional Optional completion callback function(err, result). If omitted, failures raise a DiscordLua error.

Returns

EntitlementManager — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a EntitlementManager
object:consume("123", function(err, result)
    if err then error(err) end
end)

EntitlementManager:createTest()

#

Create Test through REST and cache the result when the request succeeds. Pass function(err, result) to handle failures without raising.

Signature

EntitlementManager:createTest(options, callback)

Parameters

NameTypeRequiredBehavior
options table optional Lua option table. Field names match the corresponding DiscordLua option type when one exists.
callback function optional Optional completion callback function(err, result). If omitted, failures raise a DiscordLua error.

Returns

EntitlementManager — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a EntitlementManager
object:createTest({}, function(err, result)
    if err then error(err) end
end)

EntitlementManager:deleteTest()

#

Permanently delete Test through REST.

Signature

EntitlementManager:deleteTest(id, callback)

Parameters

NameTypeRequiredBehavior
id string required Snowflake id string.
callback function optional Optional completion callback function(err, result). If omitted, failures raise a DiscordLua error.

Returns

EntitlementManager — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a EntitlementManager
object:deleteTest("123", function(err, result)
    if err then error(err) end
end)

EntitlementManager:fetch()

#

Request a fresh copy of this resource from REST and update the cache.

Signature

EntitlementManager:fetch(id, options, callback)

Parameters

NameTypeRequiredBehavior
id string required Snowflake id string.
options table optional Lua option table. Field names match the corresponding DiscordLua option type when one exists.
callback function optional Optional completion callback function(err, result). If omitted, failures raise a DiscordLua error.

Returns

EntitlementManager — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a EntitlementManager
object:fetch("123", {}, function(err, result)
    if err then error(err) end
end)

Examples

lua
local discord = require("discord")
local object = discord.EntitlementManager({})

ApplicationCommandManager · ApplicationCommandPermissionsManager · ApplicationEmojiManager · AutoModerationRuleManager · BaseGuildEmojiManager · BaseManager · CachedManager · CategoryChannelChildManager

Version: discord 1.2.4 · runtime 1.0.0

Search Ctrl K Navigate Open Esc