summaryrefslogtreecommitdiff
path: root/node_modules/discord.js/src/managers/VoiceStateManager.js
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/discord.js/src/managers/VoiceStateManager.js')
-rw-r--r--node_modules/discord.js/src/managers/VoiceStateManager.js37
1 files changed, 37 insertions, 0 deletions
diff --git a/node_modules/discord.js/src/managers/VoiceStateManager.js b/node_modules/discord.js/src/managers/VoiceStateManager.js
new file mode 100644
index 0000000..c42fdd2
--- /dev/null
+++ b/node_modules/discord.js/src/managers/VoiceStateManager.js
@@ -0,0 +1,37 @@
+'use strict';
+
+const CachedManager = require('./CachedManager');
+const VoiceState = require('../structures/VoiceState');
+
+/**
+ * Manages API methods for VoiceStates and stores their cache.
+ * @extends {CachedManager}
+ */
+class VoiceStateManager extends CachedManager {
+ constructor(guild, iterable) {
+ super(guild.client, VoiceState, iterable);
+
+ /**
+ * The guild this manager belongs to
+ * @type {Guild}
+ */
+ this.guild = guild;
+ }
+
+ /**
+ * The cache of this manager
+ * @type {Collection<Snowflake, VoiceState>}
+ * @name VoiceStateManager#cache
+ */
+
+ _add(data, cache = true) {
+ const existing = this.cache.get(data.user_id);
+ if (existing) return existing._patch(data);
+
+ const entry = new this.holds(this.guild, data);
+ if (cache) this.cache.set(data.user_id, entry);
+ return entry;
+ }
+}
+
+module.exports = VoiceStateManager;