Models¶
Settings¶
- class sonolink.models.AutoPlaySettings(*, mode: AutoPlayMode = AutoPlayMode.DISABLED, max_seeds: int = 100, provider: SearchProvider = SearchProvider.YOUTUBE, discovery_count: int = 10)[source]¶
- AttributesMethods
Configuration for the player’s AutoPlay behavior.
- mode¶
The default discovery mode when the player starts. Defaults to DISABLED.
- Type:
- max_seeds¶
The maximum number of track identifiers to store to prevent duplicates. Defaults to 100.
- Type:
- provider¶
The provider used for discovery. Defaults to SearchProvider.YOUTUBE.
- Type:
- discovery_count¶
The maximum number of discovered tracks to add to the queue at once. Defaults to 10.
- Type:
- replace(**kwargs: Any) Self¶
Returns a new instance of the settings with updated values.
This uses a shallow copy to ensure the original configuration instance remains immutable.
- discovery_count¶
- mode: AutoPlayMode¶
- provider: SearchProvider¶
- class sonolink.models.InactivitySettings(*, timeout: int | None = 300, mode: InactivityMode = InactivityMode.ALL_BOTS, user_ids: Iterable[Snowflake | int] | None = None)[source]¶
- Methods
Configuration for player inactivity and auto-disconnection.
- mode¶
The strategy used to determine if the channel is “inactive”.
- Type:
- user_ids¶
An iterable of user IDs or Discord objects that act as “Keep Alive” members.
- Type:
Iterable[Snowflake | int]
- replace(**kwargs: Any) Self¶
Returns a new instance of the settings with updated values.
This uses a shallow copy to ensure the original configuration instance remains immutable.
- mode: InactivityMode¶
- class sonolink.models.HistorySettings(*, enabled: bool = True, max_items: int | None = None)[source]¶
- Methods
Configuration for player history tracking.
- class sonolink.models.CacheSettings(*, enabled: bool = True, max_items: int = 1000)[source]¶
- Methods
- clsCacheSettings.default
- defreplace
Configuration for node caching.
- max_items¶
The maximum number of items to store in the LFU cache. Defaults to 1000.
Tracks and playlists¶
- class sonolink.models.Album[source]¶
Represents album metadata usually provided by external plugins like LavaSrc.
- class sonolink.models.Artist[source]¶
Represents artist metadata usually provided by external plugins like LavaSrc.
- class sonolink.models.Playable[source]¶
Represents a playable track within sonolink.
This class wraps the raw
sonolink.rest.schemas.Trackschema and provides a high-level interface for accessing track metadata and state.- property autoplay: bool¶
Whether this track was added by AutoPlay rather than a user.
Added in version 1.1.0.
- property client: Client[Any] | None¶
The
sonolink.Clientinstance associated with this object.
- property data: D¶
The raw msgspec schema object holding the data for this model.
- property extras: SimpleNamespace¶
Additional custom data attached to this track.
- property identifier: str¶
The unique identifier for this track based on its source (e.g., YouTube Video ID).
- class sonolink.models.Playlist[source]¶
Represents a Lavalink Playlist.
This class wraps the
sonolink.rest.schemas.PlaylistDataschema and implements the Sequence protocol to allow iteration over tracks.- property client: Client[Any] | None¶
The
sonolink.Clientinstance associated with this object.
- property data: D¶
The raw msgspec schema object holding the data for this model.
- property playlist_type: str | None¶
The type of playlist (e.g., ‘album’, ‘playlist’). Provided by plugins.
- property tracks: list[Playable]¶
A list of
sonolink.models.Playableobjects in this playlist.
Search and node models¶
- class sonolink.models.SearchResult[source]¶
The result of a track search.
- is_empty() bool[source]¶
Whether this search result is empty. An empty search result has no
SearchResult.result.
- property client: Client[Any] | None¶
The
sonolink.Clientinstance associated with this object.
- property data: D¶
The raw msgspec schema object holding the data for this model.
- exception¶
The raw exception data of this search result.
This will be
NoneifSearchResult.is_error()isFalse.
- result¶
The data of the search result. Depending on
SearchResult.type, this property will return a different value.If type is
sonolink.TrackLoadResult.TRACK, this will return asonolink.models.Playable. If type issonolink.TrackLoadResult.PLAYLIST, this will return asonolink.models.Playlist. If type issonolink.TrackLoadResult.SEARCH, this will return a list ofsonolink.models.Playables.
- property type: TrackLoadResult¶
The result type.
- class sonolink.models.PlayerInfo[source]¶
Represents a player’s info data.
This class wraps the raw
sonolink.rest.schemas.Playerschema and provides a high-level interface for accessing player metadata and state.- property channel_id: int | None¶
The Discord voice channel ID the player is connected to.
Returns
Noneif the player is not connected to a channel.
- property client: Client[Any] | None¶
The
sonolink.Clientinstance associated with this object.
- property data: D¶
The raw msgspec schema object holding the data for this model.
- property filters: PlayerFilters¶
The audio filters currently applied to the player.
- property state: PlayerState¶
The current state of the player (
PlayerState).
- track¶
Current playing track, or
Noneif no track is playing.
- property voice: PlayerVoiceState¶
The voice connection state of the player (
PlayerVoiceState).
- class sonolink.models.ServerInfo[source]¶
- Attributes
Represents a Lavalink server’s metadata & stats information.
This class wraps the raw
sonolink.rest.schemas.InfoResponseschema and provides a high-level interface for accessing Lavalink servers stats and metadata.- build_time¶
A datetime.datetime object representing the timestamp on which the Lavalink jar was built.
- property client: Client[Any] | None¶
The
sonolink.Clientinstance associated with this object.
- property data: D¶
The raw msgspec schema object holding the data for this model.
- git¶
A
GitInfoobject denoting the git version of the Lavalink server.
- property plugins: list[PluginObject]¶
A list of structs denoting the available plugins of the Lavalink server.
- version¶
A
Versionobject denoting the version of this node.
Filter wrapper models¶
- class sonolink.models.Equalizer(*, band: int, gain: float)[source]¶
Represents a single Lavalink equalizer band.
- Parameters:
- combine(other: BaseFilter[D]) Self¶
Combines this filter with another, preferring the other’s values.
This method does not mutate the current instance and returns a new one. See also
merge()for an in-place version that mutates the current instance.- Parameters:
other (
BaseFilter) – The other filter to combine with this one. Must be of the same type.- Returns:
A new instance with merged values from both filters.
- Return type:
BaseFilter
- merge(other: BaseFilter[D]) Self¶
Merges another filter into this one, preferring the other’s values.
This method mutates the current instance and returns it for chaining.
See also
combine()for a non-mutating version that returns a new instance.- Parameters:
other (
BaseFilter) – The other filter to merge into this one. Must be of the same type.- Returns:
The current instance with merged values.
- Return type:
BaseFilter
- property client: Client[Any] | None¶
The
sonolink.Clientinstance associated with this object.
- property data: D¶
The raw msgspec schema object holding the data for this model.
- class sonolink.models.Karaoke(*, level: float | None = None, mono_level: float | None = None, filter_band: float | None = None, filter_width: float | None = None)[source]¶
- Attributes
Filter that reduces vocal levels in a track, useful for karaoke.
- Parameters:
- combine(other: BaseFilter[D]) Self¶
Combines this filter with another, preferring the other’s values.
This method does not mutate the current instance and returns a new one. See also
merge()for an in-place version that mutates the current instance.- Parameters:
other (
BaseFilter) – The other filter to combine with this one. Must be of the same type.- Returns:
A new instance with merged values from both filters.
- Return type:
BaseFilter
- merge(other: BaseFilter[D]) Self¶
Merges another filter into this one, preferring the other’s values.
This method mutates the current instance and returns it for chaining.
See also
combine()for a non-mutating version that returns a new instance.- Parameters:
other (
BaseFilter) – The other filter to merge into this one. Must be of the same type.- Returns:
The current instance with merged values.
- Return type:
BaseFilter
- property client: Client[Any] | None¶
The
sonolink.Clientinstance associated with this object.
- property data: D¶
The raw msgspec schema object holding the data for this model.
- class sonolink.models.Timescale(*, speed: float | None = None, pitch: float | None = None, rate: float | None = None)[source]¶
Adjusts the speed, pitch, and rate of audio playback.
- Parameters:
- combine(other: BaseFilter[D]) Self¶
Combines this filter with another, preferring the other’s values.
This method does not mutate the current instance and returns a new one. See also
merge()for an in-place version that mutates the current instance.- Parameters:
other (
BaseFilter) – The other filter to combine with this one. Must be of the same type.- Returns:
A new instance with merged values from both filters.
- Return type:
BaseFilter
- merge(other: BaseFilter[D]) Self¶
Merges another filter into this one, preferring the other’s values.
This method mutates the current instance and returns it for chaining.
See also
combine()for a non-mutating version that returns a new instance.- Parameters:
other (
BaseFilter) – The other filter to merge into this one. Must be of the same type.- Returns:
The current instance with merged values.
- Return type:
BaseFilter
- property client: Client[Any] | None¶
The
sonolink.Clientinstance associated with this object.
- property data: D¶
The raw msgspec schema object holding the data for this model.
- class sonolink.models.Tremolo(*, frequency: float | None = None, depth: float | None = None)[source]¶
Rapidly oscillates the volume of the audio.
- Parameters:
- combine(other: BaseFilter[D]) Self¶
Combines this filter with another, preferring the other’s values.
This method does not mutate the current instance and returns a new one. See also
merge()for an in-place version that mutates the current instance.- Parameters:
other (
BaseFilter) – The other filter to combine with this one. Must be of the same type.- Returns:
A new instance with merged values from both filters.
- Return type:
BaseFilter
- merge(other: BaseFilter[D]) Self¶
Merges another filter into this one, preferring the other’s values.
This method mutates the current instance and returns it for chaining.
See also
combine()for a non-mutating version that returns a new instance.- Parameters:
other (
BaseFilter) – The other filter to merge into this one. Must be of the same type.- Returns:
The current instance with merged values.
- Return type:
BaseFilter
- property client: Client[Any] | None¶
The
sonolink.Clientinstance associated with this object.
- property data: D¶
The raw msgspec schema object holding the data for this model.
- class sonolink.models.Vibrato(*, frequency: float | None = None, depth: float | None = None)[source]¶
Rapidly oscillates the pitch of the audio.
- Parameters:
- combine(other: BaseFilter[D]) Self¶
Combines this filter with another, preferring the other’s values.
This method does not mutate the current instance and returns a new one. See also
merge()for an in-place version that mutates the current instance.- Parameters:
other (
BaseFilter) – The other filter to combine with this one. Must be of the same type.- Returns:
A new instance with merged values from both filters.
- Return type:
BaseFilter
- merge(other: BaseFilter[D]) Self¶
Merges another filter into this one, preferring the other’s values.
This method mutates the current instance and returns it for chaining.
See also
combine()for a non-mutating version that returns a new instance.- Parameters:
other (
BaseFilter) – The other filter to merge into this one. Must be of the same type.- Returns:
The current instance with merged values.
- Return type:
BaseFilter
- property client: Client[Any] | None¶
The
sonolink.Clientinstance associated with this object.
- property data: D¶
The raw msgspec schema object holding the data for this model.
- class sonolink.models.Rotation(*, rotation_hz: float | None = None)[source]¶
- Attributes
Rotates the audio across the stereo channels (panning effect).
- combine(other: BaseFilter[D]) Self¶
Combines this filter with another, preferring the other’s values.
This method does not mutate the current instance and returns a new one. See also
merge()for an in-place version that mutates the current instance.- Parameters:
other (
BaseFilter) – The other filter to combine with this one. Must be of the same type.- Returns:
A new instance with merged values from both filters.
- Return type:
BaseFilter
- merge(other: BaseFilter[D]) Self¶
Merges another filter into this one, preferring the other’s values.
This method mutates the current instance and returns it for chaining.
See also
combine()for a non-mutating version that returns a new instance.- Parameters:
other (
BaseFilter) – The other filter to merge into this one. Must be of the same type.- Returns:
The current instance with merged values.
- Return type:
BaseFilter
- property client: Client[Any] | None¶
The
sonolink.Clientinstance associated with this object.
- property data: D¶
The raw msgspec schema object holding the data for this model.
- class sonolink.models.Distortion(*, sin_offset: float | None = None, sin_scale: float | None = None, cos_offset: float | None = None, cos_scale: float | None = None, tan_offset: float | None = None, tan_scale: float | None = None, offset: float | None = None, scale: float | None = None)[source]¶
- Attributes
Applies distortion effects using sine, cosine, and tangent transforms.
- Parameters:
- combine(other: BaseFilter[D]) Self¶
Combines this filter with another, preferring the other’s values.
This method does not mutate the current instance and returns a new one. See also
merge()for an in-place version that mutates the current instance.- Parameters:
other (
BaseFilter) – The other filter to combine with this one. Must be of the same type.- Returns:
A new instance with merged values from both filters.
- Return type:
BaseFilter
- merge(other: BaseFilter[D]) Self¶
Merges another filter into this one, preferring the other’s values.
This method mutates the current instance and returns it for chaining.
See also
combine()for a non-mutating version that returns a new instance.- Parameters:
other (
BaseFilter) – The other filter to merge into this one. Must be of the same type.- Returns:
The current instance with merged values.
- Return type:
BaseFilter
- property client: Client[Any] | None¶
The
sonolink.Clientinstance associated with this object.
- property data: D¶
The raw msgspec schema object holding the data for this model.
- class sonolink.models.ChannelMix(*, left_to_left: float | None = None, left_to_right: float | None = None, right_to_left: float | None = None, right_to_right: float | None = None)[source]¶
- Attributes
Mixes left and right audio channels to manipulate stereo separation.
- Parameters:
left_to_left (
float|None) – The left to left channel mix factor (0.0 <= x <= 1.0).left_to_right (
float|None) – The left to right channel mix factor (0.0 <= x <= 1.0).right_to_left (
float|None) – The right to left channel mix factor (0.0 <= x <= 1.0).right_to_right (
float|None) – The right to right channel mix factor (0.0 <= x <= 1.0).
- combine(other: BaseFilter[D]) Self¶
Combines this filter with another, preferring the other’s values.
This method does not mutate the current instance and returns a new one. See also
merge()for an in-place version that mutates the current instance.- Parameters:
other (
BaseFilter) – The other filter to combine with this one. Must be of the same type.- Returns:
A new instance with merged values from both filters.
- Return type:
BaseFilter
- merge(other: BaseFilter[D]) Self¶
Merges another filter into this one, preferring the other’s values.
This method mutates the current instance and returns it for chaining.
See also
combine()for a non-mutating version that returns a new instance.- Parameters:
other (
BaseFilter) – The other filter to merge into this one. Must be of the same type.- Returns:
The current instance with merged values.
- Return type:
BaseFilter
- property client: Client[Any] | None¶
The
sonolink.Clientinstance associated with this object.
- property data: D¶
The raw msgspec schema object holding the data for this model.
- property left_to_left: float | None¶
The contribution of the left input channel to the left output channel.
- property left_to_right: float | None¶
The contribution of the left input channel to the right output channel.
- class sonolink.models.LowPass(*, smoothing: float | None = None)[source]¶
Suppresses higher frequencies in the audio signal.
- combine(other: BaseFilter[D]) Self¶
Combines this filter with another, preferring the other’s values.
This method does not mutate the current instance and returns a new one. See also
merge()for an in-place version that mutates the current instance.- Parameters:
other (
BaseFilter) – The other filter to combine with this one. Must be of the same type.- Returns:
A new instance with merged values from both filters.
- Return type:
BaseFilter
- merge(other: BaseFilter[D]) Self¶
Merges another filter into this one, preferring the other’s values.
This method mutates the current instance and returns it for chaining.
See also
combine()for a non-mutating version that returns a new instance.- Parameters:
other (
BaseFilter) – The other filter to merge into this one. Must be of the same type.- Returns:
The current instance with merged values.
- Return type:
BaseFilter
- property client: Client[Any] | None¶
The
sonolink.Clientinstance associated with this object.
- property data: D¶
The raw msgspec schema object holding the data for this model.
- class sonolink.models.Filters(*, equalizer: list[Equalizer] | None = None, karaoke: Karaoke | None = None, timescale: Timescale | None = None, tremolo: Tremolo | None = None, vibrato: Vibrato | None = None, rotation: Rotation | None = None, distortion: Distortion | None = None, channel_mix: ChannelMix | None = None, low_pass: LowPass | None = None, volume: float = 1.0, plugin_filters: dict[str, Any] | None = None)[source]¶
- Attributes
The main container for all active player filters.
This class provides a Pythonic interface to the underlying Lavalink filter state. Active filters are sent to Lavalink via the
payload()property.- Parameters:
volume (
float) – The linear volume multiplier. Defaults to 1.0.equalizer (
list[Equalizer] | None) – A list of active equalizer bands.karaoke (
Karaoke|None) – The active karaoke filter settings.timescale (
Timescale|None) – The active timescale (speed/pitch) filter settings.tremolo (
Tremolo|None) – The active tremolo (volume oscillation) filter settings.vibrato (
Vibrato|None) – The active vibrato (pitch oscillation) filter settings.rotation (
Rotation|None) – The active rotation (panning) filter settings.distortion (
Distortion|None) – The active distortion filter settings.channel_mix (
ChannelMix|None) – The active channel mix filter settings.low_pass (
LowPass|None) – The active low pass filter settings.plugin_filters (
dict|None) – A dictionary of raw plugin-defined filter payloads.
- combine(other: Filters) Self[source]¶
Return a new filter set with
othermerged into a copy of this one.This does not mutate either input. Use
merge()when you want in-place mutation of the current instance.
- merge(other: Filters) Self[source]¶
Merge another filter set into this instance in place.
This mutates
self. Usecombine()when you need a new mergedFiltersinstance without changing either input.
- channel_mix: ChannelMix | None¶
- property client: Client[Any] | None¶
The
sonolink.Clientinstance associated with this object.
- property data: D¶
The raw msgspec schema object holding the data for this model.
- distortion: Distortion | None¶
- property payload: PlayerFilters¶
Returns the underlying msgspec schema for API requests.