ThreadManager

export class ThreadManager<ThreadOnly extends boolean = boolean> extends CachedManager<Snowflake, If<ThreadOnly, ForumThreadChannel, TextThreadChannel>, ThreadChannelResolvable>
export class ThreadManager<ThreadOnly extends boolean = boolean> extends CachedManager<Snowflake, If<ThreadOnly, ForumThreadChannel, TextThreadChannel>, ThreadChannelResolvable>
Manages API methods for thread-based channels and stores their cache.
NameConstraintsOptionalDefaultDescription
ThreadOnlybooleanYesbooleanNone
constructor(channel, iterable?)
Constructs a new instance of the ThreadManager class
NameTypeOptionalDescription
channelTextChannel | NewsChannel | ForumChannel | MediaChannelNoNone
iterableIterable<RawThreadChannelData>YesNone
Readonly
cache:Collection<Key, Holds>
The cache of items for this manager.
Inherited from DataManager
The channel this Manager belongs to
Readonly
client:Client
The client that instantiated this Manager
Inherited from BaseManager
Readonly
holds:Constructable<Holds>
The data structure belonging to this manager.
Inherited from DataManager
fetch(options, cacheOptions?):Promise<If<ThreadOnly, ForumThreadChannel, TextThreadChannel> | null>
Obtains a thread from Discord, or the channel cache if it's already available.
Returns
FetchedThreads if active & FetchedThreadsMore if archived.
Example
// Fetch a thread by its id
channel.threads.fetch('831955138126104859')
.then(channel => console.log(channel.name))
.catch(console.error);
// Fetch a thread by its id
channel.threads.fetch('831955138126104859')
.then(channel => console.log(channel.name))
.catch(console.error);
NameTypeOptionalDescription
optionsThreadChannelResolvableNoThe options to fetch threads. If it is a ThreadChannelResolvable then the specified thread will be fetched. Fetches all active threads if undefined
cacheOptionsBaseFetchOptionsYesAdditional options for this fetch. The force field gets ignored if options is not a ThreadChannelResolvable
fetchActive(cache?):Promise<FetchedThreads>
Obtains all active threads in the channel.
NameTypeOptionalDescription
cachebooleanYesWhether to cache the fetched data
fetchArchived(options?, cache?):Promise<FetchedThreadsMore>
Obtains a set of archived threads from Discord. This method requires the PermissionFlagsBits.ReadMessageHistory permission in the parent channel.
NameTypeOptionalDescription
optionsFetchArchivedThreadOptionsYesThe options to fetch archived threads
cachebooleanYesWhether to cache the new thread objects if they aren't already
resolve(thread):ThreadChannel
Resolves a ThreadChannelResolvable to a object.
NameTypeOptionalDescription
threadThreadChannelResolvableNoThe ThreadChannel resolvable to resolve
resolveId(thread):Snowflake
Resolves a ThreadChannelResolvable to a id.
NameTypeOptionalDescription
threadThreadChannelResolvableNoThe ThreadChannel resolvable to resolve
valueOf():Collection<Key, Holds>