mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-14 02:23:31 +01:00
voice: remove Guild.voiceConnection and VoiceChannel.connection
This commit is contained in:
@@ -37,7 +37,7 @@ class GuildDeleteAction extends Action {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (const channel of guild.channels.values()) this.client.channels.remove(channel.id);
|
for (const channel of guild.channels.values()) this.client.channels.remove(channel.id);
|
||||||
if (guild.voiceConnection) guild.voiceConnection.disconnect();
|
if (guild.voice && guild.voice.connection) guild.voice.connection.disconnect();
|
||||||
|
|
||||||
// Delete guild
|
// Delete guild
|
||||||
client.guilds.remove(guild.id);
|
client.guilds.remove(guild.id);
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ const PlayInterface = require('./util/PlayInterface');
|
|||||||
* const broadcast = client.voice.createBroadcast();
|
* const broadcast = client.voice.createBroadcast();
|
||||||
* broadcast.play('./music.mp3');
|
* broadcast.play('./music.mp3');
|
||||||
* // Play "music.mp3" in all voice connections that the client is in
|
* // Play "music.mp3" in all voice connections that the client is in
|
||||||
* for (const connection of client.voiceConnections.values()) {
|
* for (const connection of client.voice.connections.values()) {
|
||||||
* connection.play(broadcast);
|
* connection.play(broadcast);
|
||||||
* }
|
* }
|
||||||
* ```
|
* ```
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ const Integration = require('./Integration');
|
|||||||
const GuildAuditLogs = require('./GuildAuditLogs');
|
const GuildAuditLogs = require('./GuildAuditLogs');
|
||||||
const Webhook = require('./Webhook');
|
const Webhook = require('./Webhook');
|
||||||
const VoiceRegion = require('./VoiceRegion');
|
const VoiceRegion = require('./VoiceRegion');
|
||||||
const { ChannelTypes, DefaultMessageNotifications, PartialTypes, browser } = require('../util/Constants');
|
const { ChannelTypes, DefaultMessageNotifications, PartialTypes } = require('../util/Constants');
|
||||||
const Collection = require('../util/Collection');
|
const Collection = require('../util/Collection');
|
||||||
const Util = require('../util/Util');
|
const Util = require('../util/Util');
|
||||||
const DataResolver = require('../util/DataResolver');
|
const DataResolver = require('../util/DataResolver');
|
||||||
@@ -368,16 +368,6 @@ class Guild extends Base {
|
|||||||
return this.client.channels.get(this.systemChannelID) || null;
|
return this.client.channels.get(this.systemChannelID) || null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* If the client is connected to any voice channel in this guild, this will be the relevant VoiceConnection
|
|
||||||
* @type {?VoiceConnection}
|
|
||||||
* @readonly
|
|
||||||
*/
|
|
||||||
get voiceConnection() {
|
|
||||||
if (browser) return null;
|
|
||||||
return this.client.voice.connections.get(this.id) || null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The `@everyone` role of the guild
|
* The `@everyone` role of the guild
|
||||||
* @type {?Role}
|
* @type {?Role}
|
||||||
|
|||||||
@@ -42,17 +42,6 @@ class VoiceChannel extends GuildChannel {
|
|||||||
return coll;
|
return coll;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 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
|
* Checks if the voice channel is full
|
||||||
* @type {boolean}
|
* @type {boolean}
|
||||||
|
|||||||
Reference in New Issue
Block a user