GuildTextThreadManager

export class GuildTextThreadManager<AllowedThreadType> extends ThreadManager<false>
export class GuildTextThreadManager<AllowedThreadType> extends ThreadManager<false>
Manages API methods for objects and stores their cache.

Extends

ThreadManager<false>
NameConstraintsOptionalDefaultDescription
AllowedThreadTypeNoNone
Readonly
cache:Collection<Key, Holds>
The cache of items for this manager.
Inherited from DataManager
The channel this Manager belongs to
Inherited from ThreadManager
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
create(options):Promise<AllowedThreadType extends ChannelType.PrivateThread ? PrivateThreadChannel : PublicThreadChannel<false>>
Creates a new thread in the channel.
Example
// Create a new public thread
channel.threads
.create({
name: 'food-talk',
autoArchiveDuration: ThreadAutoArchiveDuration.OneHour,
reason: 'Needed a separate thread for food',
})
.then(threadChannel => console.log(threadChannel))
.catch(console.error);
// Create a new public thread
channel.threads
.create({
name: 'food-talk',
autoArchiveDuration: ThreadAutoArchiveDuration.OneHour,
reason: 'Needed a separate thread for food',
})
.then(threadChannel => console.log(threadChannel))
.catch(console.error);
Example
// Create a new private thread
channel.threads
.create({
name: 'mod-talk',
autoArchiveDuration: ThreadAutoArchiveDuration.OneHour,
type: ChannelType.PrivateThread,
reason: 'Needed a separate thread for moderation',
})
.then(threadChannel => console.log(threadChannel))
.catch(console.error);
// Create a new private thread
channel.threads
.create({
name: 'mod-talk',
autoArchiveDuration: ThreadAutoArchiveDuration.OneHour,
type: ChannelType.PrivateThread,
reason: 'Needed a separate thread for moderation',
})
.then(threadChannel => console.log(threadChannel))
.catch(console.error);
NameTypeOptionalDescription
optionsGuildTextThreadCreateOptions<AllowedThreadType>NoOptions to create a new thread
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
Inherited from ThreadManager
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
Inherited from ThreadManager
resolve(thread):ThreadChannel | null
Resolves a ThreadChannelResolvable to a object.
NameTypeOptionalDescription
threadThreadChannelResolvableNoThe ThreadChannel resolvable to resolve
Inherited from ThreadManager
resolveId(thread):Snowflake | null
Resolves a ThreadChannelResolvable to a id.
NameTypeOptionalDescription
threadThreadChannelResolvableNoThe ThreadChannel resolvable to resolve
Inherited from ThreadManager
valueOf():Collection<Key, Holds>