mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
fix: correctly import VoiceState (#4616)
This commit is contained in:
@@ -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()
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user