Skip to content

NewsChannel

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

A guild announcement (news) channel.

new NewsChannel(data, context?): NewsChannel

Defined in: packages/structures/src/resources.ts:335

Creates a text channel from Discord data.

object & Partial<APIChannel>

Discord channel payload.

ResourceContext

NewsChannel

TextChannel.constructor

optional guildId?: string

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

TextChannel.guildId


readonly id: string

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

TextChannel.id


optional name?: string | null

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

TextChannel.name


optional nsfw?: boolean

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

TextChannel.nsfw


optional parentId?: string | null

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

TextChannel.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.

TextChannel.partial


permissionOverwrites: APIOverwrite[]

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

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

TextChannel.permissionOverwrites


optional position?: number

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

TextChannel.position


optional rateLimitPerUser?: number

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

TextChannel.rateLimitPerUser


optional topic?: string | null

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

TextChannel.topic


type: number

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

TextChannel.type

get createdAt(): Date

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

Returns the timestamp this snowflake was created at.

Date

TextChannel.createdAt


get createdTimestamp(): number

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

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

number

TextChannel.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"

TextChannel.kind

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.

TextChannel.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.

TextChannel.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.

TextChannel.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.

TextChannel.editName


editParent(parentId): Promise<Channel>

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

string | null

Promise<Channel>

TextChannel.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 })

TextChannel.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.

TextChannel.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" });

TextChannel.is


isDMBased(): boolean

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

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

boolean

TextChannel.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

TextChannel.isTextBased


isThread(): boolean

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

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

boolean

TextChannel.isThread


isVoiceBased(): boolean

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

Whether this is a voice or stage channel.

boolean

TextChannel.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.

TextChannel.send


toString(): string

Defined in: packages/structures/src/resources.ts:348

Discord channel mention string. Used automatically in template literals.

string

TextChannel.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.

TextChannel.update