Skip to content

Lavalink plugins

Raya has built-in support for popular Lavalink plugins, and raw access for everything else.

// Lyrics for the current track (null when none were found)
const lyrics = await player.getLyrics();
console.log(lyrics?.text ?? lyrics?.lines.map((l) => l.line).join('\n'));
// Live, time-synced lines while the track plays
await player.subscribeLyrics();
raya.on('lyricsLine', (player, line, index, skipped) => {
console.log(`[${line.timestamp}ms] ${line.line}`);
});
raya.on('lyricsNotFound', (player) => {});
await player.unsubscribeLyrics();
// Lyrics for any encoded track
await raya.bestNode().rest.getLyrics(track.encoded);

Raya fetches each node’s /v4/info when it connects:

const node = raya.getNode('main');
node.hasPlugin('lavasrc-plugin');
node.hasSource('spotify');
node.hasFilter('timescale');
node.info?.version.semver;

Known plugin events have their own names (above). Every non-core event is also emitted as pluginEvent:

raya.on('pluginEvent', (player, event) => {
if (event.type === 'MyPluginEvent') console.log(event);
});

node.rest.request sends authenticated requests to any endpoint, with timeouts, safe retries for GET, and RestError on failure:

const data = await node.rest.request('GET', '/v4/my-plugin/status');
await node.rest.request('POST', '/v4/my-plugin/thing', { body: { enabled: true } });
await player.filters.setPluginFilter('echo', { /* shape defined by the plugin */ });