streamify-audio 2.1.7 → 2.1.8
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/package.json +2 -2
- package/src/discord/Manager.js +4 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "streamify-audio",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.8",
|
|
4
4
|
"description": "Dual-mode audio library: HTTP streaming proxy + Discord player (Lavalink alternative). Supports YouTube, Spotify, SoundCloud with audio filters.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"license": "MIT",
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"express": "^4.18.2",
|
|
33
|
-
"streamify-audio": "^2.1.
|
|
33
|
+
"streamify-audio": "^2.1.6"
|
|
34
34
|
},
|
|
35
35
|
"optionalDependencies": {
|
|
36
36
|
"@discordjs/opus": "^0.9.0",
|
package/src/discord/Manager.js
CHANGED
|
@@ -82,6 +82,7 @@ class Manager extends EventEmitter {
|
|
|
82
82
|
this.persistence = null;
|
|
83
83
|
this._persistenceInterval = null;
|
|
84
84
|
this._persistenceIntervalMs = options.persistence?.interval || 30000;
|
|
85
|
+
this._restoringGuilds = new Set();
|
|
85
86
|
|
|
86
87
|
this._setupVoiceStateListener();
|
|
87
88
|
|
|
@@ -124,6 +125,7 @@ class Manager extends EventEmitter {
|
|
|
124
125
|
|
|
125
126
|
async saveSession(guildId) {
|
|
126
127
|
if (!this.persistence) return false;
|
|
128
|
+
if (this._restoringGuilds.has(guildId)) return false;
|
|
127
129
|
|
|
128
130
|
const player = this.players.get(guildId);
|
|
129
131
|
if (!player || !player.connected) return false;
|
|
@@ -171,6 +173,7 @@ class Manager extends EventEmitter {
|
|
|
171
173
|
}
|
|
172
174
|
|
|
173
175
|
log.info('MANAGER', `Restoring session for guild ${guildId}`);
|
|
176
|
+
this._restoringGuilds.add(guildId);
|
|
174
177
|
|
|
175
178
|
const player = await this.create(guildId, session.voiceChannelId, session.textChannelId);
|
|
176
179
|
|
|
@@ -219,6 +222,7 @@ class Manager extends EventEmitter {
|
|
|
219
222
|
}
|
|
220
223
|
|
|
221
224
|
log.info('MANAGER', `[RESTORE] Emitting sessionRestored event`);
|
|
225
|
+
this._restoringGuilds.delete(guildId);
|
|
222
226
|
this.emit('sessionRestored', { guildId, voiceChannelId: player.voiceChannelId });
|
|
223
227
|
log.info('MANAGER', `[RESTORE] Returning true`);
|
|
224
228
|
return true;
|