magmastream 2.9.3-dev.10 → 2.9.3-dev.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/structures/Player.js +18 -7
- package/package.json +1 -1
|
@@ -260,21 +260,32 @@ class Player {
|
|
|
260
260
|
*/
|
|
261
261
|
async destroy(disconnect = true) {
|
|
262
262
|
this.state = Enums_1.StateTypes.Destroying;
|
|
263
|
+
if (this.dynamicLoopInterval) {
|
|
264
|
+
clearInterval(this.dynamicLoopInterval);
|
|
265
|
+
this.dynamicLoopInterval = null;
|
|
266
|
+
}
|
|
267
|
+
if (this.voiceReceiverReconnectTimeout) {
|
|
268
|
+
clearTimeout(this.voiceReceiverReconnectTimeout);
|
|
269
|
+
this.voiceReceiverReconnectTimeout = null;
|
|
270
|
+
}
|
|
271
|
+
if (this.voiceReceiverWsClient) {
|
|
272
|
+
this.voiceReceiverWsClient.removeAllListeners();
|
|
273
|
+
this.voiceReceiverWsClient.close();
|
|
274
|
+
this.voiceReceiverWsClient = null;
|
|
275
|
+
}
|
|
263
276
|
await this.queue.clear();
|
|
264
277
|
await this.queue.clearPrevious();
|
|
265
278
|
await this.queue.setCurrent(null);
|
|
266
279
|
if (disconnect) {
|
|
267
|
-
await this.disconnect().catch((
|
|
268
|
-
console.warn(`[Player#destroy] Failed to disconnect player ${this.guildId}:`, err);
|
|
269
|
-
});
|
|
280
|
+
await this.disconnect().catch(() => { });
|
|
270
281
|
}
|
|
271
|
-
await this.node.rest.destroyPlayer(this.guildId).catch((
|
|
272
|
-
|
|
273
|
-
});
|
|
282
|
+
await this.node.rest.destroyPlayer(this.guildId).catch(() => { });
|
|
283
|
+
this.nowPlayingMessage = undefined;
|
|
274
284
|
this.manager.emit(Enums_1.ManagerEventTypes.PlayerDestroy, this);
|
|
275
285
|
const deleted = this.manager.players.delete(this.guildId);
|
|
276
|
-
if (this.manager.options.stateStorage.deleteInactivePlayers)
|
|
286
|
+
if (this.manager.options.stateStorage.deleteInactivePlayers) {
|
|
277
287
|
await this.manager.cleanupInactivePlayer(this.guildId);
|
|
288
|
+
}
|
|
278
289
|
return deleted;
|
|
279
290
|
}
|
|
280
291
|
/**
|