fix(playinterface): lazy require VoiceBroadcast to avoid circul… (#3864)

This commit is contained in:
SpaceEEC
2020-02-29 19:07:23 +01:00
committed by GitHub
parent acdd832fe2
commit 713309e7bb

View File

@@ -60,7 +60,8 @@ class PlayInterface {
* @returns {StreamDispatcher} * @returns {StreamDispatcher}
*/ */
play(resource, options = {}) { play(resource, options = {}) {
if (resource instanceof Broadcast) { const VoiceBroadcast = require('../VoiceBroadcast');
if (resource instanceof VoiceBroadcast) {
if (!this.player.playBroadcast) throw new Error('VOICE_PLAY_INTERFACE_NO_BROADCAST'); if (!this.player.playBroadcast) throw new Error('VOICE_PLAY_INTERFACE_NO_BROADCAST');
return this.player.playBroadcast(resource, options); return this.player.playBroadcast(resource, options);
} }
@@ -91,6 +92,3 @@ class PlayInterface {
} }
module.exports = PlayInterface; module.exports = PlayInterface;
// eslint-disable-next-line import/order
const Broadcast = require('../VoiceBroadcast');