lavalink_rs.model.events API documentation

# lavalink_rs.model.events

class Ready:

Dispatched by Lavalink upon successful connection and authorization.

session_id

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

op
resumed

Whether this session was resumed.

class PlayerUpdate:

Dispatched periodically with the current state of a player.

state

The player state.

op
guild_id
class Stats:

A collection of statistics sent every minute.

playing_players

The amount of players playing a track.

memory

Memory statistics of the node.

players

The amount of players connected to the node.

uptime

The uptime of the node in milliseconds.

op
frame_stats

The frame stats of the node.

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

cpu

CPU statistics of the node.

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

The amount of frames sent to Discord.

nulled

The amount of frames that were nulled.

deficit

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.

event_type
op
track

The track that started playing.

guild_id
class TrackEnd:

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

guild_id
track

The track that finished playing.

event_type
reason

The reason the track finished.

op
class TrackEndReason:

The reason the track finished.

Finished = TrackEndReason.Finished
LoadFailed = TrackEndReason.LoadFailed
Stopped = TrackEndReason.Stopped
Replaced = TrackEndReason.Replaced
Cleanup = TrackEndReason.Cleanup
class TrackException:

Dispatched when a track throws an exception.

track

The track that threw the exception

guild_id
event_type
op
exception

The exception itself.

class TrackStuck:

Dispatched when a track gets stuck while playing.

guild_id
event_type
op
track

The track that got stuck.

threshold_ms

The threshold in milliseconds that was exceeded.

class WebSocketClosed:

Dispatched when an audio WebSocket to Discord is closed.

op
event_type
code

Status code returned by discord.

See the discord docs for a list of them.

guild_id
reason

The reason the socket was closed.

by_remote

Whether the connection was closed by Discord or not.