disco.gateway.events
Constants
{'type': 'assign', 'targets': ['EVENTS_MAP'], 'value': {'keys': [], 'values': [], 'type': 'dict'}}
Classes
GatewayEventMeta
Inherits From ModelMeta
Functions
new(mcs, name, parents, dct)
GatewayEvent
Inherits From {'type': 'attribute', 'name': 'with_metaclass', 'value': 'six'}
The GatewayEvent class wraps various functionality for events passed to us over the gateway websocket, and serves as a simple proxy to inner values for some wrapped event-types (e.g. MessageCreate only contains a message, so we proxy all attributes to the inner message object).
Functions
from_dispatch(client, data)
Create a new GatewayEvent instance based on event data.
create(cls, obj, client)
Create this GatewayEvent class from data and the client.
getattr(self, name)
Ready
Inherits From GatewayEvent
Sent after the initial gateway handshake is complete. Contains data required for bootstrapping the client's states.
Attributes
| Name | Type | Description | 
|---|---|---|
| version | int | 
The gateway version. | 
| session_id | str | 
The session ID. | 
| user | :class:`disco.types.user.User` | 
The user object for the authed account. | 
| guilds | list[:class:`disco.types.guild.Guild` | 
All guilds this account is a member of. These are shallow guild objects. private_channels list[:class:`disco.types.channel.Channel`] All private channels (DMs) open for this account. | 
Resumed
Inherits From GatewayEvent
Sent after a resume completes.
GuildCreate
Inherits From GatewayEvent
Sent when a guild is joined, or becomes available.
Attributes
| Name | Type | Description | 
|---|---|---|
| guild | :class:`disco.types.guild.Guild` | 
The guild being created (e.g. joined) | 
| unavailable | bool | 
If false, this guild is coming online from a previously unavailable state, and if None, this is a normal guild join event. | 
Functions
created(self)
Shortcut property which is true when we actually joined the guild.
GuildUpdate
Inherits From GatewayEvent
Sent when a guild is updated.
Attributes
| Name | Type | Description | 
|---|---|---|
| guild | :class:`disco.types.guild.Guild` | 
The updated guild object. | 
GuildDelete
Inherits From GatewayEvent
Sent when a guild is deleted, left, or becomes unavailable.
Attributes
| Name | Type | Description | 
|---|---|---|
| id | snowflake | 
The ID of the guild being deleted. | 
| unavailable | bool | 
If true, this guild is becoming unavailable, if None this is a normal guild leave event. | 
Functions
deleted(self)
Shortcut property which is true when we actually have left the guild.
ChannelCreate
Inherits From GatewayEvent
Sent when a channel is created.
Attributes
| Name | Type | Description | 
|---|---|---|
| channel | :class:`disco.types.channel.Channel` | 
The channel which was created. | 
ChannelUpdate
Inherits From ChannelCreate
Sent when a channel is updated.
Attributes
| Name | Type | Description | 
|---|---|---|
| channel | :class:`disco.types.channel.Channel` | 
The channel which was updated. | 
ChannelDelete
Inherits From ChannelCreate
Sent when a channel is deleted.
Attributes
| Name | Type | Description | 
|---|---|---|
| channel | :class:`disco.types.channel.Channel` | 
The channel being deleted. | 
ChannelPinsUpdate
Inherits From GatewayEvent
Sent when a channel's pins are updated.
Attributes
| Name | Type | Description | 
|---|---|---|
| channel_id | snowflake | 
ID of the channel where pins where updated. | 
| last_pin_timestap | datetime | 
The time the last message was pinned. | 
GuildBanAdd
Inherits From GatewayEvent
Sent when a user is banned from a guild.
Attributes
| Name | Type | Description | 
|---|---|---|
| guild_id | snowflake | 
The ID of the guild the user is being banned from. | 
| user | :class:`disco.types.user.User` | 
The user being banned from the guild. | 
Functions
guild(self)
GuildBanRemove
Inherits From GuildBanAdd
Sent when a user is unbanned from a guild.
Attributes
| Name | Type | Description | 
|---|---|---|
| guild_id | snowflake | 
The ID of the guild the user is being unbanned from. | 
| user | :class:`disco.types.user.User` | 
The user being unbanned from the guild. | 
Functions
guild(self)
GuildEmojisUpdate
Inherits From GatewayEvent
Sent when a guild's emojis are updated.
Attributes
| Name | Type | Description | 
|---|---|---|
| guild_id | snowflake | 
The ID of the guild the emojis are being updated in. | 
| emojis | list[:class:`disco.types.guild.Emoji`] | 
The new set of emojis for the guild | 
GuildIntegrationsUpdate
Inherits From GatewayEvent
Sent when a guild's integrations are updated.
Attributes
| Name | Type | Description | 
|---|---|---|
| guild_id | snowflake | 
The ID of the guild integrations where updated in. | 
GuildMembersChunk
Inherits From GatewayEvent
Sent in response to a member's chunk request.
Attributes
| Name | Type | Description | 
|---|---|---|
| guild_id | snowflake | 
The ID of the guild this member chunk is for. | 
| members | list[:class:`disco.types.guild.GuildMember`] | 
The chunk of members. | 
Functions
guild(self)
GuildMemberAdd
Inherits From GatewayEvent
Sent when a user joins a guild.
Attributes
| Name | Type | Description | 
|---|---|---|
| member | :class:`disco.types.guild.GuildMember` | 
The member that has joined the guild. | 
GuildMemberRemove
Inherits From GatewayEvent
Sent when a user leaves a guild (via leaving, kicking, or banning).
Attributes
| Name | Type | Description | 
|---|---|---|
| guild_id | snowflake | 
The ID of the guild the member left from. | 
| user | :class:`disco.types.user.User` | 
The user who was removed from the guild. | 
Functions
guild(self)
GuildMemberUpdate
Inherits From GatewayEvent
Sent when a guilds member is updated.
Attributes
| Name | Type | Description | 
|---|---|---|
| member | :class:`disco.types.guild.GuildMember` | 
The member being updated | 
GuildRoleCreate
Inherits From GatewayEvent
Sent when a role is created.
Attributes
| Name | Type | Description | 
|---|---|---|
| guild_id | snowflake | 
The ID of the guild where the role was created. | 
| role | :class:`disco.types.guild.Role` | 
The role that was created. | 
Functions
guild(self)
GuildRoleUpdate
Inherits From GuildRoleCreate
Sent when a role is updated.
Attributes
| Name | Type | Description | 
|---|---|---|
| guild_id | snowflake | 
The ID of the guild where the role was created. | 
| role | :class:`disco.types.guild.Role` | 
The role that was created. | 
Functions
guild(self)
GuildRoleDelete
Inherits From GatewayEvent
Sent when a role is deleted.
Attributes
| Name | Type | Description | 
|---|---|---|
| guild_id | snowflake | 
The ID of the guild where the role is being deleted. | 
| role_id | snowflake | 
The id of the role being deleted. | 
Functions
guild(self)
MessageCreate
Inherits From GatewayEvent
Sent when a message is created.
Attributes
| Name | Type | Description | 
|---|---|---|
| message | :class:`disco.types.message.Message` | 
The message being created. | 
MessageUpdate
Inherits From MessageCreate
Sent when a message is updated/edited.
Attributes
| Name | Type | Description | 
|---|---|---|
| message | :class:`disco.types.message.Message` | 
The message being updated. | 
MessageDelete
Inherits From GatewayEvent
Sent when a message is deleted.
Attributes
| Name | Type | Description | 
|---|---|---|
| id | snowflake | 
The ID of message being deleted. | 
| channel_id | snowflake | 
The ID of the channel the message was deleted in. | 
Functions
channel(self)
guild(self)
MessageDeleteBulk
Inherits From GatewayEvent
Sent when multiple messages are deleted from a channel.
Attributes
| Name | Type | Description | 
|---|---|---|
| channel_id | snowflake | 
The channel the messages are being deleted in. | 
| ids | list[snowflake] | 
List of messages being deleted in the channel. | 
Functions
channel(self)
guild(self)
PresenceUpdate
Inherits From GatewayEvent
Sent when a user's presence is updated.
Attributes
| Name | Type | Description | 
|---|---|---|
| presence | :class:`disco.types.user.Presence` | 
The updated presence object. | 
| guild_id | snowflake | 
The guild this presence update is for. | 
| roles | list[snowflake] | 
List of roles the user from the presence is part of. | 
Functions
guild(self)
TypingStart
Inherits From GatewayEvent
Sent when a user begins typing in a channel.
Attributes
| Name | Type | Description | 
|---|---|---|
| channel_id | snowflake | 
The ID of the channel where the user is typing. | 
| user_id | snowflake | 
The ID of the user who is typing. | 
| timestamp | datetime | 
When the user started typing. | 
VoiceStateUpdate
Inherits From GatewayEvent
Sent when a users voice state changes.
Attributes
| Name | Type | Description | 
|---|---|---|
| state | :class:`disco.models.voice.VoiceState` | 
The voice state which was updated. | 
VoiceServerUpdate
Inherits From GatewayEvent
Sent when a voice server is updated.
Attributes
| Name | Type | Description | 
|---|---|---|
| token | str | 
The token for the voice server. | 
| endpoint | str | 
The endpoint for the voice server. | 
| guild_id | snowflake | 
The guild ID this voice server update is for. | 
WebhooksUpdate
Inherits From GatewayEvent
Sent when a channels webhooks are updated.
Attributes
| Name | Type | Description | 
|---|---|---|
| channel_id | snowflake | 
The channel ID this webhooks update is for. | 
| guild_id | snowflake | 
The guild ID this webhooks update is for. | 
MessageReactionAdd
Inherits From GatewayEvent
Sent when a reaction is added to a message.
Attributes
| Name | Type | Description | 
|---|---|---|
| channel_id | snowflake | 
The channel ID the message is in. | 
| messsage_id | snowflake | 
The ID of the message for which the reaction was added too. | 
| user_id | snowflake | 
The ID of the user who added the reaction. | 
| emoji | :class:`disco.types.message.MessageReactionEmoji` | 
The emoji which was added. | 
Functions
delete(self)
channel(self)
guild(self)
MessageReactionRemove
Inherits From GatewayEvent
Sent when a reaction is removed from a message.
Attributes
| Name | Type | Description | 
|---|---|---|
| channel_id | snowflake | 
The channel ID the message is in. | 
| messsage_id | snowflake | 
The ID of the message for which the reaction was removed from. | 
| user_id | snowflake | 
The ID of the user who originally added the reaction. | 
| emoji | :class:`disco.types.message.MessageReactionEmoji` | 
The emoji which was removed. | 
Functions
channel(self)
guild(self)
MessageReactionRemoveAll
Inherits From GatewayEvent
Sent when all reactions are removed from a message.
Attributes
| Name | Type | Description | 
|---|---|---|
| channel_id | snowflake | 
The channel ID the message is in. | 
| message_id | snowflake | 
The ID of the message for which the reactions where removed from. |