From c5b6c4da43b9e631963e5437b27110030e7f0d2c Mon Sep 17 00:00:00 2001 From: Sugden <28943913+NotSugden@users.noreply.github.com> Date: Tue, 11 Aug 2020 21:59:03 +0100 Subject: [PATCH] fix: correctly import VoiceState (#4616) --- src/client/actions/VoiceStateUpdate.js | 3 ++- src/managers/VoiceStateManager.js | 5 ++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/client/actions/VoiceStateUpdate.js b/src/client/actions/VoiceStateUpdate.js index 6f2ee9dd5..406bd2fb3 100644 --- a/src/client/actions/VoiceStateUpdate.js +++ b/src/client/actions/VoiceStateUpdate.js @@ -1,14 +1,15 @@ 'use strict'; const Action = require('./Action'); -const VoiceState = require('../../structures/VoiceState'); const { Events } = require('../../util/Constants'); +const Structures = require('../../util/Structures'); class VoiceStateUpdate extends Action { handle(data) { const client = this.client; const guild = client.guilds.cache.get(data.guild_id); if (guild) { + const VoiceState = Structures.get('VoiceState'); // Update the state const oldState = guild.voiceStates.cache.has(data.user_id) ? guild.voiceStates.cache.get(data.user_id)._clone() diff --git a/src/managers/VoiceStateManager.js b/src/managers/VoiceStateManager.js index 4a26b3047..35045f7b4 100644 --- a/src/managers/VoiceStateManager.js +++ b/src/managers/VoiceStateManager.js @@ -1,7 +1,6 @@ 'use strict'; const BaseManager = require('./BaseManager'); -const VoiceState = require('../structures/VoiceState'); /** * Manages API methods for VoiceStates and stores their cache. @@ -9,7 +8,7 @@ const VoiceState = require('../structures/VoiceState'); */ class VoiceStateManager extends BaseManager { constructor(guild, iterable) { - super(guild.client, iterable, VoiceState); + super(guild.client, iterable, { name: 'VoiceState' }); /** * The guild this manager belongs to * @type {Guild} @@ -27,7 +26,7 @@ class VoiceStateManager extends BaseManager { const existing = this.cache.get(data.user_id); if (existing) return existing._patch(data); - const entry = new VoiceState(this.guild, data); + const entry = new this.holds(this.guild, data); if (cache) this.cache.set(data.user_id, entry); return entry; }