REST API¶
Filter payloads¶
- class sonolink.rest.schemas.PlayerFilters(*, volume: float | UnsetType = UNSET, equalizer: list[EqualizerFilter] | UnsetType = UNSET, karaoke: KaraokeFilter | UnsetType = UNSET, timescale: TimescaleFilter | UnsetType = UNSET, tremolo: TremoloFilter | UnsetType = UNSET, vibrato: VibratoFilter | UnsetType = UNSET, rotation: RotationFilter | UnsetType = UNSET, distortion: DistortionFilter | UnsetType = UNSET, channel_mix: ChannelMixFilter | UnsetType = UNSET, low_pass: LowPassFilter | UnsetType = UNSET, plugin_filters: dict[str, Any] | UnsetType = UNSET)[source]¶
Represents the full filter payload for a Lavalink player.
This object is sent in
UpdatePlayerRequestunderfilters. Only provided attributes are updated; attributes set toNoneare ignored, allowing partial filter updates without resetting other filters.- channel_mix: ChannelMixFilter | UnsetType¶
Cross-channel matrix configuration (
ChannelMixFilter).
- distortion: DistortionFilter | UnsetType¶
Wave-shaping configuration (
DistortionFilter).
- equalizer: list[EqualizerFilter] | UnsetType¶
List of
EqualizerFilterentries for bands0..14.
- karaoke: KaraokeFilter | UnsetType¶
Karaoke configuration (
KaraokeFilter).
- low_pass: LowPassFilter | UnsetType¶
Low-pass configuration (
LowPassFilter).
- plugin_filters: dict[str, Any] | UnsetType¶
Plugin-defined filter payloads keyed by plugin name. Values are plugin-specific and passed through as-is.
- rotation: RotationFilter | UnsetType¶
Stereo rotation configuration (
RotationFilter).
- timescale: TimescaleFilter | UnsetType¶
Time-domain transform configuration (
TimescaleFilter).
- tremolo: TremoloFilter | UnsetType¶
Volume oscillation configuration (
TremoloFilter).
- vibrato: VibratoFilter | UnsetType¶
Pitch oscillation configuration (
VibratoFilter).
- class sonolink.rest.schemas.EqualizerFilter(*, band: int, gain: float)[source]¶
Represents a single Lavalink equalizer band.
Lavalink exposes 15 bands indexed
0..14. The frequencies are approximately:25, 40, 63, 100, 160, 250, 400, 630, 1000, 1600, 2500, 4000, 6300, 10000, 16000Hz.
- class sonolink.rest.schemas.KaraokeFilter(*, level: float | UnsetType = UNSET, mono_level: float | UnsetType = UNSET, filter_band: float | UnsetType = UNSET, filter_width: float | UnsetType = UNSET)[source]¶
- Attributes
Represents karaoke filter configuration.
This filter reduces content in a target frequency region, commonly used for vocal reduction.
- class sonolink.rest.schemas.TimescaleFilter(*, speed: float | UnsetType = UNSET, pitch: float | UnsetType = UNSET, rate: float | UnsetType = UNSET)[source]¶
Represents timescale filter configuration.
This filter changes perceived playback speed, pitch, and rate. In Lavalink, omitted values are treated as
1.0.
- class sonolink.rest.schemas.TremoloFilter(*, frequency: float | UnsetType = UNSET, depth: float | UnsetType = UNSET)[source]¶
Represents tremolo filter configuration.
Tremolo rapidly oscillates output volume.
- class sonolink.rest.schemas.VibratoFilter(*, frequency: float | UnsetType = UNSET, depth: float | UnsetType = UNSET)[source]¶
Represents vibrato filter configuration.
Vibrato rapidly oscillates output pitch.
- class sonolink.rest.schemas.RotationFilter(*, rotation_hz: float | UnsetType = UNSET)[source]¶
- Attributes
Represents stereo rotation filter configuration.
- class sonolink.rest.schemas.DistortionFilter(*, sin_offset: float | UnsetType = UNSET, sin_scale: float | UnsetType = UNSET, cos_offset: float | UnsetType = UNSET, cos_scale: float | UnsetType = UNSET, tan_offset: float | UnsetType = UNSET, tan_scale: float | UnsetType = UNSET, offset: float | UnsetType = UNSET, scale: float | UnsetType = UNSET)[source]¶
- Attributes
Represents distortion filter configuration.
Distortion combines sinusoidal and linear transforms. Small changes can produce large audible differences, so tune incrementally.
- class sonolink.rest.schemas.ChannelMixFilter(*, left_to_left: float | UnsetType = UNSET, left_to_right: float | UnsetType = UNSET, right_to_left: float | UnsetType = UNSET, right_to_right: float | UnsetType = UNSET)[source]¶
- Attributes
Represents channel mix filter configuration.
All coefficients satisfy
0.0 <= x <= 1.0. The default matrix keeps channels independent. Setting all coefficients to0.5yields dual-mono output.
Info payloads¶
- class sonolink.rest.schemas.InfoResponse(*, version: VersionObject, build_time: int, git: GitObject, jvm: str, lavaplayer: str, source_managers: list[str], filters: list[str], plugins: list[PluginObject])[source]¶
- Attributes
Represents the Lavalink Info response payload.
- plugins: list[PluginObject]¶
Installed Lavalink plugins.
- version: VersionObject¶
Version metadata of the Lavalink server.
- class sonolink.rest.schemas.VersionObject(*, semver: str, major: int, minor: int, patch: int, pre_release: str | None = None, build: str | None = None)[source]¶
Represents Lavalink version metadata.
- class sonolink.rest.schemas.GitObject(*, branch: str, commit: str, commit_time: int)[source]¶
- Attributes
Represents Git metadata for the Lavalink build.
- class sonolink.rest.schemas.PluginObject(*, name: str, version: str)[source]¶
Represents an installed Lavalink plugin.
- class sonolink.rest.schemas.MemoryObject(*, free: int, used: int, allocated: int, reservable: int)[source]¶
- Attributes
Represents JVM memory usage statistics.
- class sonolink.rest.schemas.CPUObject(*, cores: int, system_load: float, lavalink_load: float)[source]¶
- Attributes
Represents CPU usage statistics.
- class sonolink.rest.schemas.FrameStatsObject(*, sent: int, nulled: int, deficit: int)[source]¶
Represents audio frame delivery statistics.
- class sonolink.rest.schemas.StatsResponse(*, players: int, playing_players: int, uptime: int, memory: MemoryObject, cpu: CPUObject, frame_stats: FrameStatsObject | None = None)[source]¶
- Attributes
Represents the Lavalink Stats response payload.
Returned periodically over WebSocket and via
/v4/stats.- frame_stats: FrameStatsObject | None¶
Optional audio frame statistics.
- memory: MemoryObject¶
JVM memory usage statistics.
- sonolink.rest.schemas.VersionResponse = <class 'str'>¶
str(object=’’) -> str str(bytes_or_buffer[, encoding[, errors]]) -> str
Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.__str__() (if defined) or repr(object). encoding defaults to ‘utf-8’. errors defaults to ‘strict’.
Route planner payloads¶
- class sonolink.rest.schemas.DetailsObject(*, ip_block: IPBlockObject, failing_addresses: list[FailingAddressObject] = <factory>, rotate_index: str | None = None, ip_index: int | None = None, block_index: int | None = None, current_address: str | None = None, current_address_index: int | None = None)[source]¶
Represents route planner details.
Provides runtime information about the active IP rotation strategy. Some attributes are only present for specific route planner types.
- block_index: int | None¶
Index of the active
/64block. This value increases whenever an address block is rotated due to bans. Available forRotatingNanoIpRoutePlanner.
- current_address: str | None¶
Currently selected outbound IP address. Available for
RotatingIpRoutePlanner.
- current_address_index: int | None¶
Offset of the active address inside the IP block. Available for
NanoIpRoutePlannerandRotatingNanoIpRoutePlanner.
- failing_addresses: list[FailingAddressObject]¶
List of addresses currently marked as failing (
FailingAddressObject).
- ip_block: IPBlockObject¶
IP block configuration currently used (
IPBlockObject).
- class sonolink.rest.schemas.IPBlockObject(*, type_: IPBlockType, size: str)[source]¶
Represents an IP block used by the route planner.
- type_: IPBlockType¶
Type of IP block (
IPBlockType).
- class sonolink.rest.schemas.FailingAddressObject(*, address: str, timestamp: int, time: str)[source]¶
Represents an address marked as failing by the route planner.
Addresses are temporarily excluded after connection failures.
- class sonolink.rest.schemas.RoutePlannerStatusResponse(*, class_: RoutePlannerType | None = None, details: DetailsObject | None = None)[source]¶
Represents the response from GET /v4/routeplanner/status.
- class_: RoutePlannerType | None¶
The type of route planner in use (
RoutePlannerType).
- details: DetailsObject | None¶
Status details (
DetailsObject), orNoneif not enabled.
Player payloads¶
- class sonolink.rest.schemas.Player(*, guild_id: str, track: Track | None = None, volume: int, paused: bool, state: PlayerState, voice: PlayerVoiceState, filters: PlayerFilters)[source]¶
Represents a Lavalink Player.
- filters: PlayerFilters¶
Active audio filters (
PlayerFilters).
- state: PlayerState¶
Current state of the player (
PlayerState).
- voice: PlayerVoiceState¶
Voice connection state (
PlayerVoiceState).
- class sonolink.rest.schemas.PlayerState(*, time: int, position: int, connected: bool, ping: int)[source]¶
Represents the state of a Lavalink Player.
- class sonolink.rest.schemas.PlayerVoiceState(*, token: str, endpoint: str, session_id: str, channel_id: str | None = None)[source]¶
- Attributes
Represents the voice connection state of a Lavalink Player.
- class sonolink.rest.schemas.UpdatePlayerTrackRequest(*, encoded: str | UnsetType | None = UNSET, identifier: str | UnsetType = UNSET, user_data: dict[str, Any] | UnsetType = UNSET)[source]¶
- Attributes
Represents a track update request for a Lavalink Player.
Used within
UpdatePlayerRequestto play or modify a track.
- class sonolink.rest.schemas.UpdatePlayerRequest(*, track: UpdatePlayerTrackRequest | UnsetType = UNSET, position: int | UnsetType = UNSET, endtime: int | UnsetType = UNSET, volume: int | UnsetType = UNSET, paused: bool | UnsetType = UNSET, filters: PlayerFilters | UnsetType = UNSET, voice: PlayerVoiceState | UnsetType = UNSET)[source]¶
Payload to update a Lavalink Player.
This object is sent to /players/{guildId} to modify player state.
- filters: PlayerFilters | UnsetType¶
Audio filters to apply (
PlayerFilters), optional.
- track: UpdatePlayerTrackRequest | UnsetType¶
Track to play or update (
UpdatePlayerTrackRequest), optional.
- voice: PlayerVoiceState | UnsetType¶
Voice state updates (
PlayerVoiceState), optional.
- sonolink.rest.schemas.GetPlayersResponse = GetPlayersResponse¶
Type alias.
Type aliases are created through the type statement:
type Alias = int
In this example, Alias and int will be treated equivalently by static type checkers.
At runtime, Alias is an instance of TypeAliasType. The __name__ attribute holds the name of the type alias. The value of the type alias is stored in the __value__ attribute. It is evaluated lazily, so the value is computed only if the attribute is accessed.
Type aliases can also be generic:
type ListOrSet[T] = list[T] | set[T]
In this case, the type parameters of the alias are stored in the __type_params__ attribute.
See PEP 695 for more information.
- sonolink.rest.schemas.GetPlayerResponse = GetPlayerResponse¶
Type alias.
Type aliases are created through the type statement:
type Alias = int
In this example, Alias and int will be treated equivalently by static type checkers.
At runtime, Alias is an instance of TypeAliasType. The __name__ attribute holds the name of the type alias. The value of the type alias is stored in the __value__ attribute. It is evaluated lazily, so the value is computed only if the attribute is accessed.
Type aliases can also be generic:
type ListOrSet[T] = list[T] | set[T]
In this case, the type parameters of the alias are stored in the __type_params__ attribute.
See PEP 695 for more information.
- sonolink.rest.schemas.UpdatePlayerResponse = UpdatePlayerResponse¶
Type alias.
Type aliases are created through the type statement:
type Alias = int
In this example, Alias and int will be treated equivalently by static type checkers.
At runtime, Alias is an instance of TypeAliasType. The __name__ attribute holds the name of the type alias. The value of the type alias is stored in the __value__ attribute. It is evaluated lazily, so the value is computed only if the attribute is accessed.
Type aliases can also be generic:
type ListOrSet[T] = list[T] | set[T]
In this case, the type parameters of the alias are stored in the __type_params__ attribute.
See PEP 695 for more information.
- sonolink.rest.schemas.DestroyPlayerResponse = DestroyPlayerResponse¶
Type alias.
Type aliases are created through the type statement:
type Alias = int
In this example, Alias and int will be treated equivalently by static type checkers.
At runtime, Alias is an instance of TypeAliasType. The __name__ attribute holds the name of the type alias. The value of the type alias is stored in the __value__ attribute. It is evaluated lazily, so the value is computed only if the attribute is accessed.
Type aliases can also be generic:
type ListOrSet[T] = list[T] | set[T]
In this case, the type parameters of the alias are stored in the __type_params__ attribute.
See PEP 695 for more information.
Playlist and session payloads¶
- class sonolink.rest.schemas.PlaylistInfo(*, name: str, selected_track: int)[source]¶
- Attributes
Represents metadata for a loaded playlist.
This object is embedded in playlist load responses.
Track payloads¶
- class sonolink.rest.schemas.TrackInfo(*, identifier: str, uri: str | None = None, title: str, author: str, length: int, position: int, is_seekable: bool, is_stream: bool, source_name: str, artwork_url: str | None = None, isrc: str | None = None)[source]¶
- Attributes
Represents metadata for Track, available under
Track.info.
- class sonolink.rest.schemas.Track(*, encoded: str, info: TrackInfo, plugin_info: Any, user_data: Any)[source]¶
- Attributes
Represents a Track payload.
- user_data: Any¶
Additional track data previously provided (
UpdatePlayerRequest).
- class sonolink.rest.schemas.TrackLoadingResponse(*, load_type: TrackLoadResult, data: dict[str, Any] | list[dict[str, Any]] | None)[source]¶
Represents a TrackLoadingResponse structure payload.
- data: dict[str, Any] | list[dict[str, Any]] | None¶
Associated load result data, this is a dict that will be converted into a valid object in the respective object.
- load_type: TrackLoadResult¶
Type of load result (
TrackLoadResult).
- class sonolink.rest.schemas.PlaylistData(*, info: PlaylistInfo, plugin_info: dict[str, Any], tracks: list[Track])[source]¶
- Attributes
Contains the detailed results of a track load request.
For playlists, this contains playlist metadata and a list of tracks.
- info: PlaylistInfo¶
Playlist metadata (
PlaylistInfo).
- sonolink.rest.schemas.TrackDecodeResponse = <class 'sonolink.rest.schemas.track.Track'>¶
Represents a Track payload.