summaryrefslogtreecommitdiff
path: root/node_modules/discord.js/src/structures/VoiceChannel.js
diff options
context:
space:
mode:
authorsowgro <tpoke.ferrari@gmail.com>2023-09-02 19:12:47 -0400
committersowgro <tpoke.ferrari@gmail.com>2023-09-02 19:12:47 -0400
commite4450c8417624b71d779cb4f41692538f9165e10 (patch)
treeb70826542223ecdf8a7a259f61b0a1abb8a217d8 /node_modules/discord.js/src/structures/VoiceChannel.js
downloadsowbot3-e4450c8417624b71d779cb4f41692538f9165e10.tar.gz
sowbot3-e4450c8417624b71d779cb4f41692538f9165e10.tar.bz2
sowbot3-e4450c8417624b71d779cb4f41692538f9165e10.zip
first commit
Diffstat (limited to 'node_modules/discord.js/src/structures/VoiceChannel.js')
-rw-r--r--node_modules/discord.js/src/structures/VoiceChannel.js96
1 files changed, 96 insertions, 0 deletions
diff --git a/node_modules/discord.js/src/structures/VoiceChannel.js b/node_modules/discord.js/src/structures/VoiceChannel.js
new file mode 100644
index 0000000..d4f33ca
--- /dev/null
+++ b/node_modules/discord.js/src/structures/VoiceChannel.js
@@ -0,0 +1,96 @@
+'use strict';
+
+const { PermissionFlagsBits } = require('discord-api-types/v10');
+const BaseGuildVoiceChannel = require('./BaseGuildVoiceChannel');
+
+/**
+ * Represents a guild voice channel on Discord.
+ * @extends {BaseGuildVoiceChannel}
+ */
+class VoiceChannel extends BaseGuildVoiceChannel {
+ /**
+ * Whether the channel is joinable by the client user
+ * @type {boolean}
+ * @readonly
+ */
+ get joinable() {
+ if (!super.joinable) return false;
+ if (this.full && !this.permissionsFor(this.client.user).has(PermissionFlagsBits.MoveMembers, false)) return false;
+ return true;
+ }
+
+ /**
+ * Checks if the client has permission to send audio to the voice channel
+ * @type {boolean}
+ * @readonly
+ */
+ get speakable() {
+ const permissions = this.permissionsFor(this.client.user);
+ if (!permissions) return false;
+ // This flag allows speaking even if timed out
+ if (permissions.has(PermissionFlagsBits.Administrator, false)) return true;
+
+ return (
+ this.guild.members.me.communicationDisabledUntilTimestamp < Date.now() &&
+ permissions.has(PermissionFlagsBits.Speak, false)
+ );
+ }
+}
+
+/**
+ * Sets the bitrate of the channel.
+ * @method setBitrate
+ * @memberof VoiceChannel
+ * @instance
+ * @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_000)
+ * .then(channel => console.log(`Set bitrate to ${channel.bitrate}bps for ${channel.name}`))
+ * .catch(console.error);
+ */
+
+/**
+ * Sets the RTC region of the channel.
+ * @method setRTCRegion
+ * @memberof VoiceChannel
+ * @instance
+ * @param {?string} rtcRegion The new region of the channel. Set to `null` to remove a specific region for the channel
+ * @param {string} [reason] The reason for modifying this region.
+ * @returns {Promise<VoiceChannel>}
+ * @example
+ * // Set the RTC region to sydney
+ * voiceChannel.setRTCRegion('sydney');
+ * @example
+ * // Remove a fixed region for this channel - let Discord decide automatically
+ * voiceChannel.setRTCRegion(null, 'We want to let Discord decide.');
+ */
+
+/**
+ * Sets the user limit of the channel.
+ * @method setUserLimit
+ * @memberof VoiceChannel
+ * @instance
+ * @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(channel => console.log(`Set user limit to ${channel.userLimit} for ${channel.name}`))
+ * .catch(console.error);
+ */
+
+/**
+ * Sets the camera video quality mode of the channel.
+ * @method setVideoQualityMode
+ * @memberof VoiceChannel
+ * @instance
+ * @param {VideoQualityMode} videoQualityMode The new camera video quality mode.
+ * @param {string} [reason] Reason for changing the camera video quality mode.
+ * @returns {Promise<VoiceChannel>}
+ */
+
+module.exports = VoiceChannel;