DiscordLua
discorddiscord
v1.2.4
Install

CachedManager

Manager
On this page

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

manager Module 1.2.4 Source

Constructor

CachedManager.new(client, holds)

The class table is callable, so CachedManager(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.CachedManager({}, {})

Properties

CachedManager.cache

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

CachedManager.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 CachedManager.

CachedManager.holds

# readonly
Name
holds
Type
any
Access
readonly
Description
Instance field CachedManager.holds. Read it after the object is constructed or wrapped from Gateway/REST data.
Availability
Populated from the Gateway/REST payload or constructor for this CachedManager.

Methods

CachedManager:clear()

#

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

Signature

CachedManager:clear()

Parameters

No parameters.

Returns

CachedManager — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a CachedManager
object:clear()

CachedManager:delete()

#

Permanently delete this resource through REST.

Signature

CachedManager:delete(id)

Parameters

NameTypeRequiredBehavior
id string required Snowflake id string.

Returns

CachedManager — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a CachedManager
object:delete("123")

CachedManager:each()

#

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

Signature

CachedManager:each(fn)

Parameters

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

Returns

CachedManager — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a CachedManager
object:each(fn)

CachedManager:filter()

#

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

Signature

CachedManager:filter(predicate)

Parameters

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

Returns

CachedManager — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a CachedManager
object:filter(predicate)

CachedManager:find()

#

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

Signature

CachedManager:find(predicate)

Parameters

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

Returns

CachedManager — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a CachedManager
object:find(predicate)

CachedManager:get()

#

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

Signature

CachedManager:get(id)

Parameters

NameTypeRequiredBehavior
id string required Snowflake id string.

Returns

CachedManager — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a CachedManager
object:get("123")

CachedManager:has()

#

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

Signature

CachedManager:has(id)

Parameters

NameTypeRequiredBehavior
id string required Snowflake id string.

Returns

CachedManager — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a CachedManager
object:has("123")

CachedManager:resolve()

#

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

Signature

CachedManager:resolve(idOrInstance)

Parameters

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

Returns

CachedManager — the same instance, for chaining.

Example

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

CachedManager:resolveId()

#

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

Signature

CachedManager:resolveId(idOrInstance)

Parameters

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

Returns

CachedManager — the same instance, for chaining.

Example

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

CachedManager:set()

#

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

Signature

CachedManager:set(id, value)

Parameters

NameTypeRequiredBehavior
id string required Snowflake id string.
value any required Passed through to the implementation as written.

Returns

CachedManager — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a CachedManager
object:set("123", value)

CachedManager:size()

#

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

Signature

CachedManager:size()

Parameters

No parameters.

Returns

CachedManager — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a CachedManager
object:size()

Static members

  • CachedManager.BaseManager
  • CachedManager.DataManager

Examples

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

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

Version: discord 1.2.4 · runtime 1.0.0

Search Ctrl K Navigate Open Esc