summaryrefslogtreecommitdiff
path: root/node_modules/discord.js/src/structures/VoiceChannel.js
diff options
context:
space:
mode:
author8cy <[email protected]>2020-04-03 02:48:28 -0700
committer8cy <[email protected]>2020-04-03 02:48:28 -0700
commitf9159ea2d994e14180fb02ab562f0119513e67cf (patch)
tree09d14cdf05456567156738b681379d4bccd64e5c /node_modules/discord.js/src/structures/VoiceChannel.js
parent2020/04/03, 02:42, V1.2.1 (diff)
downloads5nical-f9159ea2d994e14180fb02ab562f0119513e67cf.tar.xz
s5nical-f9159ea2d994e14180fb02ab562f0119513e67cf.zip
2020/04/03, 02:47, V1.2.2
Diffstat (limited to 'node_modules/discord.js/src/structures/VoiceChannel.js')
-rw-r--r--node_modules/discord.js/src/structures/VoiceChannel.js146
1 files changed, 0 insertions, 146 deletions
diff --git a/node_modules/discord.js/src/structures/VoiceChannel.js b/node_modules/discord.js/src/structures/VoiceChannel.js
deleted file mode 100644
index a89dafa..0000000
--- a/node_modules/discord.js/src/structures/VoiceChannel.js
+++ /dev/null
@@ -1,146 +0,0 @@
-const GuildChannel = require('./GuildChannel');
-const Collection = require('../util/Collection');
-const Permissions = require('../util/Permissions');
-
-/**
- * Represents a guild voice channel on Discord.
- * @extends {GuildChannel}
- */
-class VoiceChannel extends GuildChannel {
- constructor(guild, data) {
- super(guild, data);
-
- /**
- * The members in this voice channel
- * @type {Collection<Snowflake, GuildMember>}
- */
- this.members = new Collection();
-
- this.type = 'voice';
- }
-
- setup(data) {
- super.setup(data);
-
- /**
- * The bitrate of this voice channel
- * @type {number}
- */
- this.bitrate = data.bitrate * 0.001;
-
- /**
- * The maximum amount of users allowed in this channel - 0 means unlimited.
- * @type {number}
- */
- this.userLimit = data.user_limit;
- }
-
- /**
- * The voice connection for this voice channel, if the client is connected
- * @type {?VoiceConnection}
- * @readonly
- */
- get connection() {
- const connection = this.guild.voiceConnection;
- if (connection && connection.channel.id === this.id) return connection;
- return null;
- }
-
- /**
- * Checks if the voice channel is full
- * @type {boolean}
- * @readonly
- */
- get full() {
- return this.userLimit > 0 && this.members.size >= this.userLimit;
- }
-
- /**
- * Whether the channel is deletable by the client user
- * @type {boolean}
- * @readonly
- */
- get deletable() {
- return super.deletable && this.permissionsFor(this.client.user).has(Permissions.FLAGS.CONNECT);
- }
-
- /**
- * Checks if the client has permission join the voice channel
- * @type {boolean}
- * @readonly
- */
- get joinable() {
- if (this.client.browser) return false;
- if (!this.permissionsFor(this.client.user).has('CONNECT')) return false;
- if (this.full && !this.permissionsFor(this.client.user).has('MOVE_MEMBERS')) return false;
- return true;
- }
-
- /**
- * Checks if the client has permission to send audio to the voice channel
- * @type {boolean}
- * @readonly
- */
- get speakable() {
- return this.permissionsFor(this.client.user).has('SPEAK');
- }
-
- /**
- * Sets the bitrate of the channel (in kbps).
- * @param {number} bitrate The new bitrate
- * @param {string} [reason] Reason for changing the channel's bitrate
- * @returns {Promise<VoiceChannel>}
- * @example
- * // Set the bitrate of a voice channel
- * voiceChannel.setBitrate(48)
- * .then(vc => console.log(`Set bitrate to ${vc.bitrate}kbps for ${vc.name}`))
- * .catch(console.error);
- */
- setBitrate(bitrate, reason) {
- bitrate *= 1000;
- return this.edit({ bitrate }, reason);
- }
-
- /**
- * Sets the user limit of the channel.
- * @param {number} userLimit The new user limit
- * @param {string} [reason] Reason for changing the user limit
- * @returns {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);
- */
- setUserLimit(userLimit, reason) {
- return this.edit({ userLimit }, reason);
- }
-
- /**
- * Attempts to join this voice channel.
- * @returns {Promise<VoiceConnection>}
- * @example
- * // Join a voice channel
- * voiceChannel.join()
- * .then(connection => console.log('Connected!'))
- * .catch(console.error);
- */
- join() {
- if (this.client.browser) return Promise.reject(new Error('Voice connections are not available in browsers.'));
- return this.client.voice.joinChannel(this);
- }
-
- /**
- * Leaves this voice channel.
- * @example
- * // Leave a voice channel
- * voiceChannel.leave();
- */
- leave() {
- if (this.client.browser) return;
- const connection = this.client.voice.connections.get(this.guild.id);
- if (connection && connection.channel.id === this.id) connection.disconnect();
- }
-}
-
-module.exports = VoiceChannel;