zephyr.lavalink
Playback through a shared Lavalink v4 node. Requires the `lavalink` permission; declare `services = ["lavalink"]` for production. Track and player return values are the Lavalink v4 JSON shapes (camelCase fields like `loadType`, `encoded`, `info`, `state`).
12 functions
load_tracks
zephyr.lavalink.load_tracks(guild_id, identifier, source?)Resolve tracks from an identifier or search query.
When source is omitted, identifier is sent as-is (URL or Lavalink identifier). Search sources: youtube/yt, youtube_music/ytm, soundcloud/sc, plus LavaSrc spotify, apple_music, deezer, yandex_music when supported.
Parameters
guild_idstringGuild id.
identifierstringA URL, Lavalink identifier, or search query.
sourcestringoptionalSearch source, e.g. youtube.
Returns
Lavalink's loaded-track result (loadType, data).
Raises an error if
- the
lavalinkpermission is not granted
Example
local result = zephyr.lavalink.load_tracks(ctx.guild_id, "never gonna give you up", "youtube")connect
zephyr.lavalink.connect(guild_id, channel_id)Join voice and create a Lavalink player.
Sends the voice-state update, waits for the voice events, then returns the player.
Parameters
guild_idstringGuild id.
channel_idstringVoice channel id to join.
Returns
The current player.
Raises an error if
- the
lavalinkpermission is not granted
disconnect
zephyr.lavalink.disconnect(guild_id)Delete the player and leave voice.
Parameters
guild_idstringGuild id.
Returns
Nothing.
Raises an error if
- the
lavalinkpermission is not granted
play
zephyr.lavalink.play(guild_id, encoded_track, user_data)Play an encoded track.
Parameters
guild_idstringGuild id.
encoded_trackstringEncoded track string from load_tracks.
user_datastringOptional stable id attached to the track as Lavalink userData and echoed back in playback events. Use this to correlate events to a playback (the encoded string is not stable across events).
Returns
The updated player.
Raises an error if
- the
lavalinkpermission is not granted
pause
zephyr.lavalink.pause(guild_id)Pause the player.
Parameters
guild_idstringGuild id.
Returns
The updated player.
Raises an error if
- the
lavalinkpermission is not granted
resume
zephyr.lavalink.resume(guild_id)Resume the player.
Parameters
guild_idstringGuild id.
Returns
The updated player.
Raises an error if
- the
lavalinkpermission is not granted
stop
zephyr.lavalink.stop(guild_id)Stop the current track.
Parameters
guild_idstringGuild id.
Returns
The updated player.
Raises an error if
- the
lavalinkpermission is not granted
skip
zephyr.lavalink.skip(guild_id)Skip the current track.
Parameters
guild_idstringGuild id.
Returns
Nothing.
Raises an error if
- the
lavalinkpermission is not granted
volume
zephyr.lavalink.volume(guild_id, value)Set the player volume.
Parameters
guild_idstringGuild id.
valuenumberVolume in Lavalink's 0..1000 range.
Returns
The updated player.
Raises an error if
- the
lavalinkpermission is not granted
seek
zephyr.lavalink.seek(guild_id, position_ms)Seek the current track.
Parameters
guild_idstringGuild id.
position_msnumberSeek position in milliseconds.
Returns
The updated player.
Raises an error if
- the
lavalinkpermission is not granted
player
zephyr.lavalink.player(guild_id)Return the current player state.
Parameters
guild_idstringGuild id.
Returns
The current player.
Raises an error if
- the
lavalinkpermission is not granted
version
zephyr.lavalink.version(guild_id)Return the connected Lavalink node version.
Parameters
guild_idstringGuild id.
Returns
The Lavalink node version.
Raises an error if
- the
lavalinkpermission is not granted