ThreadChannel

class ThreadChannel

A temporary sub-channel within a guild text or forum channel.

Extends:

Properties

Property

Type

Description

appliedTags

string[]

Tag IDs applied to this post, when the thread is in a forum or media channel.

archived

boolean | undefined

Whether the thread is archived.

autoArchiveDuration

number | null | undefined

Minutes of inactivity before Discord archives the thread.

guildId

string

ID of the guild this thread belongs to.

locked

boolean | undefined

Whether the thread is locked, so only members with Manage Threads can unarchive it.

memberCount

number | null | undefined

Approximate number of members, capped at 50 by Discord.

messageCount

number | null | undefined

Approximate number of messages, not counting the starter message.

name

string | undefined

Thread name.

ownerId

string | null | undefined

ID of the member who created this thread, or null.

parentId

string | null | undefined

ID of the parent channel, or null if not available.

rateLimitPerUser

number | null | undefined

Slowmode delay in seconds.

totalMessageSent

number | null | undefined

Total messages ever sent in the thread, including deleted ones.

type

10 | 11 | 12

The type of this channel. Check it to narrow the channel to its subclass.

Methods

async ThreadChannel.addThreadMember(userId: string) → Promise<void>

Add a member to this thread.

Parameters:
  • userId: The ID of the user to add.

async ThreadChannel.archive(reason: string) → Promise<ThreadChannel>

Archive this thread.

Parameters:
  • reason: Audit-log reason for archiving the thread.

Returns:

The archived thread.

async ThreadChannel.edit(options: ThreadChannelEditOptions) → Promise<ThreadChannel>

Edit thread properties.

Parameters:
  • options: Thread fields to update. Omitted fields are left unchanged.

Returns:

The updated thread.

async ThreadChannel.fetchMessage(messageId: string) → Promise<Message | null>

Fetch a specific message by ID, or null if not found.

Parameters:
  • messageId: The ID of the message to fetch.

Returns:

The message, or null if not found.

async ThreadChannel.fetchMessages(options: FetchMessagesOptions) → Promise<Message[]>

Fetch recent messages with optional pagination.

Parameters:
  • options: Optional pagination parameters.

Returns:

Array of messages.

async ThreadChannel.fetchPins(options: { before?: string | Date; limit?: number; }) → Promise<PinPage>

Fetch a page of pinned messages with Discord’s cursor-based pins API.

async ThreadChannel.fetchThreadMembers() → Promise<{ id: string; joinedAt: Date | null; userId: string; }[]>

Fetch members participating in this thread.

Returns:

Array of thread member objects.

async ThreadChannel.join() → Promise<void>

Add the bot to this thread.

async ThreadChannel.leave() → Promise<void>

Remove the bot from this thread.

async ThreadChannel.removeThreadMember(userId: string) → Promise<void>

Remove a member from this thread.

Parameters:
  • userId: The ID of the user to remove.

async ThreadChannel.send(content: string | SendMessageOptions) → Promise<Message>

Send a message in this thread.

Parameters:
  • content: The message content or send options.

Returns:

The sent message.

async ThreadChannel.typing() → Promise<void>

Trigger the typing indicator in this thread.

async ThreadChannel.unarchive(reason: string) → Promise<ThreadChannel>

Unarchive this thread (re-open it).

Parameters:
  • reason: Audit-log reason for unarchiving the thread.

Returns:

The unarchived thread.