class GuildChannel

extends

BaseChannel
abstract
export abstract class GuildChannel extends BaseChannel

Represents a guild channel from any of the following: - TextChannel - VoiceChannel - CategoryChannel - AnnouncementChannel - StageChannel - ForumChannel - MediaChannel

Constructors

constructor(
guild: Guild
client?: Client<true>
immediatePatch?: boolean
)

Constructs a new instance of the GuildChannel class

appPermissions : Readonly<PermissionsBitField> | null

The computed permissions of the application in this channel, including overwrites. This is only present on channels received through an interaction's resolved data, and only when the application's bot user is in the guild.

Inherited from: BaseChannel

readonly
client : Client<true>

The client that instantiated this

Inherited from: Base

readonly
createdAt : Date

The time the channel was created at

readonly
createdTimestamp : number

The timestamp the channel was created at

readonly
deletable : boolean

Whether the channel is deletable by the client user

The flags that are applied to the channel. This is only null in a PartialGroupDMChannel. In all other cases, it is not null.

guild : Guild

The guild the channel is in

guildId : Snowflake

The id of the guild the channel is in

id : Snowflake

The channel's id

Inherited from: BaseChannel

readonly
manageable : boolean

Whether the channel is manageable by the client user

readonly
members : Collection<Snowflake, GuildMember>

A collection of cached members of this channel, mapped by their ids. Members that can view this channel, if the channel is text-based. Members in the channel, if the channel is voice-based.

name : string

The name of the guild channel

readonly
parent : CategoryChannel | null

The category parent of this channel

parentId : Snowflake | null

The id of the category parent of this channel

readonly
partial : false

Whether this Channel is a partial This is always false outside of DM channels.

Inherited from: BaseChannel

permissionOverwrites : PermissionOverwriteManager

A manager of permission overwrites that belong to this channel

The computed permissions of the user who invoked the interaction in this channel, including overwrites. This is only present on channels received through an interaction's resolved data.

Inherited from: BaseChannel

readonly
permissionsLocked : boolean | null

If the permissionOverwrites match the parent channel, null if no parent

readonly
position : number

The position of the channel

rawPosition : number

The raw position of the channel from Discord

The type of the channel

readonly
url : string

The URL to the channel

Inherited from: BaseChannel

readonly
viewable : boolean

Whether the channel is viewable by the client user

clone() : Promise<this>

Clones this channel.

delete(
reason?: string
) : Promise<this>

Deletes this channel.

Examples:
// Delete the channel
channel.delete('making room for new channels')
  .then(console.log)
  .catch(console.error);

edit() : Promise<this>

Edits the channel.

Examples:
// Edit a channel
channel.edit({ name: 'new-channel' })
  .then(console.log)
  .catch(console.error);

equals(
channel: GuildChannel
) : boolean

Checks if this channel has the same type, topic, position, name, overwrites, and id as another channel. In most cases, a simple channel.id === channel2.id will do, and is much faster too.

fetch(
force?: boolean = true
) : Promise<this>

Fetches this channel.

Inherited from: BaseChannel

Indicates whether this channel is DM-based (either a DMChannel or a PartialGroupDMChannel).

Inherited from: BaseChannel

isSendable() : this is SendableChannels

Indicates whether this channel is sendable.

Inherited from: BaseChannel

isTextBased() : this is GuildBasedChannel & TextBasedChannel

Indicates whether this channel is text-based.

isThread() : this is AnyThreadChannel

Indicates whether this channel is a ThreadChannel.

Inherited from: BaseChannel

isThreadOnly() : this is ThreadOnlyChannel

Indicates whether this channel is thread-only.

Inherited from: BaseChannel

isVoiceBased() : this is VoiceBasedChannel

Indicates whether this channel is voice-based.

Inherited from: BaseChannel

lockPermissions() : Promise<this>

Locks in the permission overwrites from the parent channel.

permissionsFor(
memberOrRole: GuildMember | Role
checkAdmin?: boolean = true
) : Readonly<PermissionsBitField>

Gets the overall set of permissions for a member or role in this channel, taking into account channel overwrites.

setName(
name: string
reason?: string
) : Promise<this>

Sets a new name for the guild channel.

Examples:
// Set a new channel name
channel.setName('not_general')
  .then(newChannel => console.log(`Channel's new name is ${newChannel.name}`))
  .catch(console.error);

setParent() : Promise<this>

Sets the parent of this channel.

Examples:
// Add a parent to a channel
message.channel.setParent('355908108431917066')
  .then(channel => console.log(`New parent of ${channel.name}: ${channel.parent.name}`))
  .catch(console.error);
// Move a channel and sync its permissions with the parent
message.channel.setParent('355908108431917066', { lockPermissions: true })
  .then(channel => console.log(`Moved ${message.channel.name} to ${channel.parent.name}`))
  .catch(console.error);

setPosition() : Promise<this>

Sets a new position for the guild channel.

Examples:
// Set a new channel position
channel.setPosition(2)
  .then(newChannel => console.log(`Channel's new position is ${newChannel.position}`))
  .catch(console.error);

toJSON(
...props: Record<string, boolean | string>[]
) : unknown

Inherited from: Base

toString() : ChannelMention

When concatenated with a string, this automatically returns the channel's mention instead of the Channel object.

Examples:
// Logs: Hello from <#123456789012345678>!
console.log(`Hello from ${channel}!`);

valueOf() : string

Inherited from: Base