fix: correctly import VoiceState (#4616)

This commit is contained in:
Sugden
2020-08-11 21:59:03 +01:00
committed by GitHub
parent f628981f42
commit c5b6c4da43
2 changed files with 4 additions and 4 deletions

View File

@@ -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()

View File

@@ -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;
}