Event Reference

Through the Client.event() decorator, you can subscribe to realtime events that the library dispatches. This page lists the various events and their parameters.

Global Events

backtracked.on_ready()

Called when the websocket connection was successfully established. Usually this call is used exclusively for joining rooms.

backtracked.on_joined_room(room)

Emitted when a room is successfully joined.

Parameters

roomRoom that was joined in this event.

Room Events

backtracked.on_member_presence(room, user)

Emitted when a user in a room changes presence.

Parameters
  • roomRoom that this event occurred in.

  • userUser that changed presence.

backtracked.on_chat(message)

Emitted when a user sends a chat message in a joined room. You can access the room and user via fields on the Message object.

Parameters

messageMessage that was received.

backtracked.on_chat_delete(message)

Emitted when a message is deleted. This does not remove the message from the local cache. Message.deleted will be True.

Parameters

messageMessage which was deleted.

backtracked.on_dub(song, user, dubtype)

Emitted when a user “dubs” a song. (In practice, this is always the current song.) You can get the type of the dub via the dubtype parameter.

Parameters
  • songSong which was dubbed.

  • userUser who dubbed.

  • dubtypestr representing the type of dub in this event.

backtracked.on_playlist_song_add(song)

Emitted when a new song is added to the current room queue.

Parameters

songSong object representing the item that was added.

backtracked.on_member_join(member)

Emitted when a user joins a room.

Parameters

memberMember object representing the user’s room state.

backtracked.on_member_update(member)

Emitted when a member of a room changes state in some way.

Parameters

memberMember that changed state.

User Events

When subscribed to user rooms via User.open_conversation(), you can receive user-specific events.

backtracked.on_private_message(conversation)

Emitted when a user sends you a private message. Unlike on_chat(), this does not fire for the connected client’s messages.

Parameters

conversationConversation which the new message was sent in.