magmastream 2.9.3-dev.16 → 2.9.3-dev.17
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/index.d.ts +4 -2
- package/dist/structures/Filters.js +5 -4
- package/dist/structures/Manager.js +38 -19
- package/dist/structures/Player.js +3 -2
- package/package.json +17 -14
package/dist/index.d.ts
CHANGED
|
@@ -1497,6 +1497,7 @@ interface VoiceState {
|
|
|
1497
1497
|
guildId: string;
|
|
1498
1498
|
event: VoiceServer;
|
|
1499
1499
|
sessionId?: string;
|
|
1500
|
+
channelId?: string;
|
|
1500
1501
|
}
|
|
1501
1502
|
/**
|
|
1502
1503
|
* Voice State
|
|
@@ -1920,6 +1921,7 @@ interface RestPlayOptions {
|
|
|
1920
1921
|
token: string;
|
|
1921
1922
|
sessionId: string;
|
|
1922
1923
|
endpoint: string;
|
|
1924
|
+
channelId: string;
|
|
1923
1925
|
};
|
|
1924
1926
|
/** Whether to not replace the track if a play payload is sent. */
|
|
1925
1927
|
noReplace?: boolean;
|
|
@@ -3138,8 +3140,6 @@ declare class Filters {
|
|
|
3138
3140
|
distortion: DistortionOptions | null;
|
|
3139
3141
|
equalizer: Band[];
|
|
3140
3142
|
karaoke: KaraokeOptions | null;
|
|
3141
|
-
manager: Manager;
|
|
3142
|
-
player: Player;
|
|
3143
3143
|
rotation: RotationOptions | null;
|
|
3144
3144
|
timescale: TimescaleOptions | null;
|
|
3145
3145
|
vibrato: VibratoOptions | null;
|
|
@@ -3147,6 +3147,8 @@ declare class Filters {
|
|
|
3147
3147
|
volume: number;
|
|
3148
3148
|
bassBoostlevel: number;
|
|
3149
3149
|
filtersStatus: Record<AvailableFilters, boolean>;
|
|
3150
|
+
manager: Manager;
|
|
3151
|
+
player: Player;
|
|
3150
3152
|
constructor(player: Player, manager: Manager);
|
|
3151
3153
|
/**
|
|
3152
3154
|
* Updates the player's audio filters.
|
|
@@ -8,8 +8,6 @@ class Filters {
|
|
|
8
8
|
distortion;
|
|
9
9
|
equalizer;
|
|
10
10
|
karaoke;
|
|
11
|
-
manager;
|
|
12
|
-
player;
|
|
13
11
|
rotation;
|
|
14
12
|
timescale;
|
|
15
13
|
vibrato;
|
|
@@ -17,15 +15,16 @@ class Filters {
|
|
|
17
15
|
volume;
|
|
18
16
|
bassBoostlevel;
|
|
19
17
|
filtersStatus;
|
|
18
|
+
manager;
|
|
19
|
+
player;
|
|
20
20
|
constructor(player, manager) {
|
|
21
21
|
this.distortion = null;
|
|
22
22
|
this.equalizer = [];
|
|
23
23
|
this.karaoke = null;
|
|
24
|
-
this.manager = manager;
|
|
25
|
-
this.player = player;
|
|
26
24
|
this.rotation = null;
|
|
27
25
|
this.timescale = null;
|
|
28
26
|
this.vibrato = null;
|
|
27
|
+
this.reverb = null;
|
|
29
28
|
this.volume = 1.0;
|
|
30
29
|
this.bassBoostlevel = 0;
|
|
31
30
|
// Initialize filter status
|
|
@@ -33,6 +32,8 @@ class Filters {
|
|
|
33
32
|
acc[filter] = false;
|
|
34
33
|
return acc;
|
|
35
34
|
}, {});
|
|
35
|
+
this.manager = manager;
|
|
36
|
+
this.player = player;
|
|
36
37
|
}
|
|
37
38
|
/**
|
|
38
39
|
* Updates the player's audio filters.
|
|
@@ -563,6 +563,7 @@ class Manager extends events_1.EventEmitter {
|
|
|
563
563
|
token: state.voiceState.event.token,
|
|
564
564
|
endpoint: state.voiceState.event.endpoint,
|
|
565
565
|
sessionId: state.voiceState.sessionId,
|
|
566
|
+
channelId: state.voiceState.event.channel_id,
|
|
566
567
|
},
|
|
567
568
|
},
|
|
568
569
|
});
|
|
@@ -758,7 +759,14 @@ class Manager extends events_1.EventEmitter {
|
|
|
758
759
|
const player = this.create(playerOptions);
|
|
759
760
|
await player.node.rest.updatePlayer({
|
|
760
761
|
guildId: state.options.guildId,
|
|
761
|
-
data: {
|
|
762
|
+
data: {
|
|
763
|
+
voice: {
|
|
764
|
+
token: state.voiceState.event.token,
|
|
765
|
+
endpoint: state.voiceState.event.endpoint,
|
|
766
|
+
sessionId: state.voiceState.sessionId,
|
|
767
|
+
channelId: state.voiceState.event.channel_id,
|
|
768
|
+
},
|
|
769
|
+
},
|
|
762
770
|
});
|
|
763
771
|
player.connect();
|
|
764
772
|
// Rest of the player state restoration code (tracks, filters, etc.)
|
|
@@ -1080,13 +1088,17 @@ class Manager extends events_1.EventEmitter {
|
|
|
1080
1088
|
*/
|
|
1081
1089
|
async handleVoiceServerUpdate(player, update) {
|
|
1082
1090
|
player.voiceState.event = update;
|
|
1083
|
-
const
|
|
1091
|
+
const sessionId = player.voiceState.sessionId;
|
|
1092
|
+
const channelId = player.voiceState.channelId;
|
|
1093
|
+
const token = update.token;
|
|
1094
|
+
const endpoint = update.endpoint;
|
|
1095
|
+
this.emit(Enums_1.ManagerEventTypes.Debug, `Updated voice server for player ${player.guildId} with token ${token} | endpoint ${endpoint} | sessionId ${sessionId} | channelId ${channelId}`);
|
|
1096
|
+
if (!sessionId || !channelId)
|
|
1097
|
+
return;
|
|
1084
1098
|
await player.node.rest.updatePlayer({
|
|
1085
1099
|
guildId: player.guildId,
|
|
1086
|
-
data: { voice: { token, endpoint, sessionId } },
|
|
1100
|
+
data: { voice: { token, endpoint, sessionId, channelId } },
|
|
1087
1101
|
});
|
|
1088
|
-
this.emit(Enums_1.ManagerEventTypes.Debug, `Updated voice server for player ${player.guildId} with token ${token} and endpoint ${endpoint} and sessionId ${sessionId}`);
|
|
1089
|
-
return;
|
|
1090
1102
|
}
|
|
1091
1103
|
/**
|
|
1092
1104
|
* Handles a voice state update by updating the player's voice channel and session ID if provided, or by disconnecting and destroying the player if the channel ID is null.
|
|
@@ -1097,23 +1109,30 @@ class Manager extends events_1.EventEmitter {
|
|
|
1097
1109
|
*/
|
|
1098
1110
|
async handleVoiceStateUpdate(player, update) {
|
|
1099
1111
|
this.emit(Enums_1.ManagerEventTypes.Debug, `Updated voice state for player ${player.guildId} with channel id ${update.channel_id} and session id ${update.session_id}`);
|
|
1100
|
-
if (update.channel_id) {
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
player.voiceState
|
|
1105
|
-
player.
|
|
1106
|
-
|
|
1112
|
+
if (!update.channel_id) {
|
|
1113
|
+
this.emit(Enums_1.ManagerEventTypes.PlayerDisconnect, player, player.voiceChannelId);
|
|
1114
|
+
player.voiceChannelId = null;
|
|
1115
|
+
player.state = Enums_1.StateTypes.Disconnected;
|
|
1116
|
+
player.voiceState = Object.assign({});
|
|
1117
|
+
if (player.options.pauseOnDisconnect)
|
|
1118
|
+
await player.pause(true);
|
|
1107
1119
|
return;
|
|
1108
1120
|
}
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
player.state = Enums_1.StateTypes.Disconnected;
|
|
1112
|
-
player.voiceState = Object.assign({});
|
|
1113
|
-
if (player.options.pauseOnDisconnect) {
|
|
1114
|
-
await player.pause(true);
|
|
1121
|
+
if (player.voiceChannelId !== update.channel_id) {
|
|
1122
|
+
this.emit(Enums_1.ManagerEventTypes.PlayerMove, player, player.voiceChannelId, update.channel_id);
|
|
1115
1123
|
}
|
|
1116
|
-
|
|
1124
|
+
player.voiceState.sessionId = update.session_id;
|
|
1125
|
+
player.voiceState.channelId = update.channel_id;
|
|
1126
|
+
player.voiceChannelId = update.channel_id;
|
|
1127
|
+
player.options.voiceChannelId = update.channel_id;
|
|
1128
|
+
const token = player.voiceState.event?.token;
|
|
1129
|
+
const endpoint = player.voiceState.event?.endpoint;
|
|
1130
|
+
if (!token || !endpoint)
|
|
1131
|
+
return;
|
|
1132
|
+
await player.node.rest.updatePlayer({
|
|
1133
|
+
guildId: player.guildId,
|
|
1134
|
+
data: { voice: { token, endpoint, sessionId: update.session_id, channelId: update.channel_id } },
|
|
1135
|
+
});
|
|
1117
1136
|
}
|
|
1118
1137
|
/**
|
|
1119
1138
|
* Cleans up inactive players by removing their state files from the file system.
|
|
@@ -928,7 +928,8 @@ class Player {
|
|
|
928
928
|
const sessionId = this.voiceState?.sessionId;
|
|
929
929
|
const token = this.voiceState?.event?.token;
|
|
930
930
|
const endpoint = this.voiceState?.event?.endpoint;
|
|
931
|
-
|
|
931
|
+
const channelId = this.voiceState?.channelId;
|
|
932
|
+
if (!sessionId || !token || !endpoint || !channelId) {
|
|
932
933
|
this.manager.emit(Enums_1.ManagerEventTypes.Debug, `[MANAGER] Voice state is not properly initialized for player ${this.guildId}. The bot might not be connected to a voice channel.`);
|
|
933
934
|
throw new MagmastreamError_1.MagmaStreamError({
|
|
934
935
|
code: Enums_1.MagmaStreamErrorCode.PLAYER_STATE_INVALID,
|
|
@@ -942,7 +943,7 @@ class Player {
|
|
|
942
943
|
this.manager.players.set(this.guildId, this);
|
|
943
944
|
await this.node.rest.updatePlayer({
|
|
944
945
|
guildId: this.guildId,
|
|
945
|
-
data: { paused: this.paused, volume: this.volume, position: playerPosition, encodedTrack: currentTrack?.track, voice: { token, endpoint, sessionId } },
|
|
946
|
+
data: { paused: this.paused, volume: this.volume, position: playerPosition, encodedTrack: currentTrack?.track, voice: { token, endpoint, sessionId, channelId } },
|
|
946
947
|
});
|
|
947
948
|
await this.filters.updateFilters();
|
|
948
949
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "magmastream",
|
|
3
|
-
"version": "2.9.3-dev.
|
|
3
|
+
"version": "2.9.3-dev.17",
|
|
4
4
|
"description": "A user-friendly Lavalink client designed for NodeJS.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -20,35 +20,38 @@
|
|
|
20
20
|
"devDependencies": {
|
|
21
21
|
"@favware/rollup-type-bundler": "^4.0.0",
|
|
22
22
|
"@types/jsdom": "^27.0.0",
|
|
23
|
-
"@types/lodash": "^4.17.
|
|
24
|
-
"@types/node": "^25.0
|
|
23
|
+
"@types/lodash": "^4.17.24",
|
|
24
|
+
"@types/node": "^25.3.0",
|
|
25
25
|
"@types/ws": "^8.18.1",
|
|
26
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
27
|
-
"@typescript-eslint/parser": "^8.
|
|
28
|
-
"eslint": "^
|
|
26
|
+
"@typescript-eslint/eslint-plugin": "^8.56.0",
|
|
27
|
+
"@typescript-eslint/parser": "^8.56.0",
|
|
28
|
+
"eslint": "^10.0.1",
|
|
29
29
|
"npm-run-all": "^4.1.5",
|
|
30
|
-
"prettier": "^3.8.
|
|
31
|
-
"typedoc": "^0.28.
|
|
30
|
+
"prettier": "^3.8.1",
|
|
31
|
+
"typedoc": "^0.28.17",
|
|
32
32
|
"typedoc-plugin-no-inherit": "^1.6.1",
|
|
33
33
|
"typescript": "^5.9.3"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@discordjs/collection": "^2.1.1",
|
|
37
|
-
"axios": "^1.13.
|
|
37
|
+
"axios": "^1.13.5",
|
|
38
38
|
"events": "^3.3.0",
|
|
39
|
-
"ioredis": "^5.9.
|
|
40
|
-
"jsdom": "^
|
|
41
|
-
"lodash": "^4.17.
|
|
39
|
+
"ioredis": "^5.9.3",
|
|
40
|
+
"jsdom": "^28.1.0",
|
|
41
|
+
"lodash": "^4.17.23",
|
|
42
42
|
"safe-stable-stringify": "^2.5.0",
|
|
43
43
|
"tslib": "^2.8.1",
|
|
44
44
|
"ws": "^8.19.0"
|
|
45
45
|
},
|
|
46
46
|
"optionalDependencies": {
|
|
47
|
-
"discordeno": "21.x",
|
|
48
47
|
"discord.js": "14.x",
|
|
48
|
+
"discordeno": "21.x",
|
|
49
49
|
"eris": "0.18.x",
|
|
50
50
|
"oceanic.js": "^1.13.0",
|
|
51
|
-
"seyfert": "4.
|
|
51
|
+
"seyfert": "4.x"
|
|
52
|
+
},
|
|
53
|
+
"overrides": {
|
|
54
|
+
"undici": "^6.23.0"
|
|
52
55
|
},
|
|
53
56
|
"engines": {
|
|
54
57
|
"node": ">=20.19.0"
|