DiscordLua
discorddiscord
v1.2.4
Install

DataManager

Manager
On this page

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

manager Module 1.2.4 Source

Constructor

DataManager.new(client, holds)

The class table is callable, so DataManager(client, holds) is the same as .new.

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

Properties

DataManager.cache

# readonly
Name
cache
Type
any
Access
readonly
Description
In-memory Collection of cached objects owned by this DataManager.
Availability
Populated from the Gateway/REST payload or constructor for this DataManager.

DataManager.client

# readonly
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 DataManager.

Methods

DataManager:resolve()

#

Resolve a snowflake, object, or mention to a cached instance.

Signature

DataManager:resolve(idOrInstance)

Parameters

NameTypeRequiredBehavior
idOrInstance any required Passed through to the implementation as written.

Returns

any.

Example

lua
local discord = require("discord")
-- object is a DataManager
object:resolve("123")

DataManager:resolveId()

#

Resolve a snowflake, object, or mention to an id string.

Signature

DataManager:resolveId(idOrInstance)

Parameters

NameTypeRequiredBehavior
idOrInstance any required Passed through to the implementation as written.

Returns

any.

Example

lua
local discord = require("discord")
-- object is a DataManager
object:resolveId("123")

Examples

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

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

Version: discord 1.2.4 · runtime 1.0.0

Search Ctrl K Navigate Open Esc