lavalink_rs.model.events

class Ready:

Dispatched by Lavalink upon successful connection and authorization.

resumed: bool

Whether this session was resumed.

session_id: str

The lavalink session ID, used for some REST requests and resuming.

op: str
class PlayerUpdate:

Dispatched periodically with the current state of a player.

state: State

The player state.

op: str
guild_id: GuildId
class Stats:

A collection of statistics sent every minute.

playing_players: int

The amount of players playing a track.

op: str

CPU statistics of the node.

frame_stats: Optional[lavalink_rs.model.events.FrameStats]

The frame stats of the node.

This field is None if there's no players, or it was requested via the REST API.

players: int

The amount of players connected to the node.

uptime: int

The uptime of the node in milliseconds.

Memory statistics of the node.

class Cpu:
cores: int
system_load: float
class Memory:
allocated: int
used: int
reservable: int
free: int
class FrameStats:
deficit: int

The difference between sent frames and the expected amount of frames.

The expected amount of frames is 3000 (1 every 20 ms) per player. If the deficit is negative, too many frames were sent, and if it's positive, not enough frames got sent.

sent: int

The amount of frames sent to Discord.

nulled: int

The amount of frames that were nulled.

class TrackStart:

Dispatched when a track starts playing.

event_type: str
guild_id: GuildId
op: str
track: TrackData

The track that started playing.

class TrackEnd:

Dispatched when a track ends. track_exception and track_stuck will also trigger this event.

op: str
track: TrackData

The track that finished playing.

guild_id: GuildId
event_type: str
reason: TrackEndReason

The reason the track finished.

class TrackEndReason:

The reason the track finished.

class TrackException:

Dispatched when a track throws an exception.

op: str
guild_id: GuildId
event_type: str
track: TrackData

The track that threw the exception

exception: TrackError

The exception itself.

class TrackStuck:

Dispatched when a track gets stuck while playing.

threshold_ms: int

The threshold in milliseconds that was exceeded.

event_type: str
guild_id: GuildId
track: TrackData

The track that got stuck.

op: str
class WebSocketClosed:

Dispatched when an audio WebSocket to Discord is closed.

code: int

Status code returned by discord.

See the discord docs for a list of them.

op: str
guild_id: GuildId
reason: str

The reason the socket was closed.

by_remote: bool

Whether the connection was closed by Discord or not.

event_type: str