EntitlementManager
ManagerOn 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.
Constructor
EntitlementManager.new(client, application) The class table is callable, so EntitlementManager(client, application) is the same as .new.
| Name | Type | Required | Behavior |
|---|---|---|---|
client |
any |
required | Passed through to the implementation as written. |
application |
any |
required | Passed through to the implementation as written. |
local discord = require("discord")
local object = discord.EntitlementManager({}, {})Properties
- 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
| Name | Type | Required | Behavior |
|---|---|---|---|
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
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
| Name | Type | Required | Behavior |
|---|---|---|---|
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
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
| Name | Type | Required | Behavior |
|---|---|---|---|
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
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
| Name | Type | Required | Behavior |
|---|---|---|---|
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
local discord = require("discord")
-- object is a EntitlementManager
object:fetch("123", {}, function(err, result)
if err then error(err) end
end)Examples
local discord = require("discord")
local object = discord.EntitlementManager({})Related APIs
ApplicationCommandManager · ApplicationCommandPermissionsManager · ApplicationEmojiManager · AutoModerationRuleManager · BaseGuildEmojiManager · BaseManager · CachedManager · CategoryChannelChildManager
Version: discord 1.2.4 · runtime 1.0.0