class BaseGuildVoiceChannel

extends

TextBasedChannelMixin(GuildChannel, true, [ 'lastPinTimestamp', 'lastPinAt',])
export class BaseGuildVoiceChannel extends TextBasedChannelMixin(GuildChannel, true, [ 'lastPinTimestamp', 'lastPinAt',])

Represents a voice-based guild channel on Discord.

Constructors

constructor()

Constructs a new instance of the BaseGuildVoiceChannel class

bitrate : number

The bitrate of this voice-based channel

readonly
client : Client

The client that instantiated this

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

optional
flags? : Readonly<ChannelFlagsBitField>

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

readonly
full : boolean

Checks if the voice-based channel is full

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

readonly
joinable : boolean

Whether the channel is joinable by the client user

readonlyoptional
lastMessage? : Message

The Message object of the last message in the channel, if one was sent

optional
lastMessageId? : Snowflake

The last message id sent in the channel, if one was sent

readonly
manageable : boolean

Whether the channel is manageable by the client user

readonly
members : Collection<Snowflake, GuildMember>

The members in this voice-based channel

A manager of the messages sent to this channel

name : string

The name of the guild channel

nsfw : boolean

If the guild considers this channel NSFW

readonlyoptional
parent? : CategoryChannel

The category parent of this channel

optional
parentId? : Snowflake

The id of the category parent of this channel

readonly
partial : boolean

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

permissionOverwrites : PermissionOverwriteManager

A manager of permission overwrites that belong to this channel

readonlyoptional
permissionsLocked? : boolean

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

readonly
position : number

The position of the channel

rateLimitPerUser : number | null

The rate limit per user (slowmode) for this channel in seconds

rawPosition : number

The raw position of the channel from Discord

rtcRegion : string | null

The RTC region for this voice-based channel. This region is automatically selected if null.

type : ChannelType

The type of the channel

readonly
url : string

The URL to the channel

userLimit : number

The maximum amount of users allowed in this channel.

videoQualityMode : VideoQualityMode | null

The camera video quality mode of the channel.

readonly
viewable : boolean

Whether the channel is viewable by the client user

Collects a single component interaction that passes the filter. The Promise will reject if the time expires.

Examples:
// Collect a message component interaction
const filter = (interaction) => interaction.customId === 'button' && interaction.user.id === 'someId';
channel.awaitMessageComponent({ filter, time: 15_000 })
  .then(interaction => console.log(`${interaction.customId} was clicked!`))
  .catch(console.error);

Similar to createMessageCollector but in promise form. Resolves with a collection of messages that pass the specified filter.

Examples:
// Await !vote messages
const filter = m => m.content.startsWith('!vote');
// Errors: ['time'] treats ending because of the time limit as an error
channel.awaitMessages({ filter, max: 4, time: 60_000, errors: ['time'] })
  .then(collected => console.log(collected.size))
  .catch(collected => console.log(`After a minute, only ${collected.size} out of 4 voted.`));

Bulk deletes given messages that are newer than two weeks.

Examples:
// Bulk delete messages
channel.bulkDelete(5)
  .then(messages => console.log(`Bulk deleted ${messages.size} messages`))
  .catch(console.error);

Returns: Returns the deleted messages *

createInvite() : Promise<Invite>

Creates an invite to this guild channel.

Examples:
// Create an invite to a channel
channel.createInvite()
  .then(invite => console.log(`Created an invite with a code of ${invite.code}`))
  .catch(console.error);

createMessageCollector() : MessageCollector

Creates a Message Collector.

Examples:
// Create a message collector
const filter = message => message.content.includes('discord');
const collector = channel.createMessageCollector({ filter, time: 15_000 });
collector.on('collect', message => console.log(`Collected ${message.content}`));
collector.on('end', collected => console.log(`Collected ${collected.size} items`));

createMessageComponentCollector() : InteractionCollector

Creates a component interaction collector.

Examples:
// Create a button interaction collector
const filter = (interaction) => interaction.customId === 'button' && interaction.user.id === 'someId';
const collector = channel.createMessageComponentCollector({ filter, time: 15_000 });
collector.on('collect', interaction => console.log(`Collected ${interaction.customId}`));
collector.on('end', collected => console.log(`Collected ${collected.size} items`));

createWebhook() : Promise<Webhook>

Creates a webhook for the channel.

Examples:
// Create a webhook for the current channel
channel.createWebhook({
  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 *

fetchInvites(
cache?: boolean
) : Promise<Collection<string, Invite>>

Fetches a collection of invites to this guild channel.

fetchWebhooks() : Promise<Collection<Snowflake, Webhook>>

Fetches all webhooks for the channel.

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

Sends a message to this channel.

Examples:
// Send a basic message
channel.send('hello!')
  .then(message => console.log(`Sent message: ${message.content}`))
  .catch(console.error);
// Send a remote file
channel.send({
  files: ['https://cdn.discordapp.com/icons/222078108977594368/6e1019b3179d71046e463a75915e7244.png?size=2048']
})
  .then(console.log)
  .catch(console.error);
// Send a local file
channel.send({
  files: [{
    attachment: 'entire/path/to/file.jpg',
    name: 'file.jpg',
    description: 'A description of the file'
  }]
})
  .then(console.log)
  .catch(console.error);

sendTyping() : Promise<void>

Sends a typing indicator in the channel.

Examples:
// Start typing in a channel
channel.sendTyping();

Returns: Resolves upon the typing status being sent *

setBitrate(
bitrate: number
reason?: string
) : Promise<this>

Sets the bitrate of the channel.

Examples:
// Set the bitrate of a voice channel
channel.setBitrate(48_000)
  .then(channel => console.log(`Set bitrate to ${channel.bitrate}bps for ${channel.name}`))
  .catch(console.error);

setNSFW(
nsfw?: boolean
reason?: string
) : Promise<this>

Sets whether this channel is flagged as NSFW.

setRateLimitPerUser(
rateLimitPerUser: number
reason?: string
) : Promise<this>

Sets the rate limit per user (slowmode) for this channel.

setRTCRegion(
rtcRegion: string | null
reason?: string
) : Promise<this>

Sets the RTC region of the channel.

Examples:
// Set the RTC region to sydney
channel.setRTCRegion('sydney');
// Remove a fixed region for this channel - let Discord decide automatically
channel.setRTCRegion(null, 'We want to let Discord decide.');

setUserLimit(
userLimit: number
reason?: string
) : Promise<this>

Sets the user limit of the channel.

Examples:
// Set the user limit of a voice channel
channel.setUserLimit(42)
  .then(channel => console.log(`Set user limit to ${channel.userLimit} for ${channel.name}`))
  .catch(console.error);

setVideoQualityMode(
videoQualityMode: VideoQualityMode
reason?: string
) : Promise<this>

Sets the camera video quality mode of the channel.