ThreadChannel
- class ThreadChannel
A temporary sub-channel within a guild text or forum channel.
- Extends:
Properties
Property
Type
Description
appliedTagsstring[]
Tag IDs applied to this post, when the thread is in a forum or media channel.
archivedWhether the thread is archived.
autoArchiveDurationMinutes of inactivity before Discord archives the thread.
guildIdID of the guild this thread belongs to.
lockedWhether the thread is locked, so only members with Manage Threads can unarchive it.
memberCountApproximate number of members, capped at 50 by Discord.
messageCountApproximate number of messages, not counting the starter message.
nameThread name.
ownerIdID of the member who created this thread, or
null.parentIdID of the parent channel, or
nullif not available.rateLimitPerUserSlowmode delay in seconds.
totalMessageSentTotal messages ever sent in the thread, including deleted ones.
type10 | 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
nullif 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.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.unarchive(reason: string) Promise<
ThreadChannel> Unarchive this thread (re-open it).
- Parameters:
reason: Audit-log reason for unarchiving the thread.
- Returns:
The unarchived thread.