lavalink_rs.model.events

class Ready:

Dispatched by Lavalink upon successful connection and authorization.

op: str
session_id: str

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

resumed: bool

Whether this session was resumed.

class PlayerUpdate:

Dispatched periodically with the current state of a player.

guild_id: GuildId
state: State

The player state.

op: str
class Stats:

A collection of statistics sent every minute.

players: int

The amount of players connected to the node.

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.

op: str

Memory statistics of the node.

uptime: int

The uptime of the node in milliseconds.

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

The amount of frames sent to Discord.

nulled: int

The amount of frames that were nulled.

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.

class TrackStart:

Dispatched when a track starts playing.

guild_id: GuildId
event_type: str
track: TrackData

The track that started playing.

op: str
class TrackEnd:

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

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

event_type: str
guild_id: GuildId
exception: TrackError

The exception itself.

op: str
track: TrackData

The track that threw the exception

class TrackStuck:

Dispatched when a track gets stuck while playing.

op: str
event_type: str
threshold_ms: int

The threshold in milliseconds that was exceeded.

track: TrackData

The track that got stuck.

guild_id: GuildId
class WebSocketClosed:

Dispatched when an audio WebSocket to Discord is closed.

reason: str

The reason the socket was closed.

by_remote: bool

Whether the connection was closed by Discord or not.

event_type: str
guild_id: GuildId
code: int

Status code returned by discord.

See the discord docs for a list of them.

op: str