Skip to content

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

NodeReadyEventPayload(
    node: Node, resumed: bool, session_id: str
)

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

NodeDisconnectedEventPayload(node: Node)

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

TrackStartEventPayload(
    player: Player | None, track: Playable
)

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:~revvlink.Player.play or inserted into the queue, with all your additional attributes assigned. Could be None.


TrackEndEventPayload

TrackEndEventPayload(
    player: Player | None, track: Playable, reason: str
)

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:~revvlink.Player.play or inserted into the queue, with all your additional attributes assigned. Could be None.


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

TrackStuckEventPayload(
    player: Player | None, track: Playable, threshold: int
)

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

WebsocketClosedEventPayload(
    player: Player | None,
    code: int,
    reason: str,
    by_remote: bool,
)

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

True if discord closed the websocket. False otherwise.


PlayerUpdateEventPayload

PlayerUpdateEventPayload(
    player: Player | None, state: PlayerState
)

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

StatsEventPayload(data: StatsOP)

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:revvlink.StatsEventMemory

cpu :class:`revvlink.StatsEventCPU`

See Also: :class:revvlink.StatsEventCPU

frames :class:`revvlink.StatsEventFrames` | None

See Also: :class:revvlink.StatsEventFrames. This could be None.


StatsEventMemory

StatsEventMemory(data: MemoryStats)

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

StatsEventCPU(data: CPUStats)

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

StatsEventFrames(data: FrameStats)

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

ExtraEventPayload(
    *,
    node: Node,
    player: Player | None,
    data: dict[str, Any],
)

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.

Note

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.