Skip to content

ThreadChannel

Defined in: packages/structures/src/channels.ts:57

A thread (announcement, public or private).

new ThreadChannel(data, context?): ThreadChannel

Defined in: packages/structures/src/channels.ts:67

APIChannel

ResourceContext

ThreadChannel

Channel.constructor

optional guildId?: string

Defined in: packages/structures/src/base.ts:236

Channel.guildId


readonly id: string

Defined in: packages/structures/src/base.ts:12

Channel.id


memberCount: number

Defined in: packages/structures/src/channels.ts:63

Approximate member count (stops counting at 50).


messageCount: number

Defined in: packages/structures/src/channels.ts:61

Approximate message count.


metadata: APIThreadMetadata | null

Defined in: packages/structures/src/channels.ts:65

Thread metadata.


optional name?: string | null

Defined in: packages/structures/src/base.ts:235

Channel.name


optional nsfw?: boolean

Defined in: packages/structures/src/base.ts:239

Channel.nsfw


readonly ownerId: string | null

Defined in: packages/structures/src/channels.ts:59

User who created the thread.


optional parentId?: string | null

Defined in: packages/structures/src/base.ts:238

Channel.parentId


partial: boolean

Defined in: packages/structures/src/base.ts:249

A placeholder built from a message’s channel_id, not from channel data: its type, name, parentId and permissionOverwrites are not the real channel’s, so nothing may decide access from them.

Channel.partial


permissionOverwrites: APIOverwrite[]

Defined in: packages/structures/src/base.ts:243

Role and member permission overwrites (empty for DMs and when not provided).

Channel.permissionOverwrites


optional position?: number

Defined in: packages/structures/src/base.ts:241

Channel.position


optional rateLimitPerUser?: number

Defined in: packages/structures/src/base.ts:240

Channel.rateLimitPerUser


optional topic?: string | null

Defined in: packages/structures/src/base.ts:237

Channel.topic


type: number

Defined in: packages/structures/src/base.ts:234

Channel.type

get archived(): boolean

Defined in: packages/structures/src/channels.ts:76

Whether the thread is archived.

boolean


get autoArchiveDuration(): number | null

Defined in: packages/structures/src/channels.ts:86

Minutes of inactivity before the thread auto-archives.

number | null


get createdAt(): Date

Defined in: packages/structures/src/base.ts:29

Returns the timestamp this snowflake was created at.

Date

Channel.createdAt


get createdTimestamp(): number

Defined in: packages/structures/src/base.ts:25

Milliseconds since the Unix epoch at which this snowflake was created.

number

Channel.createdTimestamp


get kind(): "text" | "dm" | "voice" | "group-dm" | "category" | "announcement" | "thread" | "stage" | "directory" | "forum" | "media" | "unknown"

Defined in: packages/structures/src/base.ts:345

What kind of channel this is: "text", "voice", "thread", "forum"… ("unknown" for a type this version does not know).

"text" | "dm" | "voice" | "group-dm" | "category" | "announcement" | "thread" | "stage" | "directory" | "forum" | "media" | "unknown"

Channel.kind


get locked(): boolean

Defined in: packages/structures/src/channels.ts:81

Whether the thread is locked.

boolean

as<K>(…kinds): ChannelOfKind<K>

Defined in: packages/structures/src/base.ts:363

Returns this channel typed as one of kinds.

K extends "text" | "dm" | "voice" | "group-dm" | "category" | "announcement" | "thread" | "stage" | "directory" | "forum" | "media" | "unknown"

…K[]

ChannelOfKind<K>

If it is a different kind.

Channel.as


delete(reason?): Promise<void>

Defined in: packages/structures/src/base.ts:333

Deletes this channel.

string

Audit-log reason.

Promise<void>

A promise fulfilled when Discord confirms deletion.

If the channel is not attached to a client.

Channel.delete


edit(options): Promise<Channel>

Defined in: packages/structures/src/base.ts:288

Edits this channel.

Record<string, unknown>

Channel fields to change.

Promise<Channel>

The updated channel.

If the channel is not attached to a client.

Channel.edit


editName(name): Promise<Channel>

Defined in: packages/structures/src/base.ts:295

Changes only this channel’s name.

string

New channel name.

Promise<Channel>

The updated channel.

If the name is empty.

If the channel is not attached to a client.

Channel.editName


editParent(parentId): Promise<Channel>

Defined in: packages/structures/src/base.ts:328

string | null

Promise<Channel>

Channel.editParent


editPermissionOverwrite(targetId, changes, options?): Promise<void>

Defined in: packages/structures/src/base.ts:313

Changes some permissions of one overwrite and keeps the rest: true allows, false denies, null resets to inherited.

string

Role or member ID.

PermissionOverwriteChanges

Permissions to change.

type (0 role, 1 member) when the overwrite does not exist yet; audit-log reason.

string

0 | 1

Promise<void>

channel.editPermissionOverwrite(userId, { ViewChannel: true, SendMessages: false }, { type: 1 })

Channel.editPermissionOverwrite


editTopic(topic): Promise<Channel>

Defined in: packages/structures/src/base.ts:301

Changes only this channel’s topic.

string | null

New topic, or null to clear it.

Promise<Channel>

The updated channel.

If the channel is not attached to a client.

Channel.editTopic


is<K>(…kinds): this is ChannelOfKind<K>

Defined in: packages/structures/src/base.ts:353

Whether this channel is one of kinds, narrowing its type to match.

K extends "text" | "dm" | "voice" | "group-dm" | "category" | "announcement" | "thread" | "stage" | "directory" | "forum" | "media" | "unknown"

…K[]

this is ChannelOfKind<K>

if (channel.is("text", "announcement")) await channel.send({ content: "hi" });

Channel.is


isDMBased(): boolean

Defined in: packages/structures/src/base.ts:389

Whether this is a direct-message channel (DM or group DM).

boolean

Channel.isDMBased


isTextBased(): boolean

Defined in: packages/structures/src/base.ts:379

Whether messages can be sent in this channel (text, DM, announcement, voice, stage, threads).

boolean

Channel.isTextBased


isThread(): boolean

Defined in: packages/structures/src/base.ts:374

Whether this is a thread (announcement, public or private).

boolean

Channel.isThread


isVoiceBased(): boolean

Defined in: packages/structures/src/base.ts:384

Whether this is a voice or stage channel.

boolean

Channel.isVoiceBased


send(options): Promise<Message>

Defined in: packages/structures/src/base.ts:279

Sends a message to this channel.

MessageCreateOptions

Message payload.

Promise<Message>

The created message.

If the channel is not attached to a client.

Channel.send


toString(): string

Defined in: packages/structures/src/base.ts:394

Returns the Discord channel mention string. Used automatically in template literals.

string

Channel.toString


update(options): Promise<Channel>

Defined in: packages/structures/src/base.ts:340

Updates this channel using the same resource operation as edit.

Record<string, unknown>

Channel fields to change.

Promise<Channel>

The updated channel.

If the channel is not attached to a client.

Channel.update