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.

op: str
state: State

The player state.

guild_id: GuildId
class Stats:

A collection of statistics sent every minute.

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.

Memory statistics of the node.

op: str
players: int

The amount of players connected to the node.

uptime: int

The uptime of the node in milliseconds.

playing_players: int

The amount of players playing a track.

class Cpu:
system_load: float
cores: int
class Memory:
free: int
allocated: 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
op: str
event_type: 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.

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.

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

The track that got stuck.

threshold_ms: int

The threshold in milliseconds that was exceeded.

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