mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-11 09:03:29 +01:00
rewrite voice state handling
This commit is contained in:
20
src/stores/VoiceStateStore.js
Normal file
20
src/stores/VoiceStateStore.js
Normal file
@@ -0,0 +1,20 @@
|
||||
const DataStore = require('./DataStore');
|
||||
const VoiceState = require('../structures/VoiceState');
|
||||
|
||||
class VoiceStateStore extends DataStore {
|
||||
constructor(guild, iterable) {
|
||||
super(guild.client, iterable, VoiceState);
|
||||
this.guild = guild;
|
||||
}
|
||||
|
||||
add(data, cache = true) {
|
||||
const existing = this.get(data.user_id);
|
||||
if (existing) return existing;
|
||||
|
||||
const entry = new VoiceState(this.guild, data);
|
||||
if (cache) this.set(data.user_id, entry);
|
||||
return entry;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = VoiceStateStore;
|
||||
Reference in New Issue
Block a user