Skip to content

Commit c5b6c4d

Browse files
authored
fix: correctly import VoiceState (#4616)
1 parent f628981 commit c5b6c4d

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/client/actions/VoiceStateUpdate.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
'use strict';
22

33
const Action = require('./Action');
4-
const VoiceState = require('../../structures/VoiceState');
54
const { Events } = require('../../util/Constants');
5+
const Structures = require('../../util/Structures');
66

77
class VoiceStateUpdate extends Action {
88
handle(data) {
99
const client = this.client;
1010
const guild = client.guilds.cache.get(data.guild_id);
1111
if (guild) {
12+
const VoiceState = Structures.get('VoiceState');
1213
// Update the state
1314
const oldState = guild.voiceStates.cache.has(data.user_id)
1415
? guild.voiceStates.cache.get(data.user_id)._clone()

src/managers/VoiceStateManager.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
'use strict';
22

33
const BaseManager = require('./BaseManager');
4-
const VoiceState = require('../structures/VoiceState');
54

65
/**
76
* Manages API methods for VoiceStates and stores their cache.
87
* @extends {BaseManager}
98
*/
109
class VoiceStateManager extends BaseManager {
1110
constructor(guild, iterable) {
12-
super(guild.client, iterable, VoiceState);
11+
super(guild.client, iterable, { name: 'VoiceState' });
1312
/**
1413
* The guild this manager belongs to
1514
* @type {Guild}
@@ -27,7 +26,7 @@ class VoiceStateManager extends BaseManager {
2726
const existing = this.cache.get(data.user_id);
2827
if (existing) return existing._patch(data);
2928

30-
const entry = new VoiceState(this.guild, data);
29+
const entry = new this.holds(this.guild, data);
3130
if (cache) this.cache.set(data.user_id, entry);
3231
return entry;
3332
}

0 commit comments

Comments
 (0)