You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/src/content/docs/extra/version-log.mdx
+9-2Lines changed: 9 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,11 +9,18 @@ Logs about the changed features.
9
9
10
10
---
11
11
12
+
## **Version 2.9.1**
13
+
14
+
- Introduce a `ManagerOption.playerOptions.allowCustomSources` Option, to allow to use "source" in the search query, which lavalink-client doesn't officially support yet (not in the `DEFAULT_SOURCES` object) This will allow you to make requests to sources, which lavalink-client doesn't support.
15
+
16
+
- Add JSDoc for all ManagerUtils.
17
+
- New ManagerUtils + cleaner source extractions.
18
+
12
19
## **Version 2.9.0**
13
20
14
21
- Removed the autoChecks options on the manager:
15
-
-`ManagerOption.autoChecks.pluginValidations` ... default is true, set to false if you want to skip plugin validations
16
-
-`ManagerOption.autoChecks.sourcesValidations` ... default is true, set to false if you want to skip sources/filters validations
22
+
-~~`ManagerOption.autoChecks.pluginValidations`~~ -> Now configured per node: `NodeOption.autoChecks.pluginValidations`
23
+
-~~`ManagerOption.autoChecks.sourcesValidations`~~ -> Now configured per node: `NodeOption.autoChecks.sourcesValidations`
17
24
18
25
- Added autoChecks options for every single node:
19
26
-`NodeOption.autoChecks.pluginValidations` ... default is true, set to false if you want to skip plugin validations (if nodeType === "NodeLink" then this will always be false)
* Builds a pluginInfo object based on the provided data, extracting relevant information from the data and clientData parameters. This function is used to construct the pluginInfo property for tracks, allowing for consistent handling of plugin-related information across different track sources and formats.
54
+
* @param data
55
+
* @param clientData
56
+
* @returns
57
+
*/
51
58
buildPluginInfo(data: any,clientData: any={}){
52
59
return{
53
60
clientData: clientData,
54
61
...(data.pluginInfo||(dataasany).plugin),
55
62
};
56
63
}
57
64
65
+
/**
66
+
* Builds a Track object from the provided data and requester information. It validates the presence of required properties in the data, transforms the requester using a custom transformer function if provided, and constructs a Track object with the appropriate properties and plugin information. The function also includes error handling to ensure that the input data is valid and provides debug information if track building fails.
thrownewRangeError("Argument 'data.encoded' must be present.");
@@ -176,6 +189,11 @@ export class ManagerUtils {
176
189
returntrue;
177
190
}
178
191
192
+
/**
193
+
* Gets the transformed requester based on the LavalinkManager options. If a custom requester transformer function is provided in the player options, it applies that function to the requester; otherwise, it returns the requester as is. The function also includes error handling to catch any exceptions that may occur during the transformation process and emits a debug event if the transformation fails.
* Gets the closest track by resolving the provided UnresolvedTrack using the getClosestTrack function. It includes error handling to catch any exceptions that may occur during the resolution process and emits a debug event if the resolution fails. The function returns a Promise that resolves to a Track object if successful, or undefined if no closest track is found.
* Validates the query string against various criteria, including checking for empty strings, length limits for specific sources, blacklisted links or words, and ensuring that the Lavalink node has the necessary source managers enabled for the provided query. The function also includes debug event emissions to assist with troubleshooting and understanding the validation process.
* Finds the source of a query string by checking if it starts with a valid source prefix defined in the DefaultSources object. If a valid source prefix is found, it returns the corresponding SearchPlatform; otherwise, it returns null. This function is useful for determining the intended search platform for a given query string, allowing for more accurate search results when the user specifies a source (e.g., "ytsearch:Never Gonna Give You Up" would indicate that the search should be performed on YouTube).
// if query is like youtube:never gonna give you up, then this.findSourceOfQuery will return "youtube" as a valid source, since it's inside DEFAULT_SOURCES. Then it will be assigned as the proper source and removed from the query.
487
+
if(foundSource){
488
+
searchQuery.source=DefaultSources[foundSource];
489
+
searchQuery.query=searchQuery.query.slice(`${foundSource}:`.length,searchQuery.query.length);// remove ytsearch: from the query
490
+
}
491
+
returnsearchQuery;
455
492
}
456
493
494
+
/**
495
+
* Converts a string to lowercase if the input is a string, otherwise returns the input as is. This is useful for ensuring that search platform identifiers are case-insensitive while allowing other types of input to pass through unchanged.
* Transforms a search query by determining the appropriate search platform based on the query string and the default search platform specified in the LavalinkManager options. It checks if the query string starts with a valid source prefix and extracts it if present. The function returns an object containing the modified query string, any extra URL parameters, and the determined search platform to be used for the search operation.
* Transforms a LavaSearchQuery by determining the appropriate search platform based on the query string and the default search platform specified in the LavalinkManager options. It checks if the query string starts with a valid source prefix and extracts it if present. The function returns an object containing the modified query string, any extra URL parameters, the determined search platform to be used for the search operation, and the types of search (track, playlist, artist, album, text) to be performed.
Query.source=DefaultSources[foundSource];// set the source to ytsearch:
483
-
Query.query=Query.query.slice(`${foundSource}:`.length,Query.query.length);// remove ytsearch: from the query
484
-
}
485
-
returnQuery;
558
+
returnthis.extractSourceOfQuery(Query);
486
559
}
487
560
561
+
/**
562
+
* Validates the provided source string against the capabilities of the Lavalink node. It checks if the source string is supported by the node's enabled source managers and plugins, throwing errors if any required sources or plugins are missing for the specified search platform. This ensures that search queries are only executed with compatible sources based on the node's configuration.
if(!source)thrownewError(`Lavalink Node SearchQuerySource: '${sourceString}' is not available`);
570
+
if(!source&&!!this.LavalinkManager.options.playerOptions.allowCustomSources)thrownewError(`Lavalink-Client does not support SearchQuerySource: '${sourceString}'. You can disable this check by setting 'ManagerOptions.PlayerOptions.allowCustomSources' to true`);
492
571
493
572
if(!node.info)thrownewError("Lavalink Node does not have any info cached yet, not ready yet!");
0 commit comments