Events

This page outlines the events that can be listened to by the mutiny.Client.

To register a function (event listener) that listens to an event, you can use the @Client.listen() decorator or the Client.add_listener() method.

Event

class mutiny.events.Event[source]

Base class for all event classes.

raw_data

The raw model data, as returned by the API.

Type

dict[str, Any]

type

The type of the attachment.

Note

Checking using type() or isinstance() should be preferred over using this attribute.

ErrorEvent

final class mutiny.events.ErrorEvent[source]

An error occurred which meant that the client could not authenticate.

error

A raw error id (type).

Type

str

AuthenticatedEvent

final class mutiny.events.AuthenticatedEvent[source]

The Authenticated event. This indicates that server has authenticated your connection and you will shortly start receiving data.

PongEvent

final class mutiny.events.PongEvent[source]

The Pong event. This indicates that the server received a Ping event from the client.

Considering that the client uses websocket ping frames rather than the Ping event, the client will probably never receive this event.

ReadyEvent

final class mutiny.events.ReadyEvent[source]

The event sent by the server after authentication. This is handled by the gateway and should generally not be listened to.

MessageEvent

final class mutiny.events.MessageEvent[source]

The event sent when a message is received.

message

The received message.

Type

Message

MessageUpdateEvent

final class mutiny.events.MessageUpdateEvent[source]

The event sent when a message is edited or otherwise updated.

data: dict

A raw partial message dictionary containing the changed fields of the message.

MessageDeleteEvent

final class mutiny.events.MessageDeleteEvent[source]

The event sent when a message has been deleted.

message_id: str

The ID of the deleted message.

channel_id: str

The ID of the channel the deleted message was sent in.

ChannelCreateEvent

final class mutiny.events.ChannelCreateEvent[source]

The event sent when a channel is created.

channel_id

The ID of the created channel.

Type

str

server_id

The ID of the server this channel was created in, if any.

Type

Optional[str]

channel

The created channel.

Type

Channel

ChannelUpdateEvent

final class mutiny.events.ChannelUpdateEvent[source]

The event sent when the channel details are updated.

channel_id

The ID of the updated channel.

Type

str

channel

The updated channel.

Type

Channel

data

A raw partial channel dictionary containing the changed fields of the channel.

Type

dict[str, Any]

clear

A raw string containing the name of the cleared field on the channel, if any.

Type

Optional[str]

ChannelDeleteEvent

final class mutiny.events.ChannelDeleteEvent[source]

The event sent when the channel has been deleted.

channel_id

The ID of the deleted channel.

Type

str

channel

The deleted channel.

Type

Optional[Channel]

ChannelGroupJoinEvent

final class mutiny.events.ChannelGroupJoinEvent[source]

The event sent when a user has joined a group channel.

channel_id

The ID of the channel.

Type

str

channel

The channel.

Type

Channel

user_id

The ID of the user that joined the channel.

Type

str

ChannelGroupLeaveEvent

final class mutiny.events.ChannelGroupLeaveEvent[source]

The event sent when a user has left a group channel.

channel_id

The ID of the channel.

Type

str

channel

The channel.

Type

Channel

user_id

The ID of the user that left the channel.

Type

str

ChannelStartTypingEvent

final class mutiny.events.ChannelStartTypingEvent[source]

The event sent when a user has started typing in a channel.

channel_id: str

The ID of the channel.

channel: Channel

The channel.

ChannelStopTypingEvent

final class mutiny.events.ChannelStopTypingEvent[source]

The event sent when a user has stopped typing in a channel.

channel_id: str

The ID of the channel.

channel: Channel

The channel.

ChannelAckEvent

final class mutiny.events.ChannelAckEvent[source]

The event sent when the client user has acknowledged new messages in a channel up to the given message ID.

channel_id: str

The ID of the channel.

channel: Channel

The channel.

user_id: str

The ID of the client user.

message_id: str

The ID of the last acknowledged message.

ServerUpdateEvent

final class mutiny.events.ServerUpdateEvent[source]

The event sent when the server details are updated.

server_id

The ID of the updated server.

Type

str

server

The updated server.

Type

Server

data

A raw partial server dictionary containing the changed fields of the server.

Type

dict[str, Any]

clear

A raw string containing the name of the cleared field on the server, if any.

Type

Optional[str]

ServerDeleteEvent

final class mutiny.events.ServerDeleteEvent[source]

The event sent when the server has been deleted.

server_id

The ID of the deleted server.

Type

str

server

The deleted server.

Type

Server

ServerMemberUpdateEvent

final class mutiny.events.ServerMemberUpdateEvent[source]

The event sent when the server member details are updated.

server_id

The ID of the updated member’s server.

Type

str

server

The updated member’s server.

Type

Server

user_id

The ID of the updated member.

Type

str

data

A raw partial member dictionary containing the changed fields of the member.

Type

dict[str, Any]

clear

A raw string containing the name of the cleared field on the member, if any.

Type

Optional[str]

ServerMemberJoinEvent

final class mutiny.events.ServerMemberJoinEvent[source]

The event sent when a user joins a server.

server_id

The ID of the joined server.

Type

str

server

The joined server.

Type

Server

user_id

The ID of the user that joined the server.

Type

str

member

The member object for the newly joined user.

Type

Member

ServerMemberLeaveEvent

final class mutiny.events.ServerMemberLeaveEvent[source]

The event sent when a user leaves a server.

server_id

The ID of the server.

Type

str

server

The server.

Type

Server

user_id

The ID of the user that left the server.

Type

str

member

The member object for the user that left the server, if one was cached.

Type

Optional[Member]

ServerRoleUpdateEvent

final class mutiny.events.ServerRoleUpdateEvent[source]

The event sent when a server role has been updated or created.

server_id

The ID of the server.

Type

str

server

The server.

Type

Server

role_id

The ID of the created/updated role.

Type

str

role

The created/updated role.

Type

Role

data

A raw partial role dictionary containing the changed fields of the role.

Type

dict[str, Any]

clear

A raw string containing the name of the cleared field on the role, if any.

Type

Optional[str]

new

Whether this is a newly created role.

Type

bool

ServerRoleDeleteEvent

final class mutiny.events.ServerRoleDeleteEvent[source]

The event sent when a server role has been deleted.

server_id

The ID of the server.

Type

str

server

The server.

Type

Server

role_id

The ID of the deleted role.

Type

str

role

The deleted role.

Type

Role

UserUpdateEvent

final class mutiny.events.UserUpdateEvent[source]

The event sent when a user has been updated.

user_id

The ID of the updated user.

Type

str

data

A raw partial user dictionary containing the changed fields of the user.

Type

dict

clear

A raw string containing the name of the cleared field on the user, if any.

Type

Optional[str]

UserRelationshipEvent

final class mutiny.events.UserRelationshipEvent[source]

The event sent when the client user’s relationship with another user has changed.

self_id

The ID of the client user.

Type

str

user_id

The ID of the other user with whom the relationship has changed.

Type

str

status

The new relationship status.

Type

RelationshipStatus