Events¶
All RevvLink events pass a typed payload object to your handler.
| Event | Payload |
|---|---|
on_revvlink_node_ready |
NodeReadyEventPayload |
on_revvlink_node_disconnected |
NodeDisconnectedEventPayload |
on_revvlink_track_start |
TrackStartEventPayload |
on_revvlink_track_end |
TrackEndEventPayload |
on_revvlink_track_exception |
TrackExceptionEventPayload |
on_revvlink_track_stuck |
TrackStuckEventPayload |
on_revvlink_websocket_closed |
WebsocketClosedEventPayload |
on_revvlink_player_update |
PlayerUpdateEventPayload |
on_revvlink_stats_update |
StatsEventPayload |
on_revvlink_extra_event |
ExtraEventPayload |
Guide
See the Events Guide for handler examples and usage patterns.
Node Events¶
NodeReadyEventPayload ¶
Payload received in the :func:on_revvlink_node_ready event.
Attributes:
| Name | Type | Description |
|---|---|---|
node |
:class:`~revvlink.Node`
|
The node that has connected or reconnected. |
resumed |
bool
|
Whether this node was successfully resumed. |
session_id |
str
|
The session ID associated with this node. |
NodeDisconnectedEventPayload ¶
Payload received in the :func:on_revvlink_node_disconnected event.
Attributes:
| Name | Type | Description |
|---|---|---|
node |
:class:`~revvlink.Node`
|
The node that has disconnected. |
Track Events¶
TrackStartEventPayload ¶
Payload received in the :func:on_revvlink_track_start event.
Attributes:
| Name | Type | Description |
|---|---|---|
player |
:class:`~revvlink.Player` | None
|
The player associated with this event. Could be None. |
track |
:class:`~revvlink.Playable`
|
The track received from Lavalink regarding this event. |
original |
:class:`~revvlink.Playable` | None
|
The original track associated this event. E.g. the track that was passed
to :meth: |
TrackEndEventPayload ¶
Payload received in the :func:on_revvlink_track_end event.
Attributes:
| Name | Type | Description |
|---|---|---|
player |
:class:`~revvlink.Player` | None
|
The player associated with this event. Could be None. |
track |
:class:`~revvlink.Playable`
|
The track received from Lavalink regarding this event. |
reason |
str
|
The reason Lavalink ended this track. |
original |
:class:`~revvlink.Playable` | None
|
The original track associated this event. E.g. the track that was passed
to :meth: |
TrackExceptionEventPayload ¶
TrackExceptionEventPayload(
player: Player | None,
track: Playable,
exception: TrackExceptionPayload,
)
Payload received in the :func:on_revvlink_track_exception event.
Attributes:
| Name | Type | Description |
|---|---|---|
player |
:class:`~revvlink.Player` | None
|
The player associated with this event. Could be None. |
track |
:class:`~revvlink.Playable`
|
The track received from Lavalink regarding this event. |
exception |
TrackExceptionPayload
|
The exception data received via Lavalink. |
TrackStuckEventPayload ¶
Payload received in the :func:on_revvlink_track_stuck event.
Attributes:
| Name | Type | Description |
|---|---|---|
player |
:class:`~revvlink.Player` | None
|
The player associated with this event. Could be None. |
track |
:class:`~revvlink.Playable`
|
The track received from Lavalink regarding this event. |
threshold |
int
|
The Lavalink threshold associated with this event. |
WebSocket & Player Events¶
WebsocketClosedEventPayload ¶
Payload received in the :func:on_revvlink_websocket_closed event.
Attributes:
| Name | Type | Description |
|---|---|---|
player |
:class:`~revvlink.Player` | None
|
The player associated with this event. Could be None. |
code |
:class:`revvlink.DiscordVoiceCloseType`
|
The close code enum value. |
reason |
str
|
The reason the websocket was closed. |
by_remote |
bool
|
|
PlayerUpdateEventPayload ¶
Payload received in the :func:on_revvlink_player_update event.
Attributes:
| Name | Type | Description |
|---|---|---|
player |
:class:`~revvlink.Player` | None
|
The player associated with this event. Could be None. |
time |
int
|
Unix timestamp in milliseconds, when this event fired. |
position |
int
|
The position of the currently playing track in milliseconds. |
connected |
bool
|
Whether Lavalink is connected to the voice gateway. |
ping |
int
|
The ping of the node to the Discord voice server in milliseconds (-1 if not connected). |
StatsEventPayload ¶
Payload received in the :func:on_revvlink_stats_update event.
Attributes:
| Name | Type | Description |
|---|---|---|
players |
int
|
The amount of players connected to the node (Lavalink). |
playing |
int
|
The amount of players playing a track. |
uptime |
int
|
The uptime of the node in milliseconds. |
memory |
:class:`revvlink.StatsEventMemory`
|
See Also: :class: |
cpu |
:class:`revvlink.StatsEventCPU`
|
See Also: :class: |
frames |
:class:`revvlink.StatsEventFrames` | None
|
See Also: :class: |
StatsEventMemory ¶
Represents Memory Stats.
Attributes:
| Name | Type | Description |
|---|---|---|
free |
int
|
The amount of free memory in bytes. |
used |
int
|
The amount of used memory in bytes. |
allocated |
int
|
The amount of allocated memory in bytes. |
reservable |
int
|
The amount of reservable memory in bytes. |
StatsEventCPU ¶
Represents CPU Stats.
Attributes:
| Name | Type | Description |
|---|---|---|
cores |
int
|
The number of CPU cores available on the node. |
system_load |
float
|
The system load of the node. |
lavalink_load |
float
|
The load of Lavalink on the node. |
StatsEventFrames ¶
Represents Frame Stats.
Attributes:
| Name | Type | Description |
|---|---|---|
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. |
Plugin Events¶
ExtraEventPayload ¶
Payload received in the :func:on_revvlink_extra_event event.
This payload is created when an Unknown and Unhandled event is
received from Lavalink, most likely via
a plugin.
See the appropriate documentation of the plugin for the data sent with these events.
Attributes:
| Name | Type | Description |
|---|---|---|
node |
:class:`~revvlink.Node`
|
The node that the event pertains to. |
player |
:class:`~revvlink.Player` | None
|
The player associated with this event. Could be None. |
data |
dict[str, Any]
|
The raw data sent from Lavalink for this event. |