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.

op: str
state: State

The player state.

guild_id: GuildId
class Stats:

A collection of statistics sent every minute.

uptime: int

The uptime of the node in milliseconds.

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.

playing_players: int

The amount of players playing a track.

players: int

The amount of players connected to the node.

Memory statistics of the node.

class Cpu:
cores: int
system_load: float
class Memory:
used: int
allocated: int
free: int
reservable: 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.

nulled: int

The amount of frames that were nulled.

sent: int

The amount of frames sent to Discord.

class TrackStart:

Dispatched when a track starts playing.

op: str
event_type: str
track: TrackData

The track that started playing.

guild_id: GuildId
class TrackEnd:

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

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

The track that finished playing.

The reason the track finished.

class TrackEndReason:

The reason the track finished.

class TrackException:

Dispatched when a track throws an exception.

guild_id: GuildId
op: str
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.

op: str
guild_id: GuildId
track: TrackData

The track that got stuck.

event_type: str
threshold_ms: int

The threshold in milliseconds that was exceeded.

class WebSocketClosed:

Dispatched when an audio WebSocket to Discord is closed.

op: str
code: int

Status code returned by discord.

See the discord docs for a list of them.

reason: str

The reason the socket was closed.

event_type: str
guild_id: GuildId
by_remote: bool

Whether the connection was closed by Discord or not.