v2.2.0
Discord.js v13.8.0
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
|
||||
const process = require('node:process');
|
||||
const BaseGuildVoiceChannel = require('./BaseGuildVoiceChannel');
|
||||
const TextBasedChannel = require('./interfaces/TextBasedChannel');
|
||||
const MessageManager = require('../managers/MessageManager');
|
||||
const { VideoQualityModes } = require('../util/Constants');
|
||||
const Permissions = require('../util/Permissions');
|
||||
|
||||
@@ -10,8 +12,21 @@ let deprecationEmittedForEditable = false;
|
||||
/**
|
||||
* Represents a guild voice channel on Discord.
|
||||
* @extends {BaseGuildVoiceChannel}
|
||||
* @implements {TextBasedChannel}
|
||||
*/
|
||||
class VoiceChannel extends BaseGuildVoiceChannel {
|
||||
constructor(guild, data, client) {
|
||||
super(guild, data, client, false);
|
||||
|
||||
/**
|
||||
* A manager of the messages sent to this channel
|
||||
* @type {MessageManager}
|
||||
*/
|
||||
this.messages = new MessageManager(this);
|
||||
|
||||
this._patch(data);
|
||||
}
|
||||
|
||||
_patch(data) {
|
||||
super._patch(data);
|
||||
|
||||
@@ -20,10 +35,30 @@ class VoiceChannel extends BaseGuildVoiceChannel {
|
||||
* The camera video quality mode of the channel.
|
||||
* @type {?VideoQualityMode}
|
||||
*/
|
||||
this.videoQualityMode = VideoQualityModes[data.videoQualityMode];
|
||||
this.videoQualityMode = VideoQualityModes[data.video_quality_mode];
|
||||
} else {
|
||||
this.videoQualityMode ??= null;
|
||||
}
|
||||
|
||||
if ('last_message_id' in data) {
|
||||
/**
|
||||
* The last message id sent in the channel, if one was sent
|
||||
* @type {?Snowflake}
|
||||
*/
|
||||
this.lastMessageId = data.last_message_id;
|
||||
}
|
||||
|
||||
if ('messages' in data) {
|
||||
for (const message of data.messages) this.messages._add(message);
|
||||
}
|
||||
|
||||
if ('rate_limit_per_user' in data) {
|
||||
/**
|
||||
* The rate limit per user (slowmode) for this channel in seconds
|
||||
* @type {number}
|
||||
*/
|
||||
this.rateLimitPerUser = data.rate_limit_per_user;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -112,6 +147,21 @@ class VoiceChannel extends BaseGuildVoiceChannel {
|
||||
return this.edit({ videoQualityMode }, reason);
|
||||
}
|
||||
|
||||
// These are here only for documentation purposes - they are implemented by TextBasedChannel
|
||||
/* eslint-disable no-empty-function */
|
||||
get lastMessage() {}
|
||||
send() {}
|
||||
sendTyping() {}
|
||||
createMessageCollector() {}
|
||||
awaitMessages() {}
|
||||
createMessageComponentCollector() {}
|
||||
awaitMessageComponent() {}
|
||||
bulkDelete() {}
|
||||
fetchWebhooks() {}
|
||||
createWebhook() {}
|
||||
setRateLimitPerUser() {}
|
||||
setNSFW() {}
|
||||
|
||||
/**
|
||||
* Sets the RTC region of the channel.
|
||||
* @name VoiceChannel#setRTCRegion
|
||||
@@ -127,4 +177,6 @@ class VoiceChannel extends BaseGuildVoiceChannel {
|
||||
*/
|
||||
}
|
||||
|
||||
TextBasedChannel.applyToClass(VoiceChannel, true, ['lastPinAt']);
|
||||
|
||||
module.exports = VoiceChannel;
|
||||
|
||||
Reference in New Issue
Block a user