lavalink-client 2.9.9 → 2.9.10
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.cjs +33 -3
- package/dist/index.d.cts +24 -0
- package/dist/index.d.ts +24 -0
- package/dist/index.js +33 -3
- package/dist/index.mjs +33 -3
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -3138,6 +3138,36 @@ var NodeLinkNode = class extends LavalinkNode {
|
|
|
3138
3138
|
}
|
|
3139
3139
|
this.nodeType = "NodeLink";
|
|
3140
3140
|
}
|
|
3141
|
+
/**
|
|
3142
|
+
* Uses the gapless feature to set the next track to be played.
|
|
3143
|
+
* @param player current player
|
|
3144
|
+
* @param track if no track provided, it will use the next track from queue
|
|
3145
|
+
*/
|
|
3146
|
+
async setNextTrackGapLess(player, track) {
|
|
3147
|
+
if (!this.sessionId) throw new Error("The Lavalink Node is either not ready, or not up to date!");
|
|
3148
|
+
const nextTrack = track || player.queue.tracks[0];
|
|
3149
|
+
if (!nextTrack) throw new Error("No track provided");
|
|
3150
|
+
await this.updatePlayer({
|
|
3151
|
+
guildId: player.guildId,
|
|
3152
|
+
// @ts-expect-error - nextTrack is not a valid property of LavalinkPlayOptions but for NodeLink it is
|
|
3153
|
+
playerOptions: { nextTrack: { encoded: nextTrack.encoded, userData: nextTrack.userData || {} } }
|
|
3154
|
+
});
|
|
3155
|
+
return true;
|
|
3156
|
+
}
|
|
3157
|
+
/**
|
|
3158
|
+
* Retrieves the meaning of a track.
|
|
3159
|
+
* @param track
|
|
3160
|
+
* @returns {MeaningResponse}
|
|
3161
|
+
* @link {https://nodelink.js.org/docs/api/nodelink-features#meaning-system}
|
|
3162
|
+
*/
|
|
3163
|
+
async getMeaning(track) {
|
|
3164
|
+
if (!this.sessionId) throw new Error("The Lavalink Node is either not ready, or not up to date!");
|
|
3165
|
+
const encodedTrack = track?.encoded;
|
|
3166
|
+
if (!encodedTrack) throw new Error("No track provided");
|
|
3167
|
+
return await this.request(`/meaning?encodedTrack=${encodedTrack}`, (m) => {
|
|
3168
|
+
m.method = "GET";
|
|
3169
|
+
});
|
|
3170
|
+
}
|
|
3141
3171
|
/**
|
|
3142
3172
|
* Adds a new audio track to be mixed over the current playback.
|
|
3143
3173
|
* @param player The player to add the mixer layer to.
|
|
@@ -3155,7 +3185,7 @@ var NodeLinkNode = class extends LavalinkNode {
|
|
|
3155
3185
|
//identifier: trackToAdd.info?.identifier, // atm not supported
|
|
3156
3186
|
userData: trackToAdd.userData
|
|
3157
3187
|
},
|
|
3158
|
-
volume:
|
|
3188
|
+
volume: volume / 100
|
|
3159
3189
|
});
|
|
3160
3190
|
});
|
|
3161
3191
|
}
|
|
@@ -3182,7 +3212,7 @@ var NodeLinkNode = class extends LavalinkNode {
|
|
|
3182
3212
|
await this.request(`/sessions/${this.sessionId}/players/${player.guildId}/mix/${mixId}`, (m) => {
|
|
3183
3213
|
m.method = "PATCH";
|
|
3184
3214
|
m.body = safeStringify({
|
|
3185
|
-
volume:
|
|
3215
|
+
volume: volume / 100
|
|
3186
3216
|
});
|
|
3187
3217
|
});
|
|
3188
3218
|
return true;
|
|
@@ -3354,7 +3384,7 @@ var NodeLinkNode = class extends LavalinkNode {
|
|
|
3354
3384
|
*/
|
|
3355
3385
|
async loadDirectStream(track, volume, position, filters) {
|
|
3356
3386
|
let requestPath = `/loadstream?encodedTrack=${track.encoded}`;
|
|
3357
|
-
if (volume && volume > 0 && volume <= 100) requestPath += `&volume=${
|
|
3387
|
+
if (volume && volume > 0 && volume <= 100) requestPath += `&volume=${volume / 100}`;
|
|
3358
3388
|
if (position && position > 0) requestPath += `&position=${position}`;
|
|
3359
3389
|
if (filters) requestPath += `&filters=${typeof filters === "object" ? safeStringify(filters) : filters}`;
|
|
3360
3390
|
const res = await this.rawRequest(requestPath, (m) => {
|
package/dist/index.d.cts
CHANGED
|
@@ -1514,6 +1514,17 @@ type YoutubeOAuthResponse = {
|
|
|
1514
1514
|
scope: string;
|
|
1515
1515
|
token_type: string;
|
|
1516
1516
|
};
|
|
1517
|
+
type MeaningResponse = {
|
|
1518
|
+
loadType: "meaning";
|
|
1519
|
+
data: {
|
|
1520
|
+
title: string;
|
|
1521
|
+
description: string;
|
|
1522
|
+
paragraphs: string[];
|
|
1523
|
+
url: string;
|
|
1524
|
+
provider: string;
|
|
1525
|
+
type: string;
|
|
1526
|
+
};
|
|
1527
|
+
};
|
|
1517
1528
|
|
|
1518
1529
|
/** Ability to manipulate fetch requests */
|
|
1519
1530
|
type ModifyRequest = (options: RequestInit & {
|
|
@@ -2882,6 +2893,19 @@ declare class Player {
|
|
|
2882
2893
|
declare class NodeLinkNode extends LavalinkNode {
|
|
2883
2894
|
nodeType: "NodeLink";
|
|
2884
2895
|
constructor(options: LavalinkNodeOptions, manager: NodeManager);
|
|
2896
|
+
/**
|
|
2897
|
+
* Uses the gapless feature to set the next track to be played.
|
|
2898
|
+
* @param player current player
|
|
2899
|
+
* @param track if no track provided, it will use the next track from queue
|
|
2900
|
+
*/
|
|
2901
|
+
setNextTrackGapLess(player: Player, track?: Track | UnresolvedTrack): Promise<boolean>;
|
|
2902
|
+
/**
|
|
2903
|
+
* Retrieves the meaning of a track.
|
|
2904
|
+
* @param track
|
|
2905
|
+
* @returns {MeaningResponse}
|
|
2906
|
+
* @link {https://nodelink.js.org/docs/api/nodelink-features#meaning-system}
|
|
2907
|
+
*/
|
|
2908
|
+
getMeaning(track?: Track | UnresolvedTrack): Promise<MeaningResponse>;
|
|
2885
2909
|
/**
|
|
2886
2910
|
* Adds a new audio track to be mixed over the current playback.
|
|
2887
2911
|
* @param player The player to add the mixer layer to.
|
package/dist/index.d.ts
CHANGED
|
@@ -1514,6 +1514,17 @@ type YoutubeOAuthResponse = {
|
|
|
1514
1514
|
scope: string;
|
|
1515
1515
|
token_type: string;
|
|
1516
1516
|
};
|
|
1517
|
+
type MeaningResponse = {
|
|
1518
|
+
loadType: "meaning";
|
|
1519
|
+
data: {
|
|
1520
|
+
title: string;
|
|
1521
|
+
description: string;
|
|
1522
|
+
paragraphs: string[];
|
|
1523
|
+
url: string;
|
|
1524
|
+
provider: string;
|
|
1525
|
+
type: string;
|
|
1526
|
+
};
|
|
1527
|
+
};
|
|
1517
1528
|
|
|
1518
1529
|
/** Ability to manipulate fetch requests */
|
|
1519
1530
|
type ModifyRequest = (options: RequestInit & {
|
|
@@ -2882,6 +2893,19 @@ declare class Player {
|
|
|
2882
2893
|
declare class NodeLinkNode extends LavalinkNode {
|
|
2883
2894
|
nodeType: "NodeLink";
|
|
2884
2895
|
constructor(options: LavalinkNodeOptions, manager: NodeManager);
|
|
2896
|
+
/**
|
|
2897
|
+
* Uses the gapless feature to set the next track to be played.
|
|
2898
|
+
* @param player current player
|
|
2899
|
+
* @param track if no track provided, it will use the next track from queue
|
|
2900
|
+
*/
|
|
2901
|
+
setNextTrackGapLess(player: Player, track?: Track | UnresolvedTrack): Promise<boolean>;
|
|
2902
|
+
/**
|
|
2903
|
+
* Retrieves the meaning of a track.
|
|
2904
|
+
* @param track
|
|
2905
|
+
* @returns {MeaningResponse}
|
|
2906
|
+
* @link {https://nodelink.js.org/docs/api/nodelink-features#meaning-system}
|
|
2907
|
+
*/
|
|
2908
|
+
getMeaning(track?: Track | UnresolvedTrack): Promise<MeaningResponse>;
|
|
2885
2909
|
/**
|
|
2886
2910
|
* Adds a new audio track to be mixed over the current playback.
|
|
2887
2911
|
* @param player The player to add the mixer layer to.
|
package/dist/index.js
CHANGED
|
@@ -3074,6 +3074,36 @@ var NodeLinkNode = class extends LavalinkNode {
|
|
|
3074
3074
|
}
|
|
3075
3075
|
this.nodeType = "NodeLink";
|
|
3076
3076
|
}
|
|
3077
|
+
/**
|
|
3078
|
+
* Uses the gapless feature to set the next track to be played.
|
|
3079
|
+
* @param player current player
|
|
3080
|
+
* @param track if no track provided, it will use the next track from queue
|
|
3081
|
+
*/
|
|
3082
|
+
async setNextTrackGapLess(player, track) {
|
|
3083
|
+
if (!this.sessionId) throw new Error("The Lavalink Node is either not ready, or not up to date!");
|
|
3084
|
+
const nextTrack = track || player.queue.tracks[0];
|
|
3085
|
+
if (!nextTrack) throw new Error("No track provided");
|
|
3086
|
+
await this.updatePlayer({
|
|
3087
|
+
guildId: player.guildId,
|
|
3088
|
+
// @ts-expect-error - nextTrack is not a valid property of LavalinkPlayOptions but for NodeLink it is
|
|
3089
|
+
playerOptions: { nextTrack: { encoded: nextTrack.encoded, userData: nextTrack.userData || {} } }
|
|
3090
|
+
});
|
|
3091
|
+
return true;
|
|
3092
|
+
}
|
|
3093
|
+
/**
|
|
3094
|
+
* Retrieves the meaning of a track.
|
|
3095
|
+
* @param track
|
|
3096
|
+
* @returns {MeaningResponse}
|
|
3097
|
+
* @link {https://nodelink.js.org/docs/api/nodelink-features#meaning-system}
|
|
3098
|
+
*/
|
|
3099
|
+
async getMeaning(track) {
|
|
3100
|
+
if (!this.sessionId) throw new Error("The Lavalink Node is either not ready, or not up to date!");
|
|
3101
|
+
const encodedTrack = track?.encoded;
|
|
3102
|
+
if (!encodedTrack) throw new Error("No track provided");
|
|
3103
|
+
return await this.request(`/meaning?encodedTrack=${encodedTrack}`, (m) => {
|
|
3104
|
+
m.method = "GET";
|
|
3105
|
+
});
|
|
3106
|
+
}
|
|
3077
3107
|
/**
|
|
3078
3108
|
* Adds a new audio track to be mixed over the current playback.
|
|
3079
3109
|
* @param player The player to add the mixer layer to.
|
|
@@ -3091,7 +3121,7 @@ var NodeLinkNode = class extends LavalinkNode {
|
|
|
3091
3121
|
//identifier: trackToAdd.info?.identifier, // atm not supported
|
|
3092
3122
|
userData: trackToAdd.userData
|
|
3093
3123
|
},
|
|
3094
|
-
volume:
|
|
3124
|
+
volume: volume / 100
|
|
3095
3125
|
});
|
|
3096
3126
|
});
|
|
3097
3127
|
}
|
|
@@ -3118,7 +3148,7 @@ var NodeLinkNode = class extends LavalinkNode {
|
|
|
3118
3148
|
await this.request(`/sessions/${this.sessionId}/players/${player.guildId}/mix/${mixId}`, (m) => {
|
|
3119
3149
|
m.method = "PATCH";
|
|
3120
3150
|
m.body = safeStringify({
|
|
3121
|
-
volume:
|
|
3151
|
+
volume: volume / 100
|
|
3122
3152
|
});
|
|
3123
3153
|
});
|
|
3124
3154
|
return true;
|
|
@@ -3290,7 +3320,7 @@ var NodeLinkNode = class extends LavalinkNode {
|
|
|
3290
3320
|
*/
|
|
3291
3321
|
async loadDirectStream(track, volume, position, filters) {
|
|
3292
3322
|
let requestPath = `/loadstream?encodedTrack=${track.encoded}`;
|
|
3293
|
-
if (volume && volume > 0 && volume <= 100) requestPath += `&volume=${
|
|
3323
|
+
if (volume && volume > 0 && volume <= 100) requestPath += `&volume=${volume / 100}`;
|
|
3294
3324
|
if (position && position > 0) requestPath += `&position=${position}`;
|
|
3295
3325
|
if (filters) requestPath += `&filters=${typeof filters === "object" ? safeStringify(filters) : filters}`;
|
|
3296
3326
|
const res = await this.rawRequest(requestPath, (m) => {
|
package/dist/index.mjs
CHANGED
|
@@ -3074,6 +3074,36 @@ var NodeLinkNode = class extends LavalinkNode {
|
|
|
3074
3074
|
}
|
|
3075
3075
|
this.nodeType = "NodeLink";
|
|
3076
3076
|
}
|
|
3077
|
+
/**
|
|
3078
|
+
* Uses the gapless feature to set the next track to be played.
|
|
3079
|
+
* @param player current player
|
|
3080
|
+
* @param track if no track provided, it will use the next track from queue
|
|
3081
|
+
*/
|
|
3082
|
+
async setNextTrackGapLess(player, track) {
|
|
3083
|
+
if (!this.sessionId) throw new Error("The Lavalink Node is either not ready, or not up to date!");
|
|
3084
|
+
const nextTrack = track || player.queue.tracks[0];
|
|
3085
|
+
if (!nextTrack) throw new Error("No track provided");
|
|
3086
|
+
await this.updatePlayer({
|
|
3087
|
+
guildId: player.guildId,
|
|
3088
|
+
// @ts-expect-error - nextTrack is not a valid property of LavalinkPlayOptions but for NodeLink it is
|
|
3089
|
+
playerOptions: { nextTrack: { encoded: nextTrack.encoded, userData: nextTrack.userData || {} } }
|
|
3090
|
+
});
|
|
3091
|
+
return true;
|
|
3092
|
+
}
|
|
3093
|
+
/**
|
|
3094
|
+
* Retrieves the meaning of a track.
|
|
3095
|
+
* @param track
|
|
3096
|
+
* @returns {MeaningResponse}
|
|
3097
|
+
* @link {https://nodelink.js.org/docs/api/nodelink-features#meaning-system}
|
|
3098
|
+
*/
|
|
3099
|
+
async getMeaning(track) {
|
|
3100
|
+
if (!this.sessionId) throw new Error("The Lavalink Node is either not ready, or not up to date!");
|
|
3101
|
+
const encodedTrack = track?.encoded;
|
|
3102
|
+
if (!encodedTrack) throw new Error("No track provided");
|
|
3103
|
+
return await this.request(`/meaning?encodedTrack=${encodedTrack}`, (m) => {
|
|
3104
|
+
m.method = "GET";
|
|
3105
|
+
});
|
|
3106
|
+
}
|
|
3077
3107
|
/**
|
|
3078
3108
|
* Adds a new audio track to be mixed over the current playback.
|
|
3079
3109
|
* @param player The player to add the mixer layer to.
|
|
@@ -3091,7 +3121,7 @@ var NodeLinkNode = class extends LavalinkNode {
|
|
|
3091
3121
|
//identifier: trackToAdd.info?.identifier, // atm not supported
|
|
3092
3122
|
userData: trackToAdd.userData
|
|
3093
3123
|
},
|
|
3094
|
-
volume:
|
|
3124
|
+
volume: volume / 100
|
|
3095
3125
|
});
|
|
3096
3126
|
});
|
|
3097
3127
|
}
|
|
@@ -3118,7 +3148,7 @@ var NodeLinkNode = class extends LavalinkNode {
|
|
|
3118
3148
|
await this.request(`/sessions/${this.sessionId}/players/${player.guildId}/mix/${mixId}`, (m) => {
|
|
3119
3149
|
m.method = "PATCH";
|
|
3120
3150
|
m.body = safeStringify({
|
|
3121
|
-
volume:
|
|
3151
|
+
volume: volume / 100
|
|
3122
3152
|
});
|
|
3123
3153
|
});
|
|
3124
3154
|
return true;
|
|
@@ -3290,7 +3320,7 @@ var NodeLinkNode = class extends LavalinkNode {
|
|
|
3290
3320
|
*/
|
|
3291
3321
|
async loadDirectStream(track, volume, position, filters) {
|
|
3292
3322
|
let requestPath = `/loadstream?encodedTrack=${track.encoded}`;
|
|
3293
|
-
if (volume && volume > 0 && volume <= 100) requestPath += `&volume=${
|
|
3323
|
+
if (volume && volume > 0 && volume <= 100) requestPath += `&volume=${volume / 100}`;
|
|
3294
3324
|
if (position && position > 0) requestPath += `&position=${position}`;
|
|
3295
3325
|
if (filters) requestPath += `&filters=${typeof filters === "object" ? safeStringify(filters) : filters}`;
|
|
3296
3326
|
const res = await this.rawRequest(requestPath, (m) => {
|
package/package.json
CHANGED