Event names mostly correspond with the event names that are returned from a dispatch by Discord.
connect
(ctx: EventContext)¶Called as soon as READY
is received on the gateway. This can be used
to change status immediately after authentication, for example.
ready
(ctx: EventContext)¶Called when a bot has finished streaming guilds and chunked all large guilds successfully. This is different to Discord’s READY event, which fires as soon as the connection has opened.
resumed
(ctx: EventContext, events_replayed: int)¶Called when a bot has resumed the connection. The argument is the number of events replayed since losing connection.
guild_available
(ctx: EventContext, guild: Guild)¶Called when a previously unavailable guild becomes available. This is
not called when Unavailable Guilds during streaming become available.
For that, use guild_streamed()
.
guild_join
(ctx: EventContext, guild: Guild)¶Called when the bot joins a new guild. This is not called when
guilds are streaming. For that, use guild_streamed()
.
guild_streamed
(ctx: EventContext, guild: Guild)¶Called when a guild is streamed during login.
guild_chunk
(ctx: EventContext, guild: Guild, member_count: int)¶Called when a guild receives a Guild Member Chunk.
guild_sync(ctx: EventContext, guild: Guild, member_count: int, \
presence_count: int)
Called when a guild receives a Guild Sync.
Note
This is a user-account only event.
Called when a guild goes unavailable.
guild_leave
(ctx: EventContext, guild: Guild)¶Called when the bot leaves a guild.
guild_update
(ctx: EventContext, old_guild: Guild, new_guild: Guild)¶Called when a guild updates. This could be from the name changing, icon changing, etc.
guild_emojis_update
(ctx: EventContext, old_guild: Guild, new_guild: Guild)¶Called when the emojis update in a guild.
user_settings_update
(ctx: EventContext, old_settings: UserSettings, new_settings: UserSettings)¶Called when a user’s settings update.
Note
This is a user-account only event.
friend_update
(ctx: EventContext, friend: RelationshipUser)¶Called when a friend updates (name, presence).
Note
This is a user-account only event.
relationship_add
(ctx: EventContext, user: RelationshipUser)¶Called when a relationship is added.
relationship_remove
(ctx: EventContext, user: RelationshipUser)¶Called when a relationship is removed.
member_update
(ctx: EventContext, old_member: Member, new_member: Member)¶Called when a guild member updates. This could be from typing, roles/nick updating, or game changing.
user_typing
(ctx: EventContext, channel: Channel, user: User)¶Called when a user is typing (in a private or group DM).
member_typing
(ctx: EventContext, channel: Channel, user: User)¶Called when a member is typing (in a guild).
message_create
(ctx: EventContext, message: Message)¶Called when a message is created.
message_edit
(ctx: EventContext, old_message: Message, new_message: Message)¶Called when a message’s content is edited.
Warning
This event will only be called if a message that the bot has previously seen is in the message cache. Otherwise, the bot will silently eat the event.
message_update
(ctx: EventContext, old_message: Message, new_message: Message)¶Called when a message is updated (a new embed is added, content is edited, etc).
This will fire on newly added embeds; if you don’t want this use
message_edit
instead.
Warning
This event will only be called if a message that the bot has previously seen is in the message cache. Otherwise, the bot will silently eat the event.
message_delete
(ctx: EventContext, message: Message)¶Called when a message is deleted.
Warning
This event will only be called if a message that the bot has previously seen is in the message cache. Otherwise, the bot will silently eat the event.
message_delete_bulk
(ctx: EventContext, messages: List[Message])¶Called when messages are bulk deleted.
Warning
This event will only be called if any messages that the bot has previously seen is in the message cache. Otherwise, the bot will silently eat the event.
message_reaction_add
(ctx: EventContext, message: Message, author: Union[Member, User], reaction)¶Called when a message is reacted to.
message_reaction_remove
(ctx: EventContext, message, author, reaction)¶Called when a reaction is removed from a message.
message_ack
(ctx: EventContext, channel: Channel, message: Message)¶Called when a message is ACK’d.
Note
This is a user-account only event.
member_join
(ctx: EventContext, member: Member)¶Called when a member is added to a guild.
member_leave
(ctx: EventContext, member: Member)¶Called when a member is removed from a guild.
user_ban
(ctx: EventContext, user: User)¶Called when a user is banned from a guild.
member_ban
(ctx: EventContext, member: Member)¶Called when a member is banned from a guild.
user_unban(ctx: EventContext, user: User):
Called when a user is unbanned.
Note
There is no member_unban event as members cannot be unbanned.
channel_create
(ctx: EventContext, channel: Channel)¶Called when a channel is created.
channel_update
(ctx: EventContext, old_channel: Channel, new_channel: Channel)¶Called when a channel is updated.
channel_delete
(ctx: EventContext, channel: Channel)¶Called when a channel is deleted.
group_user_add
(ctx: EventContext, channel: Channel, user: User)¶Called when a user is added to a group.
group_user_remove
(ctx: EventContext, channel: Channel, user: User)¶Called when a user is removed from a group.
role_create
(ctx: EventContext, role: Role)¶Called when a role is created.
role_update
(ctx: EventContext, old_role: Role, new_role: Role)¶Called when a role is updated.
role_delete
(ctx: EventContext, role: Role)¶Called when a role is deleted.
voice_state_update
(ctx: EventContext, member, old_voice_state, new_voice_state)¶Called when a member’s voice state updates.
These events are low-level events; they deal with raw data received from the websocket connection.
gateway_message_received
(ctx: EventContext, data)¶Called when a message is received on the websocket.
Warning
The data is the RAW DATA passed from the websocket. It could be compressed data; it is undecoded.
This event is often not useful; see gateway_event_received()
or
gateway_dispatch_received()
for better functions.
gateway_event_received
(ctx: EventContext, data: dict)¶Called when an event is received on the websocket, after decompressing and decoding.
gateway_hello
(ctx: EventContext, trace: List[str])¶Called when HELLO is received.
gateway_heartbeat
(ctx: EventContext, stats)¶Called when a heartbeat is sent.
gateway_heartbeat_ack
(ctx: EventContext)¶Called when Discord ACKs a heartbeat we’ve sent.
gateway_heartbeat_received
(ctx: EventContext)¶Called when Discord asks us to send a heartbeat.
gateway_invalidate_session
(ctx: EventContext, resume: bool)¶Called when Discord invalidates our session.
gateway_reconnect_received
(ctx: EventContext)¶Called when Discord asks us to send a reconnect.
gateway_dispatch_received
(ctx: EventContext, dispatch: dict)¶Called when an event is dispatched.