Preview environment
export class GuildChannelManager extends CachedManager<Snowflake, GuildBasedChannel, GuildChannelResolvable>

Manages API methods for GuildChannels and stores their cache.

readonly
cache : Collection<Key, Holds>

The cache of items for this manager.

Inherited from: DataManager

readonly
channelCountWithoutThreads : number

The number of channels in this managers cache excluding thread channels that do not count towards a guild's maximum channels restriction.

readonly
client : Client

The client that instantiated this Manager

Inherited from: BaseManager

guild : Guild

The guild this Manager belongs to

readonly
holds : Constructable<Holds>

The data structure belonging to this manager.

Inherited from: DataManager

addFollower(
targetChannel: TextChannelResolvable
reason?: string
) : Promise<Snowflake>

Adds the target channel to a channel's followers.

Returns: Returns created target webhook id.

create<

Type extends GuildChannelTypes

>(
options: GuildChannelCreateOptions & { type: Type }
) : Promise<MappedGuildChannelTypes[Type]>

Creates a new channel in the guild.

Examples:
// Create a new text channel
guild.channels.create({ name: 'new-general', reason: 'Needed a cool new channel' })
  .then(console.log)
  .catch(console.error);
// Create a new channel with permission overwrites
guild.channels.create({
  name: 'new-general',
  type: ChannelType.GuildVoice,
  permissionOverwrites: [
     {
       id: message.author.id,
       deny: [PermissionFlagsBits.ViewChannel],
    },
  ],
})

Creates a webhook for the channel.

Examples:
// Create a webhook for the current channel
guild.channels.createWebhook({
  channel: '222197033908436994',
  name: 'Snek',
  avatar: 'https://i.imgur.com/mI8XcpG.jpg',
  reason: 'Needed a cool new Webhook'
})
  .then(console.log)
  .catch(console.error)

Returns: Returns the created Webhook

delete() : Promise<void>

Deletes the channel.

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

Edits the channel.

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

Obtains one or more guild channels from Discord, or the channel cache if they're already available.

Examples:
// Fetch all channels from the guild (excluding threads)
message.guild.channels.fetch()
  .then(channels => console.log(`There are ${channels.size} channels.`))
  .catch(console.error);
// Fetch a single channel
message.guild.channels.fetch('222197033908436994')
  .then(channel => console.log(`The channel name is: ${channel.name}`))
  .catch(console.error);

fetchActiveThreads(
cache?: boolean
) : Promise<FetchedThreads>

Obtains all active thread channels in the guild.

Examples:
// Fetch all threads from the guild
message.guild.channels.fetchActiveThreads()
  .then(fetched => console.log(`There are ${fetched.threads.size} threads.`))
  .catch(console.error);

Fetches all webhooks for the channel.

Examples:
// Fetch webhooks
guild.channels.fetchWebhooks('769862166131245066')
  .then(hooks => console.log(`This channel has ${hooks.size} hooks`))
  .catch(console.error);

Resolves a GuildChannelResolvable to a Channel object.

resolveId() : Snowflake | null

Resolves a GuildChannelResolvable to a channel id.

setPosition() : Promise<GuildChannel>

Sets a new position for the guild channel.

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

setPositions(
channelPositions: readonly ChannelPosition[]
) : Promise<Guild>

Batch-updates the guild's channels' positions. Only one channel's parent can be changed at a time

Examples:
guild.channels.setPositions([{ channel: channelId, position: newChannelIndex }])
  .then(guild => console.log(`Updated channel positions for ${guild}`))
  .catch(console.error);

valueOf() : Collection<Key, Holds>

Inherited from: DataManager