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.

op: str
playing_players: int

The amount of players playing a track.

players: int

The amount of players connected to the node.

uptime: int

The uptime of the node in milliseconds.

memory: Memory

Memory statistics of the node.

cpu: Cpu

CPU statistics of the node.

frame_stats: Optional[FrameStats]

The frame stats of the node.

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

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

op: str
track: TrackData

The track that started playing.

guild_id: GuildId
event_type: str
class TrackEnd:

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

op: str
reason: TrackEndReason

The reason the track finished.

event_type: str
track: TrackData

The track that finished playing.

guild_id: GuildId
class TrackEndReason:

The reason the track finished.

class TrackException:

Dispatched when a track throws an exception.

guild_id: GuildId
track: TrackData

The track that threw the exception

exception: TrackError

The exception itself.

op: str
event_type: str
class TrackStuck:

Dispatched when a track gets stuck while playing.

op: str
track: TrackData

The track that got stuck.

threshold_ms: int

The threshold in milliseconds that was exceeded.

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

by_remote: bool

Whether the connection was closed by Discord or not.

event_type: str
guild_id: GuildId