Extends
Members
bitrate :number
The bitrate of this voice channel
Type:
- number
- Source:
(readonly) client :Client
The client that instantiated this
Type:
- Inherited From:
- Source:
(readonly) createdAt :Date
The time the channel was created at
Type:
- Date
- Inherited From:
- Source:
(readonly) createdTimestamp :number
The timestamp the channel was created at
Type:
- number
- Inherited From:
- Source:
(readonly) deletable :boolean
Whether the channel is deletable by the client user
Type:
- boolean
- Overrides:
- Source:
deleted :boolean
Whether the channel has been deleted
Type:
- boolean
- Inherited From:
- Source:
(readonly) editable :boolean
Whether the channel is editable by the client user
Type:
- boolean
- Source:
(readonly) full :boolean
Checks if the voice channel is full
Type:
- boolean
- Source:
guild :Guild
The guild the channel is in
Type:
- Inherited From:
- Source:
id :Snowflake
The unique ID of the channel
Type:
- Inherited From:
- Source:
(readonly) joinable :boolean
Whether the channel is joinable by the client user
Type:
- boolean
- Source:
(readonly) manageable :boolean
Whether the channel is manageable by the client user
Type:
- boolean
- Inherited From:
- Source:
(readonly) members :Collection.<Snowflake, GuildMember>
The members in this voice channel
Type:
- Collection.<Snowflake, GuildMember>
- Overrides:
- Source:
name :string
The name of the guild channel
Type:
- string
- Inherited From:
- Source:
(readonly, nullable) parent :CategoryChannel
The category parent of this channel
Type:
- Inherited From:
- Source:
(nullable) parentID :Snowflake
The ID of the category parent of this channel
Type:
- Inherited From:
- Source:
permissionOverwrites :Collection.<Snowflake, PermissionOverwrites>
A map of permission overwrites in this channel for roles and users
Type:
- Collection.<Snowflake, PermissionOverwrites>
- Inherited From:
- Source:
(readonly, nullable) permissionsLocked :boolean
If the permissionOverwrites match the parent channel, null if no parent
Type:
- boolean
- Inherited From:
- Source:
(readonly) position :number
The position of the channel
Type:
- number
- Inherited From:
- Source:
rawPosition :number
The raw position of the channel from discord
Type:
- number
- Inherited From:
- Source:
(readonly) speakable :boolean
Checks if the client has permission to send audio to the voice channel
Type:
- boolean
- Source:
type :string
The type of the channel, either:
* `dm` - a DM channel
* `text` - a guild text channel
* `voice` - a guild voice channel
* `category` - a guild category channel
* `news` - a guild news channel
* `store` - a guild store channel
* `unknown` - a generic channel of unknown type, could be Channel or GuildChannel
Type:
- string
- Inherited From:
- Source:
userLimit :number
The maximum amount of users allowed in this channel - 0 means unlimited.
Type:
- number
- Source:
(readonly) viewable :boolean
Whether the channel is viewable by the client user
Type:
- boolean
- Inherited From:
- Source:
Methods
clone(optionsopt) → {Promise.<GuildChannel>}
Clones this channel.
Parameters:
Name | Type | Attributes | Description | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object |
<optional> |
The options
Properties
|
- Inherited From:
- Source:
Returns:
- Type
- Promise.<GuildChannel>
createInvite(optionsopt) → {Promise.<Invite>}
Creates an invite to this guild channel.
Parameters:
Name | Type | Attributes | Default | Description | ||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object |
<optional> |
{} | Options for the invite
Properties
|
- Inherited From:
- Source:
Returns:
- Type
- Promise.<Invite>
Example
// Create an invite to a channel
channel.createInvite()
.then(invite => console.log(`Created an invite with a code of ${invite.code}`))
.catch(console.error);
createOverwrite(userOrRole, options, reasonopt) → {Promise.<GuildChannel>}
Overwrites the permissions for a user or role in this channel. (replaces if existent)
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
userOrRole |
RoleResolvable | UserResolvable | The user or role to update | |
options |
PermissionOverwriteOptions | The options for the update | |
reason |
string |
<optional> |
Reason for creating/editing this overwrite |
- Inherited From:
- Source:
Returns:
- Type
- Promise.<GuildChannel>
Example
// Create or Replace permissions overwrites for a message author
message.channel.createOverwrite(message.author, {
SEND_MESSAGES: false
})
.then(channel => console.log(channel.permissionOverwrites.get(message.author.id)))
.catch(console.error);
delete(reasonopt) → {Promise.<GuildChannel>}
Deletes this channel.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
reason |
string |
<optional> |
Reason for deleting this channel |
- Inherited From:
- Source:
Returns:
- Type
- Promise.<GuildChannel>
Example
// Delete the channel
channel.delete('making room for new channels')
.then(console.log)
.catch(console.error);
edit(data, reasonopt) → {Promise.<GuildChannel>}
Edits the channel.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
data |
ChannelData | The new data for the channel | |
reason |
string |
<optional> |
Reason for editing this channel |
- Inherited From:
- Source:
Returns:
- Type
- Promise.<GuildChannel>
Example
// Edit a channel
channel.edit({ name: 'new-channel' })
.then(console.log)
.catch(console.error);
equals(channel) → {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.
Parameters:
Name | Type | Description |
---|---|---|
channel |
GuildChannel | Channel to compare with |
- Inherited From:
- Source:
Returns:
- Type
- boolean
fetch(forceopt) → {Promise.<Channel>}
Fetches this channel.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
force |
boolean |
<optional> |
false | Whether to skip the cache check and request the API |
- Inherited From:
- Source:
Returns:
- Type
- Promise.<Channel>
fetchInvites() → {Promise.<Collection.<string, Invite>>}
Fetches a collection of invites to this guild channel.
Resolves with a collection mapping invites by their codes.
- Inherited From:
- Source:
Returns:
- Type
- Promise.<Collection.<string, Invite>>
isText() → {boolean}
Indicates whether this channel is text-based.
- Inherited From:
- Source:
Returns:
- Type
- boolean
join() → {Promise.<VoiceConnection>}
Attempts to join this voice channel.
- Source:
Returns:
- Type
- Promise.<VoiceConnection>
Example
// Join a voice channel
voiceChannel.join()
.then(connection => console.log('Connected!'))
.catch(console.error);
leave()
Leaves this voice channel.
- Source:
Example
// Leave a voice channel
voiceChannel.leave();
lockPermissions() → {Promise.<GuildChannel>}
Locks in the permission overwrites from the parent channel.
- Inherited From:
- Source:
Returns:
- Type
- Promise.<GuildChannel>
(private) memberPermissions(member) → {Readonly.<Permissions>}
Gets the overall set of permissions for a member in this channel, taking into account channel overwrites.
Parameters:
Name | Type | Description |
---|---|---|
member |
GuildMember | The member to obtain the overall permissions for |
- Inherited From:
- Source:
Returns:
- Type
- Readonly.<Permissions>
overwritePermissions(overwrites, reasonopt) → {Promise.<GuildChannel>}
Replaces the permission overwrites in this channel.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
overwrites |
Array.<OverwriteResolvable> | Collection.<Snowflake, OverwriteResolvable> | Permission overwrites the channel gets updated with | |
reason |
string |
<optional> |
Reason for updating the channel overwrites |
- Inherited From:
- Source:
Returns:
- Type
- Promise.<GuildChannel>
Example
channel.overwritePermissions([
{
id: message.author.id,
deny: ['VIEW_CHANNEL'],
},
], 'Needed to change permissions');
permissionsFor(memberOrRole) → {Readonly.<Permissions>}
Gets the overall set of permissions for a member or role in this channel, taking into account channel overwrites.
Parameters:
Name | Type | Description |
---|---|---|
memberOrRole |
GuildMemberResolvable | RoleResolvable | The member or role to obtain the overall permissions for |
- Inherited From:
- Source:
Returns:
- Type
- Readonly.<Permissions>
(private) rolePermissions(role) → {Readonly.<Permissions>}
Gets the overall set of permissions for a role in this channel, taking into account channel overwrites.
Parameters:
Name | Type | Description |
---|---|---|
role |
Role | The role to obtain the overall permissions for |
- Inherited From:
- Source:
Returns:
- Type
- Readonly.<Permissions>
setBitrate(bitrate, reasonopt) → {Promise.<VoiceChannel>}
Sets the bitrate of the channel.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
bitrate |
number | The new bitrate | |
reason |
string |
<optional> |
Reason for changing the channel's bitrate |
- Source:
Returns:
- Type
- Promise.<VoiceChannel>
Example
// Set the bitrate of a voice channel
voiceChannel.setBitrate(48000)
.then(vc => console.log(`Set bitrate to ${vc.bitrate}bps for ${vc.name}`))
.catch(console.error);
setName(name, reasonopt) → {Promise.<GuildChannel>}
Sets a new name for the guild channel.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
name |
string | The new name for the guild channel | |
reason |
string |
<optional> |
Reason for changing the guild channel's name |
- Inherited From:
- Source:
Returns:
- Type
- Promise.<GuildChannel>
Example
// Set a new channel name
channel.setName('not_general')
.then(newChannel => console.log(`Channel's new name is ${newChannel.name}`))
.catch(console.error);
setParent(channel, optionsopt) → {Promise.<GuildChannel>}
Sets the category parent of this channel.
Parameters:
Name | Type | Attributes | Default | Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
channel |
CategoryChannel | Snowflake | Parent channel | |||||||||||||||||
options |
Object |
<optional> |
{} | Options to pass
Properties
|
- Inherited From:
- Source:
Returns:
- Type
- Promise.<GuildChannel>
Example
// Add a parent to a channel
message.channel.setParent('355908108431917066', { lockPermissions: false })
.then(channel => console.log(`New parent of ${message.channel.name}: ${channel.name}`))
.catch(console.error);
setPosition(position, optionsopt) → {Promise.<GuildChannel>}
Sets a new position for the guild channel.
Parameters:
Name | Type | Attributes | Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
position |
number | The new position for the guild channel | ||||||||||||||||
options |
Object |
<optional> |
Options for setting position
Properties
|
- Inherited From:
- Source:
Returns:
- Type
- Promise.<GuildChannel>
Example
// Set a new channel position
channel.setPosition(2)
.then(newChannel => console.log(`Channel's new position is ${newChannel.position}`))
.catch(console.error);
setTopic(topic, reasonopt) → {Promise.<GuildChannel>}
Sets a new topic for the guild channel.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
topic |
string | The new topic for the guild channel | |
reason |
string |
<optional> |
Reason for changing the guild channel's topic |
- Inherited From:
- Source:
Returns:
- Type
- Promise.<GuildChannel>
Example
// Set a new channel topic
channel.setTopic('needs more rate limiting')
.then(newChannel => console.log(`Channel's new topic is ${newChannel.topic}`))
.catch(console.error);
setUserLimit(userLimit, reasonopt) → {Promise.<VoiceChannel>}
Sets the user limit of the channel.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
userLimit |
number | The new user limit | |
reason |
string |
<optional> |
Reason for changing the user limit |
- Source:
Returns:
- Type
- Promise.<VoiceChannel>
Example
// Set the user limit of a voice channel
voiceChannel.setUserLimit(42)
.then(vc => console.log(`Set user limit to ${vc.userLimit} for ${vc.name}`))
.catch(console.error);
toString() → {string}
When concatenated with a string, this automatically returns the channel's mention instead of the Channel object.
- Inherited From:
- Source:
Returns:
- Type
- string
Example
// Logs: Hello from <#123456789012345678>!
console.log(`Hello from ${channel}!`);
updateOverwrite(userOrRole, options, reasonopt) → {Promise.<GuildChannel>}
Updates Overwrites for a user or role in this channel. (creates if non-existent)
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
userOrRole |
RoleResolvable | UserResolvable | The user or role to update | |
options |
PermissionOverwriteOptions | The options for the update | |
reason |
string |
<optional> |
Reason for creating/editing this overwrite |
- Inherited From:
- Source:
Returns:
- Type
- Promise.<GuildChannel>
Example
// Update or Create permission overwrites for a message author
message.channel.updateOverwrite(message.author, {
SEND_MESSAGES: false
})
.then(channel => console.log(channel.permissionOverwrites.get(message.author.id)))
.catch(console.error);