Star ✨ on GitHub

LavaSearchPlugin

API reference for the LavaSearchPlugin in Moonlink.js

LavaSearchPlugin Class

The LavaSearchPlugin integrates with the LavaSearch Lavalink plugin to provide advanced search capabilities. It allows searching for various content types like tracks, albums, artists, playlists, and text.

Properties

PropertyTypeDescription
namestringThe name of the plugin: lavasearch-plugin.
capabilitiesstring[]Declares lavasearch capability.
nodeNodeThe associated Node instance.

Methods

load

loadmethod

Load Plugin

Initializes the plugin for a given node.

Parameters
noderequiredNode
The node instance.

Returns & Example

Returnsvoid

// Called internally by PluginManager

::

unload

unloadmethod

Unload Plugin

Cleans up plugin resources.

Parameters
noderequiredNode
The node instance.

Returns & Example

Returnsvoid

// Called internally by PluginManager

searchmethod

Perform LavaSearch

Performs a search using the LavaSearch API, supporting various content types.

Parameters
queryrequiredstring
The search query.
optionsObject
Search options.
options.sourcestring
Optional: The source to search within (e.g., youtube, spotify).
options.typesstring
Optional: Comma-separated string of result types to return (e.g., track,album,artist). Defaults to track,album,artist,playlist,text.

Returns & Example

ReturnsPromise<ILavaSearchResultData> — The search results data.

const results = await plugin.search('Never Gonna Give You Up', { types: 'track,artist' });
console.log(results.tracks);
console.log(results.artists);