ThreadManager
ManagerOn 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.
Constructor
ThreadManager.new(client, channel) The class table is callable, so ThreadManager(client, channel) is the same as .new.
| Name | Type | Required | Behavior |
|---|---|---|---|
client |
any |
required | Passed through to the implementation as written. |
channel |
any |
required | Passed through to the implementation as written. |
local discord = require("discord")
local object = discord.ThreadManager({}, {})Properties
- 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
- 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.
- 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
| 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
any.
Example
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
| 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
ThreadManager — the same instance, for chaining.
Example
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
| Name | Type | Required | Behavior |
|---|---|---|---|
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
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
| 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
ThreadManager — the same instance, for chaining.
Example
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
| Name | Type | Required | Behavior |
|---|---|---|---|
thread |
any |
required | Passed through to the implementation as written. |
Returns
ThreadManager — the same instance, for chaining.
Example
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
| Name | Type | Required | Behavior |
|---|---|---|---|
thread |
any |
required | Passed through to the implementation as written. |
Returns
ThreadManager — the same instance, for chaining.
Example
local discord = require("discord")
-- object is a ThreadManager
object:resolveId(thread)Static members
-
ThreadManager.holds
Examples
local discord = require("discord")
local object = discord.ThreadManager({})Related APIs
ApplicationCommandManager · ApplicationCommandPermissionsManager · ApplicationEmojiManager · AutoModerationRuleManager · BaseGuildEmojiManager · BaseManager · CachedManager · CategoryChannelChildManager
Version: discord 1.2.9 · runtime 1.0.0