DiscordLua
discorddiscord
v1.2.9
Install

ThreadManager

Manager
On this page

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

manager Module 1.2.9 Source

Constructor

ThreadManager.new(client, channel)

The class table is callable, so ThreadManager(client, channel) is the same as .new.

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

Properties

ThreadManager.cache

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

ThreadManager.channel

# readonly
Name
channel
Type
any
Access
readonly
Description
Channel this ThreadManager belongs to, when resolved from cache.
Availability
Populated from the Gateway/REST payload or constructor for this ThreadManager.

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

Methods

ThreadManager:create()

#

Create a new resource through REST and cache the result.

Signature

ThreadManager:create(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

any.

Example

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

ThreadManager:fetch()

#

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

Signature

ThreadManager:fetch(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

ThreadManager — the same instance, for chaining.

Example

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

ThreadManager:fetchActive()

#

Fetch Active from REST and update the local cache when the request succeeds.

Signature

ThreadManager:fetchActive(cache, callback)

Parameters

NameTypeRequiredBehavior
cache any required Passed through to the implementation as written.
callback function optional Optional completion callback function(err, result). If omitted, failures raise a DiscordLua error.

Returns

ThreadManager — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a ThreadManager
object:fetchActive(cache, function(err, result)
    if err then error(err) end
end)

ThreadManager:fetchArchived()

#

Fetch Archived from REST and update the local cache when the request succeeds.

Signature

ThreadManager:fetchArchived(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

ThreadManager — the same instance, for chaining.

Example

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

ThreadManager:resolve()

#

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

Signature

ThreadManager:resolve(thread)

Parameters

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

Returns

ThreadManager — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a ThreadManager
object:resolve(thread)

ThreadManager:resolveId()

#

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

Signature

ThreadManager:resolveId(thread)

Parameters

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

Returns

ThreadManager — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a ThreadManager
object:resolveId(thread)

Static members

  • ThreadManager.holds

Examples

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

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

Version: discord 1.2.9 · runtime 1.0.0

Search Ctrl K Navigate Open Esc