Events¶
This section documents events related to the main library.
What are events?¶
So, what are events anyway? Most of the Client
application cycle is based on events - special “notifications” usually sent by Discord
to notify client about certain actions like message deletion, emoji creation, member nickname updates, etc.
This library provides a few ways to register an event handler or event listener — a special function which will listen for specific types of events — which allows you to take action based on certain events.
The first way to create an event handler is through the use of the Client.event()
decorator.
Note that these are unique, which means you can only have one of
each type (i.e. only one on_message
, one on_member_ban
, etc.):
client = disnake.Client(...)
@client.event
async def on_message(message):
if message.author.bot:
return
if message.content.startswith('$hello'):
await message.reply(f'Hello, {message.author}!')
Another way is through subclassing Client
and overriding the specific events,
which has essentially the same effect as the Client.event()
decorator. For example:
class MyClient(disnake.Client):
async def on_message(self, message):
if message.author.bot:
return
if message.content.startswith('$hello'):
await message.reply(f'Hello, {message.author}!')
A separate way is through the use of an event listener. These are similar to the event handlers
described above, but allow you to have as many listeners of the same type as you want.
You can register listeners using the Client.listen()
decorator or through the Client.add_listener()
method. Similarly you can remove a listener using the Client.remove_listener()
method.
@client.listen()
async def on_message(message: disnake.Message):
if message.author.bot:
return
if message.content.startswith('$hello'):
await message.reply(f'Hello, {message.author}')
async def my_on_ready():
print(f'Logged in as {client.user}')
client.add_listener(my_on_ready, 'on_ready')
Lastly, Client.wait_for()
is a single-use event handler to wait for
something to happen in more specific scenarios:
@client.event
async def on_message(message):
if message.content.startswith('$greet'):
channel = message.channel
await channel.send('Say hello!')
def check(m):
return m.content == 'hello' and m.channel == channel
# wait for a message that passes the check
msg = await client.wait_for('message', check=check)
await channel.send(f'Hello {msg.author}!')
Note
Events can be sent not only by Discord. For instance, if you use the commands extension, you’ll also receive various events related to your commands’ execution process.
If an event handler raises an exception, on_error()
will be called
to handle it, which defaults to printing a traceback and ignoring the exception.
Warning
Every event handler/listener must be a coroutine. In order to turn a function into a coroutine, they must be async def
functions.
Reference¶
Client¶
This section documents events related to Client
and its connectivity to Discord.
- disnake.on_connect()¶
Called when the client has successfully connected to Discord. This is not the same as the client being fully prepared, see
on_ready()
for that.The warnings on
on_ready()
also apply.
- disnake.on_disconnect()¶
Called when the client has disconnected from Discord, or a connection attempt to Discord has failed. This could happen either through the internet being disconnected, explicit calls to close, or Discord terminating the connection one way or the other.
This function can be called many times without a corresponding
on_connect()
call.
- disnake.on_error(event, *args, **kwargs)¶
Usually when an event raises an uncaught exception, a traceback is printed to stderr and the exception is ignored. If you want to change this behaviour and handle the exception for whatever reason yourself, this event can be overridden. Which, when done, will suppress the default action of printing the traceback.
The information of the exception raised and the exception itself can be retrieved with a standard call to
sys.exc_info()
.If you want exception to propagate out of the
Client
class you can define anon_error
handler consisting of a single empty raise statement. Exceptions raised byon_error
will not be handled in any way byClient
.Note
on_error
will only be dispatched toClient.event()
.It will not be received by
Client.wait_for()
and listeners such asClient.listen()
, orlistener()
.- Parameters:
event (
str
) – The name of the event that raised the exception.args – The positional arguments for the event that raised the exception.
kwargs – The keyword arguments for the event that raised the exception.
- disnake.on_gateway_error(event, data, shard_id, exc)¶
When a (known) gateway event cannot be parsed, a traceback is printed to stderr and the exception is ignored by default. This should generally not happen and is usually either a library issue, or caused by a breaking API change.
To change this behaviour, for example to completely stop the bot, this event can be overridden.
This can also be disabled completely by passing
enable_gateway_error_handler=False
to the client on initialization, restoring the pre-v2.6 behavior.New in version 2.6.
Note
on_gateway_error
will only be dispatched toClient.event()
.It will not be received by
Client.wait_for()
and listeners such asClient.listen()
, orlistener()
.Note
This will not be dispatched for exceptions that occur while parsing
READY
andRESUMED
event payloads, as exceptions in these events are considered fatal.
- disnake.on_ready()¶
Called when the client is done preparing the data received from Discord. Usually after login is successful and the
Client.guilds
and co. are filled up.Warning
This function is not guaranteed to be the first event called. Likewise, this function is not guaranteed to only be called once. This library implements reconnection logic and thus will end up calling this event whenever a RESUME request fails.
- disnake.on_resumed()¶
Called when the client has resumed a session.
- disnake.on_shard_connect(shard_id)¶
Similar to
on_connect()
except used byAutoShardedClient
to denote when a particular shard ID has connected to Discord.New in version 1.4.
- Parameters:
shard_id (
int
) – The shard ID that has connected.
- disnake.on_shard_disconnect(shard_id)¶
Similar to
on_disconnect()
except used byAutoShardedClient
to denote when a particular shard ID has disconnected from Discord.New in version 1.4.
- Parameters:
shard_id (
int
) – The shard ID that has disconnected.
- disnake.on_shard_ready(shard_id)¶
Similar to
on_ready()
except used byAutoShardedClient
to denote when a particular shard ID has become ready.- Parameters:
shard_id (
int
) – The shard ID that is ready.
- disnake.on_shard_resumed(shard_id)¶
Similar to
on_resumed()
except used byAutoShardedClient
to denote when a particular shard ID has resumed a session.New in version 1.4.
- Parameters:
shard_id (
int
) – The shard ID that has resumed.
- disnake.on_socket_event_type(event_type)¶
Called whenever a websocket event is received from the WebSocket.
This is mainly useful for logging how many events you are receiving from the Discord gateway.
New in version 2.0.
- Parameters:
event_type (
str
) – The event type from Discord that is received, e.g.'READY'
.
- disnake.on_socket_raw_receive(msg)¶
Called whenever a message is completely received from the WebSocket, before it’s processed and parsed. This event is always dispatched when a complete message is received and the passed data is not parsed in any way.
This is only really useful for grabbing the WebSocket stream and debugging purposes.
This requires setting the
enable_debug_events
setting in theClient
.Note
This is only for the messages received from the client WebSocket. The voice WebSocket will not trigger this event.
- Parameters:
msg (
str
) – The message passed in from the WebSocket library.
- disnake.on_socket_raw_send(payload)¶
Called whenever a send operation is done on the WebSocket before the message is sent. The passed parameter is the message that is being sent to the WebSocket.
This is only really useful for grabbing the WebSocket stream and debugging purposes.
This requires setting the
enable_debug_events
setting in theClient
.Note
This is only for the messages sent from the client WebSocket. The voice WebSocket will not trigger this event.
Channels/Threads¶
This section documents events related to Discord channels and threads.
- disnake.on_guild_channel_delete(channel)¶
- disnake.on_guild_channel_create(channel)¶
Called whenever a guild channel is deleted or created.
Note that you can get the guild from
guild
.This requires
Intents.guilds
to be enabled.- Parameters:
channel (
abc.GuildChannel
) – The guild channel that got created or deleted.
- disnake.on_guild_channel_update(before, after)¶
Called whenever a guild channel is updated. e.g. changed name, topic, permissions.
This requires
Intents.guilds
to be enabled.- Parameters:
before (
abc.GuildChannel
) – The updated guild channel’s old info.after (
abc.GuildChannel
) – The updated guild channel’s new info.
- disnake.on_guild_channel_pins_update(channel, last_pin)¶
Called whenever a message is pinned or unpinned from a guild channel.
This requires
Intents.guilds
to be enabled.- Parameters:
channel (Union[
abc.GuildChannel
,Thread
]) – The guild channel that had its pins updated.last_pin (Optional[
datetime.datetime
]) – The latest message that was pinned as an aware datetime in UTC. Could beNone
.
- disnake.on_private_channel_update(before, after)¶
Called whenever a private group DM is updated. e.g. changed name or topic.
This requires
Intents.messages
to be enabled.- Parameters:
before (
GroupChannel
) – The updated group channel’s old info.after (
GroupChannel
) – The updated group channel’s new info.
- disnake.on_private_channel_pins_update(channel, last_pin)¶
Called whenever a message is pinned or unpinned from a private channel.
- Parameters:
channel (
abc.PrivateChannel
) – The private channel that had its pins updated.last_pin (Optional[
datetime.datetime
]) – The latest message that was pinned as an aware datetime in UTC. Could beNone
.
- disnake.on_thread_create(thread)¶
Called whenever a thread is created.
Note that you can get the guild from
Thread.guild
.This requires
Intents.guilds
to be enabled.Note
This only works for threads created in channels the bot already has access to, and only for public threads unless the bot has the
manage_threads
permission.New in version 2.5.
- Parameters:
thread (
Thread
) – The thread that got created.
- disnake.on_thread_update(before, after)¶
Called when a thread is updated. If the thread is not found in the internal thread cache, then this event will not be called. Consider using
on_raw_thread_update()
which will be called regardless of the cache.This requires
Intents.guilds
to be enabled.New in version 2.0.
- disnake.on_thread_delete(thread)¶
Called when a thread is deleted. If the thread is not found in the internal thread cache, then this event will not be called. Consider using
on_raw_thread_delete()
instead.Note that you can get the guild from
Thread.guild
.This requires
Intents.guilds
to be enabled.New in version 2.0.
- Parameters:
thread (
Thread
) – The thread that got deleted.
- disnake.on_thread_join(thread)¶
Called whenever the bot joins a thread or gets access to a thread (for example, by gaining access to the parent channel).
Note that you can get the guild from
Thread.guild
.This requires
Intents.guilds
to be enabled.Note
This event will not be called for threads created by the bot or threads created on one of the bot’s messages.
New in version 2.0.
Changed in version 2.5: This is no longer being called when a thread is created, see
on_thread_create()
instead.- Parameters:
thread (
Thread
) – The thread that got joined.
- disnake.on_thread_remove(thread)¶
Called whenever a thread is removed. This is different from a thread being deleted.
Note that you can get the guild from
Thread.guild
.This requires
Intents.guilds
to be enabled.Warning
Due to technical limitations, this event might not be called as soon as one expects. Since the library tracks thread membership locally, the API only sends updated thread membership status upon being synced by joining a thread.
New in version 2.0.
- Parameters:
thread (
Thread
) – The thread that got removed.
- disnake.on_thread_member_join(member)¶
- disnake.on_thread_member_remove(member)¶
Called when a
ThreadMember
leaves or joins aThread
.You can get the thread a member belongs in by accessing
ThreadMember.thread
.On removal events, if the member being removed is not found in the internal cache, then this event will not be called. Consider using
on_raw_thread_member_remove()
instead.This requires
Intents.members
to be enabled.New in version 2.0.
- Parameters:
member (
ThreadMember
) – The member who joined or left.
- disnake.on_raw_thread_member_remove(payload)¶
Called when a
ThreadMember
leavesThread
. Unlikeon_thread_member_remove()
, this is called regardless of the thread member cache.You can get the thread a member belongs in by accessing
ThreadMember.thread
.This requires
Intents.members
to be enabled.New in version 2.5.
- Parameters:
payload (
RawThreadMemberRemoveEvent
) – The raw event payload data.
- disnake.on_raw_thread_update(after)¶
Called whenever a thread is updated. Unlike
on_thread_update()
, this is called regardless of the state of the internal thread cache.This requires
Intents.guilds
to be enabled.New in version 2.5.
- Parameters:
thread (
Thread
) – The updated thread.
- disnake.on_raw_thread_delete(payload)¶
Called whenever a thread is deleted. Unlike
on_thread_delete()
, this is called regardless of the state of the internal thread cache.Note that you can get the guild from
Thread.guild
.This requires
Intents.guilds
to be enabled.New in version 2.5.
- Parameters:
payload (
RawThreadDeleteEvent
) – The raw event payload data.
- disnake.on_webhooks_update(channel)¶
Called whenever a webhook is created, modified, or removed from a guild channel.
This requires
Intents.webhooks
to be enabled.- Parameters:
channel (
abc.GuildChannel
) – The channel that had its webhooks updated.
Guilds¶
This section documents events related to Discord guilds.
General¶
- disnake.on_guild_join(guild)¶
Called when a
Guild
is either created by theClient
or when theClient
joins a guild.This requires
Intents.guilds
to be enabled.- Parameters:
guild (
Guild
) – The guild that was joined.
- disnake.on_guild_remove(guild)¶
Called when a
Guild
is removed from theClient
.This happens through, but not limited to, these circumstances:
The client got banned.
The client got kicked.
The client left the guild.
The client or the guild owner deleted the guild.
In order for this event to be invoked then the
Client
must have been part of the guild to begin with. (i.e. it is part ofClient.guilds
)This requires
Intents.guilds
to be enabled.- Parameters:
guild (
Guild
) – The guild that got removed.
- disnake.on_guild_update(before, after)¶
Called when a
Guild
updates, for example:Changed name
Changed AFK channel
Changed AFK timeout
etc
This requires
Intents.guilds
to be enabled.
- disnake.on_guild_available(guild)¶
Called when a guild becomes available or unavailable. The guild must have existed in the
Client.guilds
cache.This requires
Intents.guilds
to be enabled.- Parameters:
guild – The
Guild
that has changed availability.
Application Commands¶
- disnake.on_application_command_permissions_update(permissions)¶
Called when the permissions of an application command or the application-wide command permissions are updated.
Note that this will also be called when permissions of other applications change, not just this application’s permissions.
New in version 2.5.
- Parameters:
permissions (
GuildApplicationCommandPermissions
) – The updated permission object.
Audit Logs¶
- disnake.on_audit_log_entry_create(entry)¶
Called when an audit log entry is created. You must have the
view_audit_log
permission to receive this.This requires
Intents.moderation
to be enabled.Warning
This scope of data in this gateway event is limited, which means it is much more reliant on the cache than
Guild.audit_logs()
. Because of this,AuditLogEntry.target
andAuditLogEntry.user
will frequently be of typeObject
instead of the respective model.New in version 2.8.
- Parameters:
entry (
AuditLogEntry
) – The audit log entry that was created.
AutoMod¶
- disnake.on_automod_action_execution(execution)¶
Called when an auto moderation action is executed due to a rule triggering for a particular event. You must have the
manage_guild
permission to receive this.The guild this action has taken place in can be accessed using
AutoModActionExecution.guild
.This requires
Intents.automod_execution
to be enabled.In addition,
Intents.message_content
must be enabled to receive non-empty values forAutoModActionExecution.content
andAutoModActionExecution.matched_content
.Note
This event will fire once per executed
AutoModAction
, which means it will run multiple times when a rule is triggered, if that rule has multiple actions defined.New in version 2.6.
- Parameters:
execution (
AutoModActionExecution
) – The auto moderation action execution data.
- disnake.on_automod_rule_create(rule)¶
Called when an
AutoModRule
is created. You must have themanage_guild
permission to receive this.This requires
Intents.automod_configuration
to be enabled.New in version 2.6.
- Parameters:
rule (
AutoModRule
) – The auto moderation rule that was created.
- disnake.on_automod_rule_update(rule)¶
Called when an
AutoModRule
is updated. You must have themanage_guild
permission to receive this.This requires
Intents.automod_configuration
to be enabled.New in version 2.6.
- Parameters:
rule (
AutoModRule
) – The auto moderation rule that was updated.
- disnake.on_automod_rule_delete(rule)¶
Called when an
AutoModRule
is deleted. You must have themanage_guild
permission to receive this.This requires
Intents.automod_configuration
to be enabled.New in version 2.6.
- Parameters:
rule (
AutoModRule
) – The auto moderation rule that was deleted.
Emojis¶
- disnake.on_guild_emojis_update(guild, before, after)¶
Called when a
Guild
adds or removesEmoji
.This requires
Intents.emojis_and_stickers
to be enabled.
Integrations¶
- disnake.on_guild_integrations_update(guild)¶
Called whenever an integration is created, modified, or removed from a guild.
This requires
Intents.integrations
to be enabled.New in version 1.4.
- Parameters:
guild (
Guild
) – The guild that had its integrations updated.
- disnake.on_integration_create(integration)¶
Called when an integration is created.
This requires
Intents.integrations
to be enabled.New in version 2.0.
- Parameters:
integration (
Integration
) – The integration that was created.
- disnake.on_integration_update(integration)¶
Called when an integration is updated.
This requires
Intents.integrations
to be enabled.New in version 2.0.
- Parameters:
integration (
Integration
) – The integration that was updated.
- disnake.on_raw_integration_delete(payload)¶
Called when an integration is deleted.
This requires
Intents.integrations
to be enabled.New in version 2.0.
- Parameters:
payload (
RawIntegrationDeleteEvent
) – The raw event payload data.
Invites¶
- disnake.on_invite_create(invite)¶
Called when an
Invite
is created. You must have themanage_channels
permission to receive this.New in version 1.3.
Note
There is a rare possibility that the
Invite.guild
andInvite.channel
attributes will be ofObject
rather than the respective models.This requires
Intents.invites
to be enabled.- Parameters:
invite (
Invite
) – The invite that was created.
- disnake.on_invite_delete(invite)¶
Called when an
Invite
is deleted. You must have themanage_channels
permission to receive this.New in version 1.3.
Note
There is a rare possibility that the
Invite.guild
andInvite.channel
attributes will be ofObject
rather than the respective models.Outside of those two attributes, the only other attribute guaranteed to be filled by the Discord gateway for this event is
Invite.code
.This requires
Intents.invites
to be enabled.- Parameters:
invite (
Invite
) – The invite that was deleted.
Members¶
- disnake.on_member_join(member)¶
- disnake.on_member_remove(member)¶
Called when a
Member
joins or leaves aGuild
(this includes getting kicked/banned). Ifon_member_remove()
is being used then consider usingon_raw_member_remove()
which will be called regardless of the cache.This requires
Intents.members
to be enabled.- Parameters:
member (
Member
) – The member who joined or left.
- disnake.on_member_update(before, after)¶
Called when a
Member
is updated in aGuild
. This will also be called when aUser
object linked to a guildMember
changes. Consider usingon_raw_member_update()
which will be called regardless of the cache.This is called when one or more of the following things change, but is not limited to:
avatar (guild-specific)
current_timeout
nickname
pending
premium_since
roles
This requires
Intents.members
to be enabled.
- disnake.on_raw_member_remove(payload)¶
Called when a member leaves a
Guild
(this includes getting kicked/banned). Unlikeon_member_remove()
, this is called regardless of the member cache.New in version 2.6.
- Parameters:
payload (
RawGuildMemberRemoveEvent
) – The raw event payload data.
- disnake.on_raw_member_update(member)¶
Called when a
Member
is updated in aGuild
. This will also be called when aUser
object linked to a guildMember
changes. Unlikeon_member_update()
, this is called regardless of the member cache.New in version 2.6.
- Parameters:
member (
Member
) – The member that was updated.
- disnake.on_member_ban(guild, user)¶
Called when user gets banned from a
Guild
.This requires
Intents.moderation
to be enabled.
- disnake.on_member_unban(guild, user)¶
Called when a
User
gets unbanned from aGuild
.This requires
Intents.moderation
to be enabled.
- disnake.on_presence_update(before, after)¶
Called when a
Member
updates their presence.This is called when one or more of the following things change:
status
activity
This requires
Intents.presences
andIntents.members
to be enabled.New in version 2.0.
- disnake.on_raw_presence_update(payload)¶
Called when a member updates their presence. Unlike
on_presence_update()
, this is called regardless of the member cache.Since the data payload can be partial and the Discord API does not validate the types of the fields, care must be taken when accessing stuff in the dictionary.
This requires
Intents.presences
to be enabled.New in version 2.10.
- Parameters:
payload (
RawPresenceUpdateEvent
) – The raw event payload data.
- disnake.on_user_update(before, after)¶
Called when a
User
is updated.This is called when one or more of the following things change, but is not limited to:
avatar
discriminator
name
global_name
public_flags
This requires
Intents.members
to be enabled.
Roles¶
- disnake.on_guild_role_create(role)¶
- disnake.on_guild_role_delete(role)¶
Called when a
Guild
creates or deletes aRole
.To get the guild it belongs to, use
Role.guild
.This requires
Intents.guilds
to be enabled.- Parameters:
role (
Role
) – The role that was created or deleted.
- disnake.on_guild_role_update(before, after)¶
Called when a
Role
is changed guild-wide.This requires
Intents.guilds
to be enabled.
Scheduled Events¶
- disnake.on_guild_scheduled_event_create(event)¶
- disnake.on_guild_scheduled_event_delete(event)¶
Called when a guild scheduled event is created or deleted.
This requires
Intents.guild_scheduled_events
to be enabled.New in version 2.3.
- Parameters:
event (
GuildScheduledEvent
) – The guild scheduled event that was created or deleted.
- disnake.on_guild_scheduled_event_update(before, after)¶
Called when a guild scheduled event is updated. The guild must have existed in the
Client.guilds
cache.This requires
Intents.guild_scheduled_events
to be enabled.New in version 2.3.
- Parameters:
before (
GuildScheduledEvent
) – The guild scheduled event before the update.after (
GuildScheduledEvent
) – The guild scheduled event after the update.
- disnake.on_guild_scheduled_event_subscribe(event, user)¶
- disnake.on_guild_scheduled_event_unsubscribe(event, user)¶
Called when a user subscribes to or unsubscribes from a guild scheduled event.
This requires
Intents.guild_scheduled_events
andIntents.members
to be enabled.New in version 2.3.
- Parameters:
event (
GuildScheduledEvent
) – The guild scheduled event that the user subscribed to or unsubscribed from.user (Union[
Member
,User
]) – The user who subscribed to or unsubscribed from the event.
- disnake.on_raw_guild_scheduled_event_subscribe(payload)¶
- disnake.on_raw_guild_scheduled_event_unsubscribe(payload)¶
Called when a user subscribes to or unsubscribes from a guild scheduled event. Unlike
on_guild_scheduled_event_subscribe()
andon_guild_scheduled_event_unsubscribe()
, this is called regardless of the guild scheduled event cache.- Parameters:
payload (
RawGuildScheduledEventUserActionEvent
) – The raw event payload data.
Stage Instances¶
- disnake.on_stage_instance_create(stage_instance)¶
- disnake.on_stage_instance_delete(stage_instance)¶
Called when a
StageInstance
is created or deleted for aStageChannel
.New in version 2.0.
- Parameters:
stage_instance (
StageInstance
) – The stage instance that was created or deleted.
- disnake.on_stage_instance_update(before, after)¶
Called when a
StageInstance
is updated.The following, but not limited to, examples illustrate when this event is called:
The topic is changed.
The privacy level is changed.
New in version 2.0.
- Parameters:
before (
StageInstance
) – The stage instance before the update.after (
StageInstance
) – The stage instance after the update.
Stickers¶
- disnake.on_guild_stickers_update(guild, before, after)¶
Called when a
Guild
updates its stickers.This requires
Intents.emojis_and_stickers
to be enabled.New in version 2.0.
- Parameters:
guild (
Guild
) – The guild who got their stickers updated.before (Sequence[
GuildSticker
]) – A list of stickers before the update.after (Sequence[
GuildSticker
]) – A list of stickers after the update.
Voice¶
- disnake.on_voice_state_update(member, before, after)¶
Called when a
Member
changes theirVoiceState
.The following, but not limited to, examples illustrate when this event is called:
A member joins a voice or stage channel.
A member leaves a voice or stage channel.
A member is muted or deafened by their own accord.
A member is muted or deafened by a guild administrator.
This requires
Intents.voice_states
to be enabled.- Parameters:
member (
Member
) – The member whose voice states changed.before (
VoiceState
) – The voice state prior to the changes.after (
VoiceState
) – The voice state after the changes.
Interactions¶
This section documents events related to application commands and other interactions.
- disnake.on_application_command(interaction)¶
Called when an application command is invoked.
Warning
This is a low level function that is not generally meant to be used. Consider using
Bot
orInteractionBot
instead.Warning
If you decide to override this event and are using
Bot
or related types, make sure to callBot.process_application_commands
to ensure that the application commands are processed.New in version 2.0.
- Parameters:
interaction (
ApplicationCommandInteraction
) – The interaction object.
- disnake.on_application_command_autocomplete(interaction)¶
Called when an application command autocomplete is called.
Warning
This is a low level function that is not generally meant to be used. Consider using
Bot
orInteractionBot
instead.Warning
If you decide to override this event and are using
Bot
or related types, make sure to callBot.process_app_command_autocompletion
to ensure that the application command autocompletion is processed.New in version 2.0.
- Parameters:
interaction (
ApplicationCommandInteraction
) – The interaction object.
- disnake.on_button_click(interaction)¶
Called when a button is clicked.
New in version 2.0.
- Parameters:
interaction (
MessageInteraction
) – The interaction object.
- disnake.on_dropdown(interaction)¶
Called when a select menu is clicked.
New in version 2.0.
- Parameters:
interaction (
MessageInteraction
) – The interaction object.
- disnake.on_interaction(interaction)¶
Called when an interaction happened.
This currently happens due to application command invocations or components being used.
Warning
This is a low level function that is not generally meant to be used.
New in version 2.0.
- Parameters:
interaction (
Interaction
) – The interaction object.
- disnake.on_message_interaction(interaction)¶
Called when a message interaction happened.
This currently happens due to components being used.
New in version 2.0.
- Parameters:
interaction (
MessageInteraction
) – The interaction object.
- disnake.on_modal_submit(interaction)¶
Called when a modal is submitted.
New in version 2.4.
- Parameters:
interaction (
ModalInteraction
) – The interaction object.
Messages¶
This section documents events related to Discord chat messages.
- disnake.on_message(message)¶
Called when a
Message
is created and sent.This requires
Intents.messages
to be enabled.Warning
Your bot’s own messages and private messages are sent through this event. This can lead cases of ‘recursion’ depending on how your bot was programmed. If you want the bot to not reply to itself, consider checking the user IDs. Note that
Bot
does not have this problem.Note
Not all messages will have
content
. This is a Discord limitation. See the docs ofIntents.message_content
for more information.- Parameters:
message (
Message
) – The current message.
- disnake.on_message_edit(before, after)¶
Called when a
Message
receives an update event. If the message is not found in the internal message cache, then these events will not be called. Messages might not be in cache if the message is too old or the client is participating in high traffic guilds.If this occurs increase the
max_messages
parameter or use theon_raw_message_edit()
event instead.Note
Not all messages will have
content
. This is a Discord limitation. See the docs ofIntents.message_content
for more information.The following non-exhaustive cases trigger this event:
A message has been pinned or unpinned.
The message content has been changed.
The message has received an embed.
For performance reasons, the embed server does not do this in a “consistent” manner.
The message’s embeds were suppressed or unsuppressed.
A call message has received an update to its participants or ending time.
This requires
Intents.messages
to be enabled.
- disnake.on_message_delete(message)¶
Called when a message is deleted. If the message is not found in the internal message cache, then this event will not be called. Messages might not be in cache if the message is too old or the client is participating in high traffic guilds.
If this occurs increase the
max_messages
parameter or use theon_raw_message_delete()
event instead.This requires
Intents.messages
to be enabled.Note
Not all messages will have
content
. This is a Discord limitation. See the docs ofIntents.message_content
for more information.- Parameters:
message (
Message
) – The deleted message.
- disnake.on_bulk_message_delete(messages)¶
Called when messages are bulk deleted. If none of the messages deleted are found in the internal message cache, then this event will not be called. If individual messages were not found in the internal message cache, this event will still be called, but the messages not found will not be included in the messages list. Messages might not be in cache if the message is too old or the client is participating in high traffic guilds.
If this occurs increase the
max_messages
parameter or use theon_raw_bulk_message_delete()
event instead.This requires
Intents.messages
to be enabled.- Parameters:
messages (List[
Message
]) – The messages that have been deleted.
- disnake.on_poll_vote_add(member, answer)¶
Called when a vote is added on a poll. If the member or message is not found in the internal cache, then this event will not be called.
This requires
Intents.guild_polls
orIntents.dm_polls
to be enabled to receive events about polls sent in guilds or DMs.Note
You can use
Intents.polls
to enable bothIntents.guild_polls
andIntents.dm_polls
in one go.- Parameters:
member (
Member
) – The member who voted.answer (
PollAnswer
) – ThePollAnswer
object for which the vote was added.
- disnake.on_poll_vote_remove(member, answer)¶
Called when a vote is removed on a poll. If the member or message is not found in the internal cache, then this event will not be called.
This requires
Intents.guild_polls
orIntents.dm_polls
to be enabled to receive events about polls sent in guilds or DMs.Note
You can use
Intents.polls
to enable bothIntents.guild_polls
andIntents.dm_polls
in one go.- Parameters:
member (
Member
) – The member who removed the vote.answer (
PollAnswer
) – ThePollAnswer
object for which the vote was removed.
- disnake.on_raw_message_edit(payload)¶
Called when a message is edited. Unlike
on_message_edit()
, this is called regardless of the state of the internal message cache.If the message is found in the message cache, it can be accessed via
RawMessageUpdateEvent.cached_message
. The cached message represents the message before it has been edited. For example, if the content of a message is modified and triggers theon_raw_message_edit()
coroutine, theRawMessageUpdateEvent.cached_message
will return aMessage
object that represents the message before the content was modified.Due to the inherently raw nature of this event, the data parameter coincides with the raw data given by the gateway.
Since the data payload can be partial, care must be taken when accessing stuff in the dictionary. One example of a common case of partial data is when the
'content'
key is inaccessible. This denotes an “embed” only edit, which is an edit in which only the embeds are updated by the Discord embed server.This requires
Intents.messages
to be enabled.- Parameters:
payload (
RawMessageUpdateEvent
) – The raw event payload data.
- disnake.on_raw_message_delete(payload)¶
Called when a message is deleted. Unlike
on_message_delete()
, this is called regardless of the message being in the internal message cache or not.If the message is found in the message cache, it can be accessed via
RawMessageDeleteEvent.cached_message
This requires
Intents.messages
to be enabled.- Parameters:
payload (
RawMessageDeleteEvent
) – The raw event payload data.
- disnake.on_raw_bulk_message_delete(payload)¶
Called when a bulk delete is triggered. Unlike
on_bulk_message_delete()
, this is called regardless of the messages being in the internal message cache or not.If the messages are found in the message cache, they can be accessed via
RawBulkMessageDeleteEvent.cached_messages
This requires
Intents.messages
to be enabled.- Parameters:
payload (
RawBulkMessageDeleteEvent
) – The raw event payload data.
- disnake.on_raw_poll_vote_add(payload)¶
Called when a vote is added on a poll. Unlike
on_poll_vote_add()
, this is called regardless of the guilds being in the internal guild cache or not.This requires
Intents.guild_polls
orIntents.dm_polls
to be enabled to receive events about polls sent in guilds or DMs.Note
You can use
Intents.polls
to enable bothIntents.guild_polls
andIntents.dm_polls
in one go.- Parameters:
payload (
RawPollVoteActionEvent
) – The raw event payload data.
- disnake.on_raw_poll_vote_remove(payload)¶
Called when a vote is removed on a poll. Unlike
on_poll_vote_remove()
, this is called regardless of the guilds being in the internal guild cache or not.This requires
Intents.guild_polls
orIntents.dm_polls
to be enabled to receive events about polls sent in guilds or DMs.Note
You can use
Intents.polls
to enable bothIntents.guild_polls
andIntents.dm_polls
in one go.- Parameters:
payload (
RawPollVoteActionEvent
) – The raw event payload data.
- disnake.on_reaction_add(reaction, user)¶
Called when a message has a reaction added to it. Similar to
on_message_edit()
, if the message is not found in the internal message cache, then this event will not be called. Consider usingon_raw_reaction_add()
instead.Note
To get the
Message
being reacted, access it viaReaction.message
.This requires
Intents.reactions
to be enabled.Note
This doesn’t require
Intents.members
within a guild context, but due to Discord not providing updated user information in a direct message it’s required for direct messages to receive this event. Consider usingon_raw_reaction_add()
if you need this and do not otherwise want to enable the members intent.
- disnake.on_reaction_remove(reaction, user)¶
Called when a message has a reaction removed from it. Similar to on_message_edit, if the message is not found in the internal message cache, then this event will not be called.
Note
To get the message being reacted, access it via
Reaction.message
.This requires both
Intents.reactions
andIntents.members
to be enabled.Note
Consider using
on_raw_reaction_remove()
if you need this and do not want to enable the members intent.
- disnake.on_reaction_clear(message, reactions)¶
Called when a message has all its reactions removed from it. Similar to
on_message_edit()
, if the message is not found in the internal message cache, then this event will not be called. Consider usingon_raw_reaction_clear()
instead.This requires
Intents.reactions
to be enabled.
- disnake.on_reaction_clear_emoji(reaction)¶
Called when a message has a specific reaction removed from it. Similar to
on_message_edit()
, if the message is not found in the internal message cache, then this event will not be called. Consider usingon_raw_reaction_clear_emoji()
instead.This requires
Intents.reactions
to be enabled.New in version 1.3.
- Parameters:
reaction (
Reaction
) – The reaction that got cleared.
- disnake.on_raw_reaction_add(payload)¶
Called when a message has a reaction added. Unlike
on_reaction_add()
, this is called regardless of the state of the internal message cache.This requires
Intents.reactions
to be enabled.- Parameters:
payload (
RawReactionActionEvent
) – The raw event payload data.
- disnake.on_raw_reaction_remove(payload)¶
Called when a message has a reaction removed. Unlike
on_reaction_remove()
, this is called regardless of the state of the internal message cache.This requires
Intents.reactions
to be enabled.- Parameters:
payload (
RawReactionActionEvent
) – The raw event payload data.
- disnake.on_raw_reaction_clear(payload)¶
Called when a message has all its reactions removed. Unlike
on_reaction_clear()
, this is called regardless of the state of the internal message cache.This requires
Intents.reactions
to be enabled.- Parameters:
payload (
RawReactionClearEvent
) – The raw event payload data.
- disnake.on_raw_reaction_clear_emoji(payload)¶
Called when a message has a specific reaction removed from it. Unlike
on_reaction_clear_emoji()
this is called regardless of the state of the internal message cache.This requires
Intents.reactions
to be enabled.New in version 1.3.
- Parameters:
payload (
RawReactionClearEmojiEvent
) – The raw event payload data.
- disnake.on_typing(channel, user, when)¶
Called when someone begins typing a message.
The
channel
parameter can be aabc.Messageable
instance, or aForumChannel
orMediaChannel
. If channel is anabc.Messageable
instance, it could be aTextChannel
,VoiceChannel
,StageChannel
,GroupChannel
, orDMChannel
.If the
channel
is not aDMChannel
, then theuser
parameter is aMember
, otherwise it is aUser
.If the
channel
is aDMChannel
and the user is not found in the internal user/member cache, then this event will not be called. Consider usingon_raw_typing()
instead.This requires
Intents.typing
andIntents.guilds
to be enabled.Note
This doesn’t require
Intents.members
within a guild context, but due to Discord not providing updated user information in a direct message it’s required for direct messages to receive this event, if the bot didn’t explicitly open the DM channel in the same session (throughUser.create_dm()
,Client.create_dm()
, or indirectly by sending a message to the user). Consider usingon_raw_typing()
if you need this and do not otherwise want to enable the members intent.- Parameters:
channel (Union[
abc.Messageable
,ForumChannel
,MediaChannel
]) – The location where the typing originated from.when (
datetime.datetime
) – When the typing started as an aware datetime in UTC.
- disnake.on_raw_typing(data)¶
Called when someone begins typing a message.
This is similar to
on_typing()
except that it is called regardless of whetherIntents.members
andIntents.guilds
are enabled.- Parameters:
data (
RawTypingEvent
) – The raw event payload data.
Entitlements¶
This section documents events related to entitlements, which are used for application subscriptions.
- disnake.on_entitlement_create(entitlement)¶
Called when an entitlement is created.
This is usually caused by a user subscribing to an SKU, or when a new test entitlement is created (see
Client.create_entitlement()
).New in version 2.10.
- Parameters:
entitlement (
Entitlement
) – The entitlement that was created.
- disnake.on_entitlement_update(entitlement)¶
Called when an entitlement is updated.
This happens e.g. when a user’s subscription gets renewed (in which case the
Entitlement.ends_at
attribute reflects the new expiration date).New in version 2.10.
- Parameters:
entitlement (
Entitlement
) – The entitlement that was updated.
- disnake.on_entitlement_delete(entitlement)¶
Called when an entitlement is deleted.
Note
This does not get called when an entitlement expires; it only occurs e.g. in case of refunds or due to manual removal.
New in version 2.10.
- Parameters:
entitlement (
Entitlement
) – The entitlement that was deleted.
Enumerations¶
Event¶
- class disnake.Event(value)[source]¶
Represents all the events of the library.
These offer to register listeners/events in a more pythonic way; additionally autocompletion and documentation are both supported.
New in version 2.8.
- connect = <Event.connect: 'connect'>¶
Called when the client has successfully connected to Discord. Represents the
on_connect()
event.
- disconnect = <Event.disconnect: 'disconnect'>¶
Called when the client has disconnected from Discord, or a connection attempt to Discord has failed. Represents the
on_disconnect()
event.
- error = <Event.error: 'error'>¶
Called when an uncaught exception occurred. Represents the
on_error()
event.
- gateway_error = <Event.gateway_error: 'gateway_error'>¶
Called when a known gateway event cannot be parsed. Represents the
on_gateway_error()
event.
- ready = <Event.ready: 'ready'>¶
Called when the client is done preparing the data received from Discord. Represents the
on_ready()
event.
- resumed = <Event.resumed: 'resumed'>¶
Called when the client has resumed a session. Represents the
on_resumed()
event.
- shard_connect = <Event.shard_connect: 'shard_connect'>¶
Called when a shard has successfully connected to Discord. Represents the
on_shard_connect()
event.
- shard_disconnect = <Event.shard_disconnect: 'shard_disconnect'>¶
Called when a shard has disconnected from Discord. Represents the
on_shard_disconnect()
event.
- shard_ready = <Event.shard_ready: 'shard_ready'>¶
Called when a shard has become ready. Represents the
on_shard_ready()
event.
- shard_resumed = <Event.shard_resumed: 'shard_resumed'>¶
Called when a shard has resumed a session. Represents the
on_shard_resumed()
event.
- socket_event_type = <Event.socket_event_type: 'socket_event_type'>¶
Called whenever a websocket event is received from the WebSocket. Represents the
on_socket_event_type()
event.
- socket_raw_receive = <Event.socket_raw_receive: 'socket_raw_receive'>¶
Called whenever a message is completely received from the WebSocket, before it’s processed and parsed. Represents the
on_socket_raw_receive()
event.
- socket_raw_send = <Event.socket_raw_send: 'socket_raw_send'>¶
Called whenever a send operation is done on the WebSocket before the message is sent. Represents the
on_socket_raw_send()
event.
- guild_channel_create = <Event.guild_channel_create: 'guild_channel_create'>¶
Called whenever a guild channel is created. Represents the
on_guild_channel_create()
event.
- guild_channel_update = <Event.guild_channel_update: 'guild_channel_update'>¶
Called whenever a guild channel is updated. Represents the
on_guild_channel_update()
event.
- guild_channel_delete = <Event.guild_channel_delete: 'guild_channel_delete'>¶
Called whenever a guild channel is deleted. Represents the
on_guild_channel_delete()
event.
- guild_channel_pins_update = <Event.guild_channel_pins_update: 'guild_channel_pins_update'>¶
Called whenever a message is pinned or unpinned from a guild channel. Represents the
on_guild_channel_pins_update()
event.
- invite_create = <Event.invite_create: 'invite_create'>¶
Called when an
Invite
is created. Represents theon_invite_create()
event.
- invite_delete = <Event.invite_delete: 'invite_delete'>¶
Called when an Invite is deleted. Represents the
on_invite_delete()
event.
- private_channel_update = <Event.private_channel_update: 'private_channel_update'>¶
Called whenever a private group DM is updated. Represents the
on_private_channel_update()
event.
- private_channel_pins_update = <Event.private_channel_pins_update: 'private_channel_pins_update'>¶
Called whenever a message is pinned or unpinned from a private channel. Represents the
on_private_channel_pins_update()
event.
- webhooks_update = <Event.webhooks_update: 'webhooks_update'>¶
Called whenever a webhook is created, modified, or removed from a guild channel. Represents the
on_webhooks_update()
event.
- thread_create = <Event.thread_create: 'thread_create'>¶
Called whenever a thread is created. Represents the
on_thread_create()
event.
- thread_update = <Event.thread_update: 'thread_update'>¶
Called when a thread is updated. Represents the
on_thread_update()
event.
- thread_delete = <Event.thread_delete: 'thread_delete'>¶
Called when a thread is deleted. Represents the
on_thread_delete()
event.
- thread_join = <Event.thread_join: 'thread_join'>¶
Called whenever the bot joins a thread or gets access to a thread. Represents the
on_thread_join()
event.
- thread_remove = <Event.thread_remove: 'thread_remove'>¶
Called whenever a thread is removed. This is different from a thread being deleted. Represents the
on_thread_remove()
event.
- thread_member_join = <Event.thread_member_join: 'thread_member_join'>¶
Called when a ThreadMember joins a Thread. Represents the
on_thread_member_join()
event.
- thread_member_remove = <Event.thread_member_remove: 'thread_member_remove'>¶
Called when a ThreadMember leaves a Thread. Represents the
on_thread_member_remove()
event.
- raw_thread_member_remove = <Event.raw_thread_member_remove: 'raw_thread_member_remove'>¶
Called when a ThreadMember leaves Thread regardless of the thread member cache. Represents the
on_raw_thread_member_remove()
event.
- raw_thread_update = <Event.raw_thread_update: 'raw_thread_update'>¶
Called whenever a thread is updated regardless of the state of the internal thread cache. Represents the
on_raw_thread_update()
event.
- raw_thread_delete = <Event.raw_thread_delete: 'raw_thread_delete'>¶
Called whenever a thread is deleted regardless of the state of the internal thread cache. Represents the
on_raw_thread_delete()
event.
- guild_join = <Event.guild_join: 'guild_join'>¶
Called when a Guild is either created by the Client or when the Client joins a guild. Represents the
on_guild_join()
event.
- guild_remove = <Event.guild_remove: 'guild_remove'>¶
Called when a Guild is removed from the
Client
. Represents theon_guild_remove()
event.
- guild_update = <Event.guild_update: 'guild_update'>¶
Called when a Guild updates. Represents the
on_guild_update()
event.
- guild_available = <Event.guild_available: 'guild_available'>¶
Called when a guild becomes available. Represents the
on_guild_available()
event.
Called when a guild becomes unavailable. Represents the
on_guild_unavailable()
event.
- guild_role_create = <Event.guild_role_create: 'guild_role_create'>¶
Called when a Guild creates a new Role. Represents the
on_guild_role_create()
event.
- guild_role_delete = <Event.guild_role_delete: 'guild_role_delete'>¶
Called when a Guild deletes a Role. Represents the
on_guild_role_delete()
event.
- guild_role_update = <Event.guild_role_update: 'guild_role_update'>¶
Called when a Guild updates a Role. Represents the
on_guild_role_update()
event.
- guild_emojis_update = <Event.guild_emojis_update: 'guild_emojis_update'>¶
Called when a Guild adds or removes Emoji. Represents the
on_guild_emojis_update()
event.
- guild_stickers_update = <Event.guild_stickers_update: 'guild_stickers_update'>¶
Called when a Guild updates its stickers. Represents the
on_guild_stickers_update()
event.
- guild_integrations_update = <Event.guild_integrations_update: 'guild_integrations_update'>¶
Called whenever an integration is created, modified, or removed from a guild. Represents the
on_guild_integrations_update()
event.
- guild_scheduled_event_create = <Event.guild_scheduled_event_create: 'guild_scheduled_event_create'>¶
Called when a guild scheduled event is created. Represents the
on_guild_scheduled_event_create()
event.
- guild_scheduled_event_update = <Event.guild_scheduled_event_update: 'guild_scheduled_event_update'>¶
Called when a guild scheduled event is updated. Represents the
on_guild_scheduled_event_update()
event.
- guild_scheduled_event_delete = <Event.guild_scheduled_event_delete: 'guild_scheduled_event_delete'>¶
Called when a guild scheduled event is deleted. Represents the
on_guild_scheduled_event_delete()
event.
- guild_scheduled_event_subscribe = <Event.guild_scheduled_event_subscribe: 'guild_scheduled_event_subscribe'>¶
Called when a user subscribes from a guild scheduled event. Represents the
on_guild_scheduled_event_subscribe()
event.
- guild_scheduled_event_unsubscribe = <Event.guild_scheduled_event_unsubscribe: 'guild_scheduled_event_unsubscribe'>¶
Called when a user unsubscribes from a guild scheduled event. Represents the
on_guild_scheduled_event_unsubscribe()
event.
- raw_guild_scheduled_event_subscribe = <Event.raw_guild_scheduled_event_subscribe: 'raw_guild_scheduled_event_subscribe'>¶
Called when a user subscribes from a guild scheduled event regardless of the guild scheduled event cache. Represents the
on_raw_guild_scheduled_event_subscribe()
event.
- raw_guild_scheduled_event_unsubscribe = <Event.raw_guild_scheduled_event_unsubscribe: 'raw_guild_scheduled_event_unsubscribe'>¶
Called when a user subscribes to or unsubscribes from a guild scheduled event regardless of the guild scheduled event cache. Represents the
on_raw_guild_scheduled_event_unsubscribe()
event.
- application_command_permissions_update = <Event.application_command_permissions_update: 'application_command_permissions_update'>¶
Called when the permissions of an application command or the application-wide command permissions are updated. Represents the
on_application_command_permissions_update()
event.
- automod_action_execution = <Event.automod_action_execution: 'automod_action_execution'>¶
Called when an auto moderation action is executed due to a rule triggering for a particular event. Represents the
on_automod_action_execution()
event.
- automod_rule_create = <Event.automod_rule_create: 'automod_rule_create'>¶
Called when an AutoModRule is created. Represents the
on_automod_rule_create()
event.
- automod_rule_update = <Event.automod_rule_update: 'automod_rule_update'>¶
Called when an AutoModRule is updated. Represents the
on_automod_rule_update()
event.
- automod_rule_delete = <Event.automod_rule_delete: 'automod_rule_delete'>¶
Called when an AutoModRule is deleted. Represents the
on_automod_rule_delete()
event.
- audit_log_entry_create = <Event.audit_log_entry_create: 'audit_log_entry_create'>¶
Called when an audit log entry is created. Represents the
on_audit_log_entry_create()
event.
- integration_create = <Event.integration_create: 'integration_create'>¶
Called when an integration is created. Represents the
on_integration_create()
event.
- integration_update = <Event.integration_update: 'integration_update'>¶
Called when an integration is updated. Represents the
on_integration_update()
event.
- raw_integration_delete = <Event.raw_integration_delete: 'raw_integration_delete'>¶
Called when an integration is deleted. Represents the
on_raw_integration_delete()
event.
- member_join = <Event.member_join: 'member_join'>¶
Called when a Member joins a Guild. Represents the
on_member_join()
event.
- member_remove = <Event.member_remove: 'member_remove'>¶
Called when a Member leaves a Guild. Represents the
on_member_remove()
event.
- member_update = <Event.member_update: 'member_update'>¶
Called when a Member is updated in a Guild. Represents the
on_member_update()
event.
- raw_member_remove = <Event.raw_member_remove: 'raw_member_remove'>¶
Called when a member leaves a Guild regardless of the member cache. Represents the
on_raw_member_remove()
event.
- raw_member_update = <Event.raw_member_update: 'raw_member_update'>¶
Called when a Member is updated in a Guild regardless of the member cache. Represents the
on_raw_member_update()
event.
- member_ban = <Event.member_ban: 'member_ban'>¶
Called when user gets banned from a Guild. Represents the
on_member_ban()
event.
- member_unban = <Event.member_unban: 'member_unban'>¶
Called when a User gets unbanned from a Guild. Represents the
on_member_unban()
event.
- presence_update = <Event.presence_update: 'presence_update'>¶
Called when a Member updates their presence. Represents the
on_presence_update()
event.
- user_update = <Event.user_update: 'user_update'>¶
Called when a User is updated. Represents the
on_user_update()
event.
- voice_state_update = <Event.voice_state_update: 'voice_state_update'>¶
Called when a Member changes their VoiceState. Represents the
on_voice_state_update()
event.
- stage_instance_create = <Event.stage_instance_create: 'stage_instance_create'>¶
Called when a StageInstance is created for a StageChannel. Represents the
on_stage_instance_create()
event.
- stage_instance_delete = <Event.stage_instance_delete: 'stage_instance_delete'>¶
Called when a StageInstance is deleted for a StageChannel. Represents the
on_stage_instance_delete()
event.
- stage_instance_update = <Event.stage_instance_update: 'stage_instance_update'>¶
Called when a StageInstance is updated. Represents the
on_stage_instance_update()
event.
- application_command = <Event.application_command: 'application_command'>¶
Called when an application command is invoked. Represents the
on_application_command()
event.
- application_command_autocomplete = <Event.application_command_autocomplete: 'application_command_autocomplete'>¶
Called when an application command autocomplete is called. Represents the
on_application_command_autocomplete()
event.
- button_click = <Event.button_click: 'button_click'>¶
Called when a button is clicked. Represents the
on_button_click()
event.
- dropdown = <Event.dropdown: 'dropdown'>¶
Called when a select menu is clicked. Represents the
on_dropdown()
event.
- interaction = <Event.interaction: 'interaction'>¶
Called when an interaction happened. Represents the
on_interaction()
event.
- message_interaction = <Event.message_interaction: 'message_interaction'>¶
Called when a message interaction happened. Represents the
on_message_interaction()
event.
- modal_submit = <Event.modal_submit: 'modal_submit'>¶
Called when a modal is submitted. Represents the
on_modal_submit()
event.
- message = <Event.message: 'message'>¶
Called when a Message is created and sent. Represents the
on_message()
event.
- message_edit = <Event.message_edit: 'message_edit'>¶
Called when a Message receives an update event. Represents the
on_message_edit()
event.
- message_delete = <Event.message_delete: 'message_delete'>¶
Called when a message is deleted. Represents the
on_message_delete()
event.
- bulk_message_delete = <Event.bulk_message_delete: 'bulk_message_delete'>¶
Called when messages are bulk deleted. Represents the
on_bulk_message_delete()
event.
- poll_vote_add = <Event.poll_vote_add: 'poll_vote_add'>¶
Called when a vote is added on a Poll. Represents the
on_poll_vote_add()
event.
- poll_vote_remove = <Event.poll_vote_remove: 'poll_vote_remove'>¶
Called when a vote is removed from a Poll. Represents the
on_poll_vote_remove()
event.
- raw_message_edit = <Event.raw_message_edit: 'raw_message_edit'>¶
Called when a message is edited regardless of the state of the internal message cache. Represents the
on_raw_message_edit()
event.
- raw_message_delete = <Event.raw_message_delete: 'raw_message_delete'>¶
Called when a message is deleted regardless of the message being in the internal message cache or not. Represents the
on_raw_message_delete()
event.
- raw_bulk_message_delete = <Event.raw_bulk_message_delete: 'raw_bulk_message_delete'>¶
Called when a bulk delete is triggered regardless of the messages being in the internal message cache or not. Represents the
on_raw_bulk_message_delete()
event.
- raw_poll_vote_add = <Event.raw_poll_vote_add: 'raw_poll_vote_add'>¶
Called when a vote is added on a Poll regardless of the internal message cache. Represents the
on_raw_poll_vote_add()
event.
- raw_poll_vote_remove = <Event.raw_poll_vote_remove: 'raw_poll_vote_remove'>¶
Called when a vote is removed from a Poll regardless of the internal message cache. Represents the
on_raw_poll_vote_remove()
event.
- reaction_add = <Event.reaction_add: 'reaction_add'>¶
Called when a message has a reaction added to it. Represents the
on_reaction_add()
event.
- reaction_remove = <Event.reaction_remove: 'reaction_remove'>¶
Called when a message has a reaction removed from it. Represents the
on_reaction_remove()
event.
- reaction_clear = <Event.reaction_clear: 'reaction_clear'>¶
Called when a message has all its reactions removed from it. Represents the
on_reaction_clear()
event.
- reaction_clear_emoji = <Event.reaction_clear_emoji: 'reaction_clear_emoji'>¶
Called when a message has a specific reaction removed from it. Represents the
on_reaction_clear_emoji()
event.
- raw_presence_update = <Event.raw_presence_update: 'raw_presence_update'>¶
Called when a user’s presence changes regardless of the state of the internal member cache. Represents the
on_raw_presence_update()
event.
- raw_reaction_add = <Event.raw_reaction_add: 'raw_reaction_add'>¶
Called when a message has a reaction added regardless of the state of the internal message cache. Represents the
on_raw_reaction_add()
event.
- raw_reaction_remove = <Event.raw_reaction_remove: 'raw_reaction_remove'>¶
Called when a message has a reaction removed regardless of the state of the internal message cache. Represents the
on_raw_reaction_remove()
event.
- raw_reaction_clear = <Event.raw_reaction_clear: 'raw_reaction_clear'>¶
Called when a message has all its reactions removed regardless of the state of the internal message cache. Represents the
on_raw_reaction_clear()
event.
- raw_reaction_clear_emoji = <Event.raw_reaction_clear_emoji: 'raw_reaction_clear_emoji'>¶
Called when a message has a specific reaction removed from it regardless of the state of the internal message cache. Represents the
on_raw_reaction_clear_emoji()
event.
- typing = <Event.typing: 'typing'>¶
Called when someone begins typing a message. Represents the
on_typing()
event.
- raw_typing = <Event.raw_typing: 'raw_typing'>¶
Called when someone begins typing a message regardless of whether Intents.members and Intents.guilds are enabled. Represents the
on_raw_typing()
event.
- entitlement_create = <Event.entitlement_create: 'entitlement_create'>¶
Called when a user subscribes to an SKU, creating a new
Entitlement
. Represents theon_entitlement_create()
event.
- entitlement_update = <Event.entitlement_update: 'entitlement_update'>¶
Called when a user’s subscription renews. Represents the
on_entitlement_update()
event.
- entitlement_delete = <Event.entitlement_delete: 'entitlement_delete'>¶
Called when a user’s entitlement is deleted. Represents the
on_entitlement_delete()
event.
- command = <Event.command: 'command'>¶
Called when a command is found and is about to be invoked. Represents the
on_command()
event.
- command_completion = <Event.command_completion: 'command_completion'>¶
Called when a command has completed its invocation. Represents the
on_command_completion()
event.
- command_error = <Event.command_error: 'command_error'>¶
Called when an error is raised inside a command either through user input error, check failure, or an error in your own code. Represents the
on_command_error()
event.
- slash_command = <Event.slash_command: 'slash_command'>¶
Called when a slash command is found and is about to be invoked. Represents the
on_slash_command()
event.
- slash_command_completion = <Event.slash_command_completion: 'slash_command_completion'>¶
Called when a slash command has completed its invocation. Represents the
on_slash_command_completion()
event.
- slash_command_error = <Event.slash_command_error: 'slash_command_error'>¶
Called when an error is raised inside a slash command either through user input error, check failure, or an error in your own code. Represents the
on_slash_command_error()
event.
- user_command = <Event.user_command: 'user_command'>¶
Called when a user command is found and is about to be invoked. Represents the
on_user_command()
event.
- user_command_completion = <Event.user_command_completion: 'user_command_completion'>¶
Called when a user command has completed its invocation. Represents the
on_user_command_completion()
event.
- user_command_error = <Event.user_command_error: 'user_command_error'>¶
Called when an error is raised inside a user command either through check failure, or an error in your own code. Represents the
on_user_command_error()
event.
- message_command = <Event.message_command: 'message_command'>¶
Called when a message command is found and is about to be invoked. Represents the
on_message_command()
event.
- message_command_completion = <Event.message_command_completion: 'message_command_completion'>¶
Called when a message command has completed its invocation. Represents the
on_message_command_completion()
event.
- message_command_error = <Event.message_command_error: 'message_command_error'>¶
Called when an error is raised inside a message command either through check failure, or an error in your own code. Represents the
on_message_command_error()
event.