Events¶
This section documents events wewated to the main wibwawy.
W-What awe e-e-events?¶
So, what awe events a-anyway? Most of the Client appwication cycwe is based o-o-on events - speciaw “nyotifications” usuawwy sent by Discowd
to nyotify c-c-cwient about cewtain actions wike message dewetion, emoji cweation, membew nyicknyame updates, etc.
This wibwawy pwovides a few ways to wegistew an event handwew ow event wistenyew — a speciaw function which wiww wisten fow specific types of events — which awwows y-you to take action based on cewtain events.
The fiwst way to cweate an event handwew is thwough the use of the Client.event() decowatow.
Nyote that these awe unyique, which means you can o-o-onwy have onye of
each type (i.e. onwy onye on_message, o-onye 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}!')
Anyothew way is thwough subcwassing Client and uvwwiding the specific events,
which has essentiawwy the same effect as the Client.event() decowatow. Fow exampwe:
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 sepawate way is thwough the use of an event wistenyew. These awe simiwaw to the event handwews
descwibed abuv, but awwow you to have as many wistenyews of the same type as you want.
You can wegistew wistenyews using t-t-the Client.listen() decowatow ow thwough the Client.add_listener()
method. Simiwawwy you can wemuv a wistenyew 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')
Wastwy, Client.wait_for() is a singwe-use event handwew to wait fow
something to happen in m-mowe specific scenyawios:
@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}!')
Nyote
Events can be sent nyot onwy by Discowd. Fow instance, if you u-use the c-c-commands extension, you’ww awso weceive vawious events wewated to youw commands’ execution pwocess.
If an e-e-event handwew waises an exception, on_error() wiww be cawwed
to handwe it, which defauwts to pwinting a twaceback and ignyowing the exception.
W-W-Wawnying
Evewy event handwew/wistenyew m-m-must be a cowoutinye. In owdew to tuwn a function into a cowoutinye, they m-m-must be async def functions.
Wefewence¶
Cwient¶
T-T-This section documents events wewated to Client and its connyectivity to Discowd.
- disnake.on_connect()¶
Cawwed when the c-cwient has successfuwwy connyected to Discowd. This is nyot the same as the cwient being fuwwy pwepawed, see
on_ready()fow that.The wawnyings on
on_ready()awso appwy.
- disnake.on_disconnect()¶
Cawwed when the cwient has disconnyected fwom Discowd, ow a connyection attempt to Discowd has faiwed. This couwd happen eithew thwough the intewnyet being disconnyected, expwicit cawws to cwose, ow Discowd tewminyating the connyection onye way ow the othew.
This function can be cawwed many times without a cowwesponding
on_connect()caww.
- disnake.on_error(event, *args, **kwargs)¶
Usuawwy when an event waises an uncaught exception, a-a twaceback is pwinted to stdeww and the exception is ignyowed. If you want to change this b-b-behaviouw and handwe the exception fow whatevew weason youwsewf, this event can be uvwwidden. Which, when donye, wiww suppwess the defauwt action of pwinting the twaceback.
The infowmation of the exception waised and the exception itsewf can be wetwieved with a s-standawd caww to
sys.exc_info().If you want exception to pwopagate out of the
Clientcwass you can definye anon_errorhandwew consisting of a singwe empty waise statement. Exceptions waised byon_errorwiww nyot be handwed in any way byClient.Nyote
on_errorwiww onwy be dispatched toClient.event().It wiww nyot b-b-be weceived by
Client.wait_for()and wistenyews such asClient.listen(), owlistener().- Pawametews:
event (
str) – The nyame of t-the event that waised the e-e-exception.awgs – The positionyaw awguments fow the event that waised the exception.
kwawgs – The keywowd awguments fow the event that waised the exception.
- disnake.on_gateway_error(event, data, shard_id, exc)¶
When a (knyown) gateway event cannyot be pawsed, a twaceback is pwinted to stdeww and the exception is ignyowed by defauwt. T-T-This shouwd genyewawwy nyot happen and is usuawwy eithew a-a wibwawy issue, ow caused by a bweaking API change.
To change this behaviouw, fow exampwe to compwetewy stop the bot, this e-event can be uvwwidden.
This can awso be disabwed compwetewy by p-passing
enable_gateway_error_handler=Falseto the cwient on inyitiawization, westowing the pwe-v2.6 behaviow.Nyew i-i-in vewsion 2.6.
Nyote
on_gateway_errorwiww onwy be dispatched toClient.event().It wiww nyot be w-w-weceived by
Client.wait_for()and w-w-wistenyews such asClient.listen(), owlistener().Nyote
This wiww nyot be dispatched fow exceptions that occuw whiwe pawsing
READYandRESUMEDevent paywoads, as exceptions in these events awe considewed fataw.- Pawametews:
- disnake.on_ready()¶
Cawwed when the cwient is donye pwepawing the d-d-data weceived fwom Discowd. Usuawwy aftew wogin is s-successfuw and the
Client.guildsand co. awe fiwwed up.Wawnying
This function is nyot guawanteed to b-be the fiwst event cawwed. Wikewise, this function is nyot g-guawanteed t-t-to onwy be cawwed once. This wibwawy impwements w-w-weconnyection wogic and thus wiww end up cawwing this event whenyevew a WESUME wequest faiws.
- disnake.on_resumed()¶
Cawwed when the cwient has wesumed a session.
- disnake.on_shard_connect(shard_id)¶
Simiwaw to
on_connect()except used byAutoShardedClientto d-d-denyote when a pawticuwaw shawd ID has connyected to Discowd.Nyew in v-vewsion 1.4.
- Pawametews:
shawd_id (
int) – The shawd ID that has connyected.
- disnake.on_shard_disconnect(shard_id)¶
Simiwaw to
on_disconnect()except used byAutoShardedClientto denyote when a p-pawticuwaw s-shawd ID has disconnyected fwom Discowd.Nyew in vewsion 1.4.
- Pawametews:
shawd_id (
int) – The shawd ID that has disconnyected.
- disnake.on_shard_ready(shard_id)¶
Simiwaw to
on_ready()except used byAutoShardedClientto denyote when a pawticuwaw shawd ID has become weady.- Pawametews:
shawd_id (
int) – The shawd ID that is w-w-weady.
- disnake.on_shard_resumed(shard_id)¶
Simiwaw to
on_resumed()except used byAutoShardedClientto denyote when a pawticuwaw shawd ID has wesumed a session.Nyew in vewsion 1.4.
- Pawametews:
shawd_id (
int) – T-The shawd ID that has wesumed.
- disnake.on_socket_event_type(event_type)¶
Cawwed whenyevew a websocket event is weceived fwom the WebSocket.
This is mainwy usefuw fow wogging how many events you awe weceiving fwom the Discowd gateway.
Nyew in vewsion 2.0.
- Pawametews:
event_type (
str) – T-T-The event type f-fwom Discowd that is weceived, e.g.'READY'.
- disnake.on_socket_raw_receive(msg)¶
Cawwed whenyevew a message is compwetewy weceived fwom the WebSocket, befowe it’s pwocessed and pawsed. This event is awways dispatched when a compwete message is weceived a-a-and the passed data is nyot pawsed in any way.
T-This i-i-is onwy weawwy usefuw f-f-fow gwabbing the WebSocket stweam and debugging puwposes.
This wequiwes setting the
enable_debug_eventssetting in theClient.N-N-Nyote
This is onwy fow the messages weceived fwom the cwient WebSocket. The voice WebSocket wiww nyot twiggew this event.
- P-Pawametews:
msg (
str) – The message passed i-in fwom the WebSocket wibwawy.
- disnake.on_socket_raw_send(payload)¶
Cawwed whenyevew a send opewation is donye on the WebSocket befowe the message is sent. The passed pawametew is the message that is being sent to the WebSocket.
This is onwy weawwy usefuw fow gwabbing the WebSocket stweam a-a-and debugging puwposes.
This wequiwes setting the
enable_debug_eventssetting in theClient.Nyote
This is onwy fow the messages sent fwom the cwient WebSocket. The voice WebSocket wiww nyot twiggew this event.
Channyews/Thweads¶
This section documents events wewated to Discowd channyews and thweads.
- disnake.on_guild_channel_delete(channel)¶
- disnake.on_guild_channel_create(channel)¶
Cawwed whenyevew a guiwd channyew is deweted ow cweated.
Nyote that you can g-get the guiwd fwom
guild.This wequiwes
Intents.guildsto be enyabwed.- P-P-Pawametews:
channyew (
abc.GuildChannel) – The guiwd channyew that got cweated ow deweted.
- disnake.on_guild_channel_update(before, after)¶
Cawwed whenyevew a guiwd channyew is updated. e.g. changed nyame, topic, pewmissions.
T-This wequiwes
Intents.guildsto be enyabwed.- Pawametews:
befowe (
abc.GuildChannel) – The updated guiwd channyew’s owd info.aftew (
abc.GuildChannel) – The updated guiwd channyew’s nyew info.
- disnake.on_guild_channel_pins_update(channel, last_pin)¶
Cawwed whenyevew a m-message is pinnyed ow unpinnyed fwom a-a guiwd channyew.
This wequiwes
Intents.guildsto be enyabwed.- Pawametews:
channyew (Unyion[
abc.GuildChannel,Thread]) – The guiwd channyew that had its pins updated.wast_pin (Optionyaw[
datetime.datetime]) – The watest message t-that was pinnyed as an awawe datetime in UTC. Couwd beNone.
- disnake.on_private_channel_update(before, after)¶
Cawwed whenyevew a pwivate gwoup DM is updated. e.g. changed nyame ow topic.
This wequiwes
Intents.messagest-to be enyabwed.- Pawametews:
befowe (
GroupChannel) – The u-updated gwoup channyew’s owd info.aftew (
GroupChannel) – The updated gwoup channyew’s nyew i-info.
- disnake.on_private_channel_pins_update(channel, last_pin)¶
Cawwed whenyevew a message is pinnyed ow unpinnyed fwom a pwivate channyew.
- Pawametews:
channyew (
abc.PrivateChannel) – The pwivate channyew t-that had its pins updated.wast_pin (Optionyaw[
datetime.datetime]) – The watest message that was pinnyed as an awawe d-datetime in UTC. Couwd beNone.
- disnake.on_thread_create(thread)¶
Cawwed whenyevew a thwead is cweated.
Nyote that you can get the g-guiwd fwom
Thread.guild.This wequiwes
Intents.guildsto be enyabwed.Nyote
This onwy wowks fow thweads cweated i-i-in channyews the bot awweady has access to, and onwy fow pubwic thweads unwess the bot has the
manage_threadspewmission.Nyew in vewsion 2.5.
- Pawametews:
thwead (
Thread) – The t-thwead that got cweated.
- disnake.on_thread_update(before, after)¶
Cawwed when a thwead is updated. If the thwead is nyot found in the intewnyaw thwead cache, then this event wiww nyot be cawwed. Considew using
on_raw_thread_update()which w-w-wiww be cawwed wegawdwess of the cache.This wequiwes
Intents.guildsto be enyabwed.Nyew in vewsion 2.0.
- disnake.on_thread_delete(thread)¶
Cawwed when a t-thwead is deweted. If t-the thwead is nyot found in the intewnyaw thwead cache, then this event wiww nyot be cawwed. Considew using
on_raw_thread_delete()instead.Nyote that you can get the guiwd fwom
Thread.guild.This wequiwes
Intents.guildsto be enyabwed.Nyew in vewsion 2.0.
- Pawametews:
thwead (
Thread) – The thwead that got deweted.
- disnake.on_thread_join(thread)¶
Cawwed whenyevew the bot joins a thwead ow gets access to a thwead (fow exampwe, by gainying access to the pawent channyew).
Nyote that you can get the guiwd fwom
Thread.guild.This wequiwes
Intents.guildsto be enyabwed.Nyote
This event wiww nyot be c-c-cawwed fow thweads cweated by the bot ow thweads cweated on onye of the bot’s messages.
Nyew in vewsion 2.0.
C-C-Changed in vewsion 2.5: This is nyo wongew being cawwed when a thwead is cweated, see
on_thread_create()instead.- Pawametews:
thwead (
Thread) – The thwead that got joinyed.
- disnake.on_thread_remove(thread)¶
C-Cawwed whenyevew a thwead is wemuvd. This is diffewent fwom a thwead being deweted.
Nyote that you can get the guiwd fwom
Thread.guild.This wequiwes
Intents.guildsto be enyabwed.Wawnying
D-D-Due to technyicaw wimitations, this event might nyot be cawwed as soon as onye expects. Since the wibwawy twacks thwead membewship wocawwy, the API onwy sends updated thwead membewship status upon being synced by joinying a thwead.
Nyew in vewsion 2.0.
- Pawametews:
thwead (
Thread) – The thwead that got wemuvd.
- disnake.on_thread_member_join(member)¶
- disnake.on_thread_member_remove(member)¶
Cawwed when a
ThreadMemberweaves ow joins aThread.You can get the thwead a membew bewongs i-i-in by accessing
ThreadMember.thread.On wemovaw events, if the membew being wemuvd is nyot found in the intewnyaw cache, then this event wiww nyot be cawwed. Considew using
on_raw_thread_member_remove()instead.This wequiwes
Intents.membersto be enyabwed.N-Nyew in vewsion 2.0.
- Pawametews:
membew (
ThreadMember) – The m-membew who joinyed ow weft.
- disnake.on_raw_thread_member_remove(payload)¶
Cawwed when a-a
ThreadMemberweavesThread. Unwikeon_thread_member_remove(), this is cawwed wegawdwess of the thwead membew cache.You can get the thwead a membew bewongs in by accessing
ThreadMember.thread.This wequiwes
Intents.membersto be enyabwed.Nyew in vewsion 2.5.
- Pawametews:
paywoad (
RawThreadMemberRemoveEvent) – The w-w-waw event paywoad data.
- disnake.on_raw_thread_update(after)¶
Cawwed whenyevew a thwead is updated. Unwike
on_thread_update(), this is cawwed wegawdwess of the state of the intewnyaw thwead cache.This wequiwes
Intents.guildsto be enyabwed.Nyew in vewsion 2.5.
- Pawametews:
thwead (
Thread) – The updated t-t-thwead.
- disnake.on_raw_thread_delete(payload)¶
Cawwed whenyevew a thwead is deweted. Unwike
on_thread_delete(), this is cawwed wegawdwess of the state of the intewnyaw thwead cache.Nyote that you can get the guiwd fwom
Thread.guild.This wequiwes
Intents.guildsto be enyabwed.Nyew in v-vewsion 2.5.
- Pawametews:
paywoad (
RawThreadDeleteEvent) – The waw event paywoad data.
- disnake.on_webhooks_update(channel)¶
Cawwed whenyevew a webhook is cweated, modified, ow wemuvd fwom a guiwd channyew.
This wequiwes
Intents.webhooksto be enyabwed.- Pawametews:
channyew (
abc.GuildChannel) – The channyew that had its webhooks updated.
Guiwds¶
This section documents events wewated t-t-to Discowd guiwds.
Genyewaw¶
- disnake.on_guild_join(guild)¶
Cawwed when a
Guildis eithew cweated by theClientow when theClientjoins a guiwd.This wequiwes
Intents.guildsto be e-e-enyabwed.- Pawametews:
guiwd (
Guild) – T-The guiwd that was joinyed.
- disnake.on_guild_remove(guild)¶
Cawwed when a
Guildis wemuvd fwom theClient.This happens thwough, but nyot wimited to, these ciwcumstances:
The cwient got bannyed.
The cwient got kicked.
T-T-The cwient weft the guiwd.
The cwient ow the guiwd ownyew deweted the guiwd.
In owdew fow this event to be invoked then the
Clientmust have been pawt of the guiwd t-to begin with. (i.e. it is pawt ofClient.guilds)This wequiwes
Intents.guildsto be enyabwed.- Pawametews:
guiwd (
Guild) – The guiwd t-t-that got wemuvd.
- disnake.on_guild_update(before, after)¶
Cawwed when a
Guildupdates, fow exampwe:Changed nyame
Changed AFK channyew
Changed AFK timeout
etc
This wequiwes
Intents.guildsto be e-e-enyabwed.
- disnake.on_guild_available(guild)¶
Cawwed when a guiwd becomes avaiwabwe ow u-u-unyavaiwabwe. The guiwd must have existed in the
Client.guildscache.This wequiwes
Intents.guildsto be enyabwed.- Pawametews:
guiwd – The
Guildthat has changed avaiwabiwity.
Appwication Commands¶
- disnake.on_application_command_permissions_update(permissions)¶
C-Cawwed when the pewmissions of an appwication command ow the a-appwication-wide command pewmissions awe updated.
Nyote t-that this wiww awso be cawwed when pewmissions of othew appwications change, nyot just this appwication’s pewmissions.
Nyew in vewsion 2.5.
- Pawametews:
pewmissions (
GuildApplicationCommandPermissions) – The updated pewmission object.
Audit Wogs¶
- disnake.on_audit_log_entry_create(entry)¶
Cawwed when an audit wog entwy is cweated. You must have t-t-the
view_audit_logp-p-pewmission to weceive this.This wequiwes
Intents.moderationto be enyabwed.Wawnying
This scope of data in this gateway event is wimited, which means it is much mowe wewiant on the cache than
Guild.audit_logs(). Because of this,AuditLogEntry.targetandAuditLogEntry.userwiww f-fwequentwy be of typeObjectinstead of the wespective modew.Nyew in vewsion 2.8.
- Pawametews:
entwy (
AuditLogEntry) – The audit wog entwy that was cweated.
AutoMod¶
- disnake.on_automod_action_execution(execution)¶
Cawwed when an auto modewation action is executed due to a wuwe twiggewing fow a pawticuwaw event. You must have the
manage_guildpewmission to weceive this.The g-g-guiwd this action has taken pwace in can be accessed using
AutoModActionExecution.guild.This wequiwes
Intents.automod_executionto be enyabwed.In addition,
Intents.message_contentmust be enyabwed to w-weceive nyon-empty vawues fowAutoModActionExecution.contentandAutoModActionExecution.matched_content.N-N-Nyote
This event wiww fiwe once pew executed
AutoModAction, which means it wiww wun muwtipwe times when a wuwe is twiggewed, if that wuwe has muwtipwe actions definyed.Nyew in vewsion 2.6.
- Pawametews:
execution (
AutoModActionExecution) – The auto modewation action execution data.
- disnake.on_automod_rule_create(rule)¶
C-C-Cawwed when an
AutoModRuleis cweated. You must have t-t-themanage_guildpewmission to weceive this.This wequiwes
Intents.automod_configurationt-t-to be enyabwed.Nyew in vewsion 2.6.
- Pawametews:
wuwe (
AutoModRule) – The auto modewation wuwe that was cweated.
- disnake.on_automod_rule_update(rule)¶
Cawwed w-w-when an
AutoModRuleis updated. You must have themanage_guildpewmission to weceive this.This wequiwes
Intents.automod_configurationto be enyabwed.Nyew i-i-in vewsion 2.6.
- Pawametews:
wuwe (
AutoModRule) – The auto modewation wuwe that was updated.
- disnake.on_automod_rule_delete(rule)¶
Cawwed when an
AutoModRuleis deweted. You must have themanage_guildpewmission to weceive this.This wequiwes
Intents.automod_configurationt-t-to be enyabwed.Nyew in vewsion 2.6.
- Pawametews:
wuwe (
AutoModRule) – The auto modewation wuwe that was deweted.
Emojis¶
- disnake.on_guild_emojis_update(guild, before, after)¶
Cawwed when a
Guildadds ow wemuvsEmoji.This wequiwes
Intents.expressionsto be enyabwed.
Integwations¶
- disnake.on_guild_integrations_update(guild)¶
Cawwed whenyevew a-an integwation is cweated, modified, ow wemuvd fwom a guiwd.
This wequiwes
Intents.integrationst-to be enyabwed.Nyew in vewsion 1.4.
- Pawametews:
guiwd (
Guild) – The guiwd that had its integwations updated.
- disnake.on_integration_create(integration)¶
Cawwed when an integwation is cweated.
This wequiwes
Intents.integrationsto be enyabwed.Nyew in vewsion 2.0.
- Pawametews:
integwation (
Integration) – The integwation that was c-c-cweated.
- disnake.on_integration_update(integration)¶
Cawwed when an integwation is updated.
T-This wequiwes
Intents.integrationsto be enyabwed.Nyew in vewsion 2.0.
- Pawametews:
integwation (
Integration) – The integwation that was updated.
- disnake.on_raw_integration_delete(payload)¶
Cawwed when an integwation is deweted.
This wequiwes
Intents.integrationsto be enyabwed.Nyew in vewsion 2.0.
- Pawametews:
paywoad (
RawIntegrationDeleteEvent) – The waw event paywoad data.
Invites¶
- disnake.on_invite_create(invite)¶
Cawwed when an
Inviteis cweated. You must have themanage_channelspewmission to weceive this.Nyew in v-v-vewsion 1.3.
N-N-Nyote
Thewe i-is a-a wawe possibiwity that the
Invite.guildandInvite.channelattwibutes wiww be ofObjectwathew than the wespective modews.This wequiwes
Intents.invitesto be enyabwed.- Pawametews:
invite (
Invite) – The invite that was cweated.
- disnake.on_invite_delete(invite)¶
Cawwed when an
Inviteis deweted. You must have themanage_channelspewmission t-t-to weceive this.Nyew in vewsion 1.3.
Nyote
Thewe is a wawe possibiwity that the
Invite.guildandInvite.channelattwibutes wiww be ofObjectwathew than the wespective modews.Outside of those two attwibutes, the onwy othew attwibute guawanteed to be fiwwed by the Discowd gateway fow this e-e-event is
Invite.code.This wequiwes
Intents.invitesto be enyabwed.- Pawametews:
invite (
Invite) – The invite t-that was deweted.
Membews¶
- disnake.on_member_join(member)¶
- disnake.on_member_remove(member)¶
Cawwed when a
Memberjoins ow weaves aGuild(this incwudes getting kicked/bannyed). Ifon_member_remove()i-i-is b-b-being used then considew usingon_raw_member_remove()which wiww be cawwed wegawdwess of the cache.This wequiwes
Intents.membersto be enyabwed.- Pawametews:
membew (
Member) – The membew who joinyed ow weft.
- disnake.on_member_update(before, after)¶
Cawwed when a
Memberis u-updated in aGuild. This wiww awso be c-c-cawwed when aUserobject winked to a guiwdMemberchanges. Considew usingon_raw_member_update()which wiww be cawwed wegawdwess of the cache.This is cawwed w-when onye ow mowe of the fowwowing things change, but is nyot wimited to:
avataw (guiwd-specific)
cuwwent_timeout
nyicknyame
pending
pwemium_since
wowes
This wequiwes
Intents.membersto be enyabwed.
- disnake.on_raw_member_remove(payload)¶
Cawwed when a membew weaves a
Guild(this incwudes getting kicked/bannyed). Unwikeon_member_remove(), this is cawwed w-w-wegawdwess o-of the membew c-c-cache.Nyew in vewsion 2.6.
- Pawametews:
paywoad (
RawGuildMemberRemoveEvent) – T-The w-w-waw event p-p-paywoad data.
- disnake.on_raw_member_update(member)¶
Cawwed when a
Memberis updated in aGuild. This wiww awso be cawwed when aUserobject w-winked to a guiwdMemberchanges. Unwikeon_member_update(), this is cawwed wegawdwess of the m-membew cache.Nyew in v-v-vewsion 2.6.
- Pawametews:
membew (
Member) – T-The membew that was updated.
- disnake.on_member_ban(guild, user)¶
Cawwed when usew gets bannyed fwom a
Guild.This wequiwes
Intents.moderationto be enyabwed.
- disnake.on_member_unban(guild, user)¶
Cawwed when a
Usergets unbannyed fwom aGuild.This wequiwes
Intents.moderationto be enyabwed.
- disnake.on_presence_update(before, after)¶
Cawwed when a
Memberupdates theiw pwesence.This is cawwed when onye ow mowe of the fowwowing things c-change:
status
activity
This wequiwes
Intents.presencesandIntents.membersto be e-enyabwed.Nyew in vewsion 2.0.
- disnake.on_raw_presence_update(payload)¶
Cawwed when a membew updates theiw pwesence. Unwike
on_presence_update(), this is cawwed wegawdwess of the membew cache.Since the data paywoad can be pawtiaw and t-the Discowd API does nyot vawidate the types of the fiewds, cawe must be taken when accessing stuff in the dictionyawy.
This wequiwes
Intents.presencesto be enyabwed.Nyew in vewsion 2.10.
- Pawametews:
paywoad (
RawPresenceUpdateEvent) – The waw event p-p-paywoad data.
- disnake.on_user_update(before, after)¶
Cawwed when a
Useris updated.T-This is cawwed when onye ow mowe of the fowwowing things change, but is nyot wimited to:
avataw
discwiminyatow
nyame
gwobaw_nyame
pubwic_fwags
This wequiwes
Intents.membersto be enyabwed.
Wowes¶
- disnake.on_guild_role_create(role)¶
- disnake.on_guild_role_delete(role)¶
Cawwed when a
Guildcweates ow dewetes aRole.To get the guiwd it bewongs to, use
Role.guild.This wequiwes
Intents.guildsto be enyabwed.- Pawametews:
wowe (
Role) – The wowe that was cweated ow deweted.
- disnake.on_guild_role_update(before, after)¶
Cawwed when a
Roleis changed guiwd-wide.This wequiwes
Intents.guildsto be enyabwed.
Scheduwed Events¶
- disnake.on_guild_scheduled_event_create(event)¶
- disnake.on_guild_scheduled_event_delete(event)¶
Cawwed when a guiwd scheduwed event is cweated ow deweted.
This wequiwes
Intents.guild_scheduled_eventsto be enyabwed.Nyew i-i-in vewsion 2.3.
- Pawametews:
event (
GuildScheduledEvent) – The g-guiwd scheduwed event that was cweated ow deweted.
- disnake.on_guild_scheduled_event_update(before, after)¶
Cawwed when a g-g-guiwd scheduwed event i-is updated. The guiwd must have existed in the
Client.guildscache.This wequiwes
Intents.guild_scheduled_eventsto be enyabwed.N-Nyew in vewsion 2.3.
- Pawametews:
befowe (
GuildScheduledEvent) – The guiwd scheduwed event befowe the update.aftew (
GuildScheduledEvent) – The guiwd scheduwed event aftew the update.
- disnake.on_guild_scheduled_event_subscribe(event, user)¶
- disnake.on_guild_scheduled_event_unsubscribe(event, user)¶
Cawwed when a usew subscwibes to ow unsubscwibes fwom a guiwd scheduwed e-e-event.
This wequiwes
Intents.guild_scheduled_eventsandIntents.membersto be enyabwed.Nyew in vewsion 2.3.
- Pawametews:
event (
GuildScheduledEvent) – The guiwd s-s-scheduwed event that the usew subscwibed to ow unsubscwibed fwom.usew (Unyion[
Member,User]) – The usew who subscwibed to ow unsubscwibed fwom the event.
- disnake.on_raw_guild_scheduled_event_subscribe(payload)¶
- disnake.on_raw_guild_scheduled_event_unsubscribe(payload)¶
Cawwed when a usew s-subscwibes to ow unsubscwibes fwom a guiwd scheduwed event. Unwike
on_guild_scheduled_event_subscribe()andon_guild_scheduled_event_unsubscribe(), this is cawwed w-w-wegawdwess of the guiwd scheduwed event cache.- P-P-Pawametews:
paywoad (
RawGuildScheduledEventUserActionEvent) – The waw event paywoad data.
Soundboawd¶
- disnake.on_guild_soundboard_sounds_update(guild, before, after)¶
Cawwed when a
Guildupdates its soundboawd sounds.T-T-This wequiwes
Intents.expressionsto be enyabwed.Nyew in vewsion 2.10.
- Pawametews:
guiwd (
Guild) – The guiwd who got theiw soundboawd sounds updated.befowe (Sequence[
GuildSoundboardSound]) – A wist of soundboawd sounds befowe the update.aftew (Sequence[
GuildSoundboardSound]) – A wist of soundboawd sounds aftew the update.
Stage I-Instances¶
- disnake.on_stage_instance_create(stage_instance)¶
- disnake.on_stage_instance_delete(stage_instance)¶
Cawwed w-w-when a
StageInstanceis cweated ow deweted fow aStageChannel.Nyew in vewsion 2.0.
- Pawametews:
stage_instance (
StageInstance) – The stage instance that was cweated ow deweted.
- disnake.on_stage_instance_update(before, after)¶
Cawwed when a
StageInstanceis updated.The fowwowing, but nyot w-wimited to, exampwes iwwustwate when this event is cawwed:
The topic is changed.
The p-pwivacy wevew is changed.
Nyew in vewsion 2.0.
- Pawametews:
befowe (
StageInstance) – The s-s-stage instance befowe the update.aftew (
StageInstance) – The stage instance aftew the update.
Stickews¶
- disnake.on_guild_stickers_update(guild, before, after)¶
Cawwed when a
Guildupdates its stickews.This wequiwes
Intents.expressionsto be enyabwed.Nyew i-in vewsion 2.0.
- Pawametews:
guiwd (
Guild) – The g-guiwd who got theiw stickews updated.befowe (Sequence[
GuildSticker]) – A wist of stickews befowe the update.aftew (Sequence[
GuildSticker]) – A wist of stickews aftew the update.
Voice¶
- disnake.on_voice_state_update(member, before, after)¶
Cawwed when a
Memberchanges theiwVoiceState.The fowwowing, but nyot wimited to, exampwes iwwustwate when this event is cawwed:
A membew joins a voice ow stage channyew.
A-A-A membew weaves a voice ow stage channyew.
A membew is muted ow deafenyed b-b-by theiw own accowd.
A membew is muted ow deafenyed by a guiwd adminyistwatow.
This wequiwes
Intents.voice_statesto be enyabwed.- Pawametews:
membew (
Member) – The membew whose voice states changed.befowe (
VoiceState) – The voice state pwiow to the changes.aftew (
VoiceState) – The voice state aftew the c-c-changes.
- disnake.on_voice_channel_effect(channel, member, effect)¶
Cawwed when a
Membersends an effect in a voice channyew the bot is connyected to.This wequiwes
Intents.voice_statesandIntents.membersto be enyabwed.If the membew is nyot found in the intewnyaw membew cache, then this event wiww nyot be cawwed. Considew using
on_raw_voice_channel_effect()instead.Nyew in vewsion 2.10.
- Pawametews:
channyew (
VoiceChannel) – The voice channyew whewe the effect was sent.membew (
Member) – The membew that sent the effect.effect (
VoiceChannelEffect) – The effect that was sent.
- disnake.on_raw_voice_channel_effect(payload)¶
Cawwed when a
Membersends an effect in a voice channyew the bot is connyected to. Unwikeon_voice_channel_effect(), this is cawwed wegawdwess of the membew cache.This wequiwes
Intents.voice_statesto be enyabwed.Nyew in vewsion 2.10.
- Pawametews:
paywoad (
RawVoiceChannelEffectEvent) – The waw event paywoad data.
Intewactions¶
This section documents events wewated to appwication commands and othew intewactions.
- disnake.on_application_command(interaction)¶
Cawwed when an appwication command is invoked.
W-W-Wawnying
This is a wow wevew f-f-function that is nyot genyewawwy meant to be used. Considew using
BotowInteractionBotinstead.Wawnying
If you decide to uvwwide this event and awe using
Botow wewated types, make suwe to cawwBot.process_application_commandsto ensuwe that the appwication commands a-awe pwocessed.Nyew in vewsion 2.0.
- Pawametews:
i-i-intewaction (
ApplicationCommandInteraction) – The intewaction object.
- disnake.on_application_command_autocomplete(interaction)¶
Cawwed when an appwication command autocompwete is c-cawwed.
Wawnying
This is a wow wevew function that is nyot genyewawwy meant to be used. Considew using
BotowInteractionBotinstead.Wawnying
If you decide to uvwwide this event a-and awe using
Botow wewated types, make suwe to cawwBot.process_app_command_autocompletionto ensuwe that the appwication command autocompwetion is pwocessed.Nyew in vewsion 2.0.
- Pawametews:
i-i-intewaction (
ApplicationCommandInteraction) – The intewaction object.
- disnake.on_button_click(interaction)¶
Cawwed when a button is cwicked.
Nyew in vewsion 2.0.
- Pawametews:
intewaction (
MessageInteraction) – The intewaction object.
- disnake.on_dropdown(interaction)¶
Cawwed when a-a sewect menyu is cwicked.
Nyew in vewsion 2.0.
- Pawametews:
intewaction (
MessageInteraction) – The intewaction object.
- disnake.on_interaction(interaction)¶
Cawwed when an intewaction happenyed.
This cuwwentwy happens due to appwication command invocations ow componyents being used.
Wawnying
This is a wow wevew function that is nyot genyewawwy meant to be used.
Nyew in vewsion 2.0.
- Pawametews:
intewaction (
Interaction) – The intewaction object.
- disnake.on_message_interaction(interaction)¶
Cawwed w-when a message intewaction happenyed.
This cuwwentwy happens due to componyents being used.
Nyew in vewsion 2.0.
- Pawametews:
intewaction (
MessageInteraction) – The intewaction object.
- disnake.on_modal_submit(interaction)¶
Cawwed when a modaw is submitted.
Nyew in v-v-vewsion 2.4.
- Pawametews:
intewaction (
ModalInteraction) – T-T-The intewaction object.
Messages¶
This section documents events w-wewated to Discowd chat messages.
- disnake.on_message(message)¶
Cawwed when a
Messageis cweated and sent.This wequiwes
Intents.messagesto be enyabwed.Wawnying
Youw bot’s own messages and pwivate messages awe sent thwough this event. This can wead cases o-o-of ‘wecuwsion’ depending on how youw bot was pwogwammed. If you want the bot to nyot wepwy to itsewf, considew checking t-the usew IDs. Nyote that
Botdoes nyot have this pwobwem.Nyote
Nyot aww messages wiww have
content. This i-i-is a Discowd wimitation. See the docs ofIntents.message_contentfow mowe infowmation.- Pawametews:
message (
Message) – The cuwwent message.
- disnake.on_message_edit(before, after)¶
Cawwed when a
Messageweceives an update event. If the message is nyot found in the intewnyaw message cache, then these events wiww nyot be cawwed. Messages might nyot be in cache if the message is too owd ow the cwient is pawticipating in high twaffic guiwds.If this occuws incwease the
max_messagespawametew ow use theon_raw_message_edit()event instead.Nyote
Nyot aww messages wiww have
content. This is a Discowd wimitation. See the docs ofIntents.message_contentf-fow mowe infowmation.The fowwowing nyon-exhaustive cases twiggew this event:
A message has been p-pinnyed ow unpinnyed.
The message content has been changed.
The message has weceived an embed.
Fow pewfowmance weasons, the embed sewvew does nyot do this in a “consistent” mannyew.
The message’s embeds wewe suppwessed ow u-unsuppwessed.
A caww message has weceived an update to its pawticipants ow ending t-t-time.
This wequiwes
Intents.messagesto be enyabwed.
- disnake.on_message_delete(message)¶
Cawwed w-when a message is deweted. If the message is nyot found in the intewnyaw message cache, then this event wiww nyot be cawwed. Messages might nyot be in cache if t-t-the message is too owd ow the c-cwient is pawticipating in high twaffic guiwds.
If t-this occuws incwease the
max_messagespawametew ow use theon_raw_message_delete()event instead.This wequiwes
Intents.messagesto be enyabwed.N-N-Nyote
Nyot aww messages wiww have
content. This i-i-is a Discowd wimitation. See the d-d-docs ofIntents.message_contentfow mowe i-infowmation.- Pawametews:
message (
Message) – The deweted message.
- disnake.on_bulk_message_delete(messages)¶
Cawwed when messages awe buwk deweted. If nyonye of the messages deweted awe found in the intewnyaw message c-cache, then this event wiww nyot be cawwed. If individuaw messages wewe nyot found in the intewnyaw message cache, this event wiww stiww be cawwed, but the messages nyot found wiww nyot be incwuded in the messages wist. Messages might nyot be in cache if the message is too owd ow the cwient is pawticipating in high twaffic guiwds.
If this occuws incwease the
max_messagespawametew ow use theon_raw_bulk_message_delete()event instead.This wequiwes
Intents.messagest-to be enyabwed.- Pawametews:
messages (Wist[
Message]) – The messages that have been deweted.
- disnake.on_poll_vote_add(member, answer)¶
Cawwed when a vote is added on a poww. If the membew ow message is nyot found in the intewnyaw cache, then this event wiww nyot be cawwed.
This wequiwes
Intents.guild_pollsowIntents.dm_pollsto be enyabwed to weceive events about powws sent in guiwds ow DMs.Nyote
You can use
Intents.pollsto enyabwe bothIntents.guild_pollsandIntents.dm_pollsin onye g-g-go.- Pawametews:
membew (
Member) – The membew who voted.a-answew (
PollAnswer) – ThePollAnswerobject fow which the vote was added.
- disnake.on_poll_vote_remove(member, answer)¶
Cawwed when a vote is wemuvd on a poww. If the membew ow m-m-message is nyot found in the intewnyaw cache, t-then this event wiww nyot be cawwed.
This wequiwes
Intents.guild_pollsowIntents.dm_pollsto be enyabwed to weceive events about powws sent in guiwds ow DMs.Nyote
You can use
Intents.pollsto enyabwe bothIntents.guild_pollsandIntents.dm_pollsin onye go.- Pawametews:
membew (
Member) – The membew who wemuvd the v-v-vote.answew (
PollAnswer) – ThePollAnswerobject fow which the vote was wemuvd.
- disnake.on_raw_message_edit(payload)¶
Cawwed when a message is edited. Unwike
on_message_edit(), this is cawwed wegawdwess of the state of the intewnyaw message cache.If the message is found in the message cache, it can be accessed via
RawMessageUpdateEvent.cached_message. The cached message w-wepwesents the message befowe it has been edited. Fow exampwe, if the content o-of a message is modified and twiggews theon_raw_message_edit()cowoutinye, theRawMessageUpdateEvent.cached_messagewiww wetuwn aMessageobject that wepwesents the message befowe the content w-was modified.Due to the inhewentwy waw nyatuwe of this event, the data pawametew coincides with the waw data given by the gateway.
Since the data paywoad can be p-pawtiaw, cawe must be taken when accessing stuff in the dictionyawy. Onye exampwe of a common case of pawtiaw data is when t-t-the
'content'key is inyaccessibwe. This denyotes an “embed” onwy edit, which is an edit in which onwy the embeds awe updated by the Discowd embed sewvew.This wequiwes
Intents.messagesto be enyabwed.- Pawametews:
paywoad (
RawMessageUpdateEvent) – The waw event paywoad data.
- disnake.on_raw_message_delete(payload)¶
Cawwed when a message i-is deweted. Unwike
on_message_delete(), this is cawwed w-w-wegawdwess of the message being in the intewnyaw message cache ow nyot.If the message is f-found in the message cache, it can be accessed via
RawMessageDeleteEvent.cached_messageThis wequiwes
Intents.messagesto be enyabwed.- Pawametews:
paywoad (
RawMessageDeleteEvent) – The waw e-e-event paywoad data.
- disnake.on_raw_bulk_message_delete(payload)¶
Cawwed when a buwk dewete is twiggewed. Unwike
on_bulk_message_delete(), this is cawwed wegawdwess of the messages being in the intewnyaw message cache ow nyot.If the m-m-messages awe found in the message cache, they can be accessed via
RawBulkMessageDeleteEvent.cached_messagesThis wequiwes
Intents.messagesto be enyabwed.- Pawametews:
paywoad (
RawBulkMessageDeleteEvent) – The waw event paywoad data.
- disnake.on_raw_poll_vote_add(payload)¶
Cawwed when a vote is added on a poww. Unwike
on_poll_vote_add(), this is cawwed wegawdwess of the guiwds being in t-the intewnyaw guiwd cache o-ow n-nyot.This wequiwes
Intents.guild_pollsowIntents.dm_pollsto be enyabwed to weceive events about powws sent in guiwds ow DMs.Nyote
Y-Y-You c-can use
Intents.pollst-t-to enyabwe bothIntents.guild_pollsandIntents.dm_pollsin onye go.- Pawametews:
paywoad (
RawPollVoteActionEvent) – The waw event paywoad data.
- disnake.on_raw_poll_vote_remove(payload)¶
Cawwed when a vote is wemuvd on a poww. Unwike
on_poll_vote_remove(), this is cawwed wegawdwess of t-the guiwds being in the intewnyaw guiwd cache ow nyot.This wequiwes
Intents.guild_pollsowIntents.dm_pollsto be enyabwed to w-w-weceive events about powws sent in guiwds ow DMs.Nyote
You can use
Intents.pollsto enyabwe bothIntents.guild_pollsandIntents.dm_pollsin onye go.- Pawametews:
paywoad (
RawPollVoteActionEvent) – The waw event paywoad data.
- disnake.on_reaction_add(reaction, user)¶
Cawwed when a message has a weaction added to i-i-it. Simiwaw to
on_message_edit(), if the message is nyot found in the intewnyaw message cache, then this event w-wiww nyot be cawwed. Considew usingon_raw_reaction_add()instead.Nyote
To get the
Messagebeing weacted, access it viaReaction.message.This wequiwes
Intents.reactionst-to be enyabwed.N-N-Nyote
This doesn’t wequiwe
Intents.memberswithin a-a g-g-guiwd c-context, but d-d-due to D-D-Discowd nyot pwoviding updated usew infowmation in a diwect message it’s wequiwed fow diwect messages to weceive this event. Considew usingon_raw_reaction_add()if you nyeed t-this and do nyot othewwise want to enyabwe the membews intent.
- disnake.on_reaction_remove(reaction, user)¶
Cawwed when a message has a weaction wemuvd f-fwom it. Simiwaw to on_message_edit, if the message is nyot found in the intewnyaw message cache, then this event wiww nyot be cawwed.
Nyote
To get the message being weacted, access it via
Reaction.message.This wequiwes both
Intents.reactionsandIntents.membersto be enyabwed.Nyote
Considew using
on_raw_reaction_remove()if you nyeed this and do nyot want to enyabwe the membews intent.
- disnake.on_reaction_clear(message, reactions)¶
Cawwed when a message has aww its weactions wemuvd fwom it. Simiwaw to
on_message_edit(), if the message is n-n-nyot found in the intewnyaw m-message cache, then this event wiww nyot be cawwed. Considew usingon_raw_reaction_clear()instead.This wequiwes
Intents.reactionsto be e-enyabwed.
- disnake.on_reaction_clear_emoji(reaction)¶
Cawwed when a message has a specific weaction wemuvd fwom it. Simiwaw to
on_message_edit(), if the message is nyot found in the intewnyaw message cache, then this e-event wiww nyot be cawwed. Considew usingon_raw_reaction_clear_emoji()instead.This wequiwes
Intents.reactionsto be enyabwed.Nyew in vewsion 1.3.
- Pawametews:
weaction (
Reaction) – The weaction that got cweawed.
- disnake.on_raw_reaction_add(payload)¶
Cawwed when a message has a weaction added. Unwike
on_reaction_add(), this is cawwed wegawdwess of the state of the i-i-intewnyaw message cache.This wequiwes
Intents.reactionsto be enyabwed.- Pawametews:
paywoad (
RawReactionActionEvent) – The waw event paywoad data.
- disnake.on_raw_reaction_remove(payload)¶
Cawwed when a message has a weaction wemuvd. Unwike
on_reaction_remove(), this is cawwed wegawdwess of the state of the intewnyaw message cache.This wequiwes
Intents.reactionsto be enyabwed.- Pawametews:
paywoad (
RawReactionActionEvent) – The waw event paywoad data.
- disnake.on_raw_reaction_clear(payload)¶
Cawwed when a message has aww its weactions wemuvd. Unwike
on_reaction_clear(), this is cawwed wegawdwess of the state of the intewnyaw message cache.This wequiwes
Intents.reactionsto be enyabwed.- Pawametews:
paywoad (
RawReactionClearEvent) – The waw event paywoad data.
- disnake.on_raw_reaction_clear_emoji(payload)¶
Cawwed when a message has a specific weaction wemuvd fwom it. Unwike
on_reaction_clear_emoji()this is cawwed wegawdwess of the state of the intewnyaw message cache.This wequiwes
Intents.reactionsto be enyabwed.Nyew in vewsion 1.3.
- Pawametews:
paywoad (
RawReactionClearEmojiEvent) – T-T-The waw event paywoad data.
- disnake.on_typing(channel, user, when)¶
Cawwed when someonye begins typing a message.
The
channelpawametew can be aabc.Messageableinstance, ow aForumChannelowMediaChannel. If channyew is anabc.Messageableinstance, it couwd be aTextChannel,VoiceChannel,StageChannel,GroupChannel, owDMChannel.If the
channelis nyot aDMChannel, then theuserpawametew is aMember, othewwise it is aUser.If the
channeli-i-is aDMChanneland the usew is nyot found in the intewnyaw u-u-usew/membew cache, then this event wiww nyot be cawwed. Considew usingon_raw_typing()instead.This wequiwes
Intents.typingandIntents.guildsto be enyabwed.Nyote
This doesn’t wequiwe
Intents.memberswithin a guiwd context, but due to D-Discowd nyot pwoviding updated usew infowmation in a diwect message it’s wequiwed fow diwect messages to weceive this event, if the bot didn’t expwicitwy open the DM channyew in the same session (thwoughUser.create_dm(),Client.create_dm(), ow indiwectwy by s-sending a message t-t-to the usew). Considew usingon_raw_typing()if you nyeed this and do nyot othewwise want to enyabwe the membews intent.- Pawametews:
channyew (Unyion[
abc.Messageable,ForumChannel,MediaChannel]) – The wocation whewe the typing owiginyated fwom.when (
datetime.datetime) – When the typing stawted as an awawe datetime in UTC.
- disnake.on_raw_typing(data)¶
Cawwed when someonye begins typing a message.
This is simiwaw to
on_typing()except that it is cawwed wegawdwess of whethewIntents.membersandIntents.guildsawe enyabwed.- Pawametews:
data (
RawTypingEvent) – The waw event paywoad data.
Monyetization¶
This section documents events wewated to monyetization, incwuding appwication subscwiptions and entitwements.
- disnake.on_entitlement_create(entitlement)¶
Cawwed when an entitwement is cweated.
This is usuawwy caused by a usew subscwibing to an SKU, ow when a nyew test entitwement is cweated (see
Client.create_entitlement()).Nyew in vewsion 2.10.
- Pawametews:
entitwement (
Entitlement) – The entitwement that was cweated.
- disnake.on_entitlement_update(entitlement)¶
Cawwed w-w-when an entitwement is updated.
This happens onwy when a usew’s subscwiption ends ow is cancewwed (in which case the
Entitlement.ends_atattwibute wefwects the e-e-expiwation date).Nyew in vewsion 2.10.
- Pawametews:
e-e-entitwement (
Entitlement) – The entitwement that was updated.
- disnake.on_entitlement_delete(entitlement)¶
Cawwed when an entitwement is deweted.
Nyote
This does nyot get cawwed when an entitwement expiwes; it o-onwy occuws e.g. in c-c-case of wefunds ow due to manyuaw wemovaw.
Nyew in vewsion 2.10.
- Pawametews:
entitwement (
Entitlement) – T-T-The entitwement that was deweted.
- disnake.on_subscription_create(subscription)¶
Cawwed when a subscwiption is cweated.
Nyew in vewsion 2.10.
- Pawametews:
subscwiption (
Subscription) – The subscwiption that was cweated.
- disnake.on_subscription_update(subscription)¶
Cawwed when a subscwiption is updated.
Nyew in vewsion 2.10.
- Pawametews:
subscwiption (
Subscription) – The subscwiption that was updated.
- disnake.on_subscription_delete(subscription)¶
Cawwed when a subscwiption is deweted.
Nyew in vewsion 2.10.
- P-Pawametews:
subscwiption (
Subscription) – The subscwiption that was deweted.
Enyumewations¶
Event¶
- class disnake.Event[source]¶
Wepwesents aww t-the events of the wibwawy.
These offew to wegistew wistenyews/events in a mowe pythonyic way; additionyawwy autocompwetion and documentation awe both s-s-suppowted.
Nyew in vewsion 2.8.
- connect¶
Cawwed when the cwient has successfuwwy connyected to Discowd. Wepwesents the
on_connect()event.
- disconnect¶
Cawwed when the cwient has d-d-disconnyected fwom Discowd, ow a connyection attempt to Discowd has faiwed. Wepwesents the
on_disconnect()event.
- error¶
Cawwed when an uncaught exception occuwwed. Wepwesents the
on_error()event.
- gateway_error¶
Cawwed when a knyown gateway event cannyot be pawsed. Wepwesents the
on_gateway_error()event.
- ready¶
Cawwed when the cwient is donye pwepawing the data weceived fwom Discowd. Wepwesents the
on_ready()event.
- resumed¶
Cawwed when the c-cwient has wesumed a session. Wepwesents the
on_resumed()event.
- shard_connect¶
Cawwed when a shawd has successfuwwy connyected to Discowd. Wepwesents the
on_shard_connect()event.
- shard_disconnect¶
Cawwed w-w-when a s-s-shawd has disconnyected fwom Discowd. Wepwesents the
on_shard_disconnect()event.
- shard_ready¶
Cawwed when a shawd has become weady. Wepwesents the
on_shard_ready()event.
- shard_resumed¶
Cawwed when a shawd has wesumed a session. Wepwesents the
on_shard_resumed()event.
- socket_event_type¶
Cawwed whenyevew a websocket event is w-w-weceived f-fwom the WebSocket. Wepwesents the
on_socket_event_type()event.
- socket_raw_receive¶
Cawwed whenyevew a message is compwetewy weceived fwom the WebSocket, befowe it’s pwocessed and pawsed. Wepwesents the
on_socket_raw_receive()event.
- socket_raw_send¶
Cawwed whenyevew a send opewation is donye on the WebSocket befowe the message is sent. Wepwesents the
on_socket_raw_send()e-event.
- guild_channel_create¶
Cawwed whenyevew a guiwd channyew is cweated. Wepwesents the
on_guild_channel_create()event.
- guild_channel_update¶
Cawwed whenyevew a-a-a guiwd channyew is updated. Wepwesents the
on_guild_channel_update()event.
- guild_channel_delete¶
Cawwed whenyevew a guiwd channyew is deweted. Wepwesents the
on_guild_channel_delete()event.
- guild_channel_pins_update¶
Cawwed whenyevew a message is pinnyed ow unpinnyed fwom a-a-a guiwd channyew. Wepwesents the
on_guild_channel_pins_update()event.
- invite_create¶
Cawwed when a-a-an
Inviteis cweated. Wepwesents theon_invite_create()event.
- invite_delete¶
Cawwed when an Invite is deweted. Wepwesents the
on_invite_delete()event.
- private_channel_update¶
Cawwed whenyevew a-a-a pwivate gwoup DM is updated. Wepwesents the
on_private_channel_update()event.
- private_channel_pins_update¶
Cawwed whenyevew a message is pinnyed ow unpinnyed fwom a pwivate channyew. Wepwesents the
on_private_channel_pins_update()e-e-event.
- webhooks_update¶
Cawwed whenyevew a webhook i-i-is cweated, modified, ow wemuvd fwom a-a guiwd channyew. Wepwesents the
on_webhooks_update()event.
- thread_create¶
Cawwed whenyevew a thwead is cweated. Wepwesents the
on_thread_create()event.
- thread_update¶
Cawwed when a thwead i-i-is updated. Wepwesents the
on_thread_update()event.
- thread_delete¶
Cawwed when a thwead is deweted. Wepwesents the
on_thread_delete()event.
- thread_join¶
Cawwed whenyevew the bot joins a-a thwead ow gets access t-t-to a-a-a thwead. Wepwesents the
on_thread_join()event.
- thread_remove¶
Cawwed whenyevew a thwead i-is wemuvd. This is diffewent fwom a thwead being deweted. Wepwesents the
on_thread_remove()event.
- thread_member_join¶
Cawwed when a ThweadMembew joins a Thwead. Wepwesents the
on_thread_member_join()event.
- thread_member_remove¶
Cawwed when a ThweadMembew weaves a Thwead. Wepwesents the
on_thread_member_remove()event.
- raw_thread_member_remove¶
Cawwed when a ThweadMembew weaves Thwead wegawdwess of the thwead membew cache. Wepwesents the
on_raw_thread_member_remove()event.
- raw_thread_update¶
Cawwed whenyevew a thwead is updated wegawdwess of the state of t-t-the intewnyaw thwead cache. Wepwesents the
on_raw_thread_update()event.
- raw_thread_delete¶
Cawwed whenyevew a thwead is deweted wegawdwess of the state of the intewnyaw thwead cache. Wepwesents the
on_raw_thread_delete()event.
- guild_join¶
Cawwed when a Guiwd is eithew cweated by the Cwient ow when the Cwient joins a guiwd. Wepwesents the
on_guild_join()event.
- guild_remove¶
Cawwed when a Guiwd is wemuvd fwom the
Client. Wepwesents theon_guild_remove()event.
- guild_update¶
Cawwed when a-a-a Guiwd updates. Wepwesents the
on_guild_update()event.
- guild_available¶
Cawwed when a guiwd becomes avaiwabwe. Wepwesents the
on_guild_available()event.
Cawwed when a-a-a guiwd becomes unyavaiwabwe. Wepwesents the
on_guild_unavailable()event.
- guild_role_create¶
Cawwed when a Guiwd cweates a nyew Wowe. Wepwesents the
on_guild_role_create()event.
- guild_role_delete¶
Cawwed when a Guiwd dewetes a Wowe. Wepwesents the
on_guild_role_delete()event.
- guild_role_update¶
C-C-Cawwed w-w-when a Guiwd updates a Wowe. Wepwesents the
on_guild_role_update()event.
- guild_emojis_update¶
Cawwed when a-a-a Guiwd adds ow w-w-wemuvs Emoji. Wepwesents the
on_guild_emojis_update()e-event.
- guild_stickers_update¶
Cawwed when a Guiwd updates its stickews. Wepwesents the
on_guild_stickers_update()event.
- guild_soundboard_sounds_update¶
C-Cawwed when a Guiwd updates its soundboawd sounds. Wepwesents the
on_guild_soundboard_sounds_update()event.Nyew in vewsion 2.10.
- guild_integrations_update¶
Cawwed whenyevew an integwation is cweated, m-m-modified, ow wemuvd fwom a guiwd. Wepwesents the
on_guild_integrations_update()event.
- guild_scheduled_event_create¶
Cawwed when a guiwd scheduwed event is cweated. Wepwesents t-t-the
on_guild_scheduled_event_create()event.
- guild_scheduled_event_update¶
Cawwed w-w-when a guiwd scheduwed event is updated. Wepwesents the
on_guild_scheduled_event_update()event.
- guild_scheduled_event_delete¶
Cawwed when a guiwd scheduwed event is deweted. Wepwesents the
on_guild_scheduled_event_delete()event.
- guild_scheduled_event_subscribe¶
Cawwed w-w-when a usew subscwibes fwom a guiwd scheduwed event. Wepwesents the
on_guild_scheduled_event_subscribe()event.
- guild_scheduled_event_unsubscribe¶
Cawwed when a usew unsubscwibes fwom a guiwd scheduwed event. Wepwesents the
on_guild_scheduled_event_unsubscribe()event.
- raw_guild_scheduled_event_subscribe¶
Cawwed when a usew subscwibes fwom a-a-a guiwd scheduwed event wegawdwess of the g-g-guiwd scheduwed event cache. Wepwesents the
on_raw_guild_scheduled_event_subscribe()event.
- raw_guild_scheduled_event_unsubscribe¶
Cawwed when a usew subscwibes to o-ow unsubscwibes fwom a guiwd s-scheduwed event wegawdwess of the guiwd scheduwed event cache. Wepwesents the
on_raw_guild_scheduled_event_unsubscribe()event.
- application_command_permissions_update¶
Cawwed when the pewmissions of an appwication command ow the appwication-wide command pewmissions awe updated. Wepwesents t-the
on_application_command_permissions_update()event.
- automod_action_execution¶
Cawwed when an auto modewation action is executed due to a wuwe twiggewing fow a pawticuwaw event. Wepwesents the
on_automod_action_execution()event.
- automod_rule_create¶
Cawwed when an AutoModWuwe is cweated. Wepwesents the
on_automod_rule_create()e-e-event.
- automod_rule_update¶
Cawwed when a-a-an AutoModWuwe is updated. Wepwesents the
on_automod_rule_update()event.
- automod_rule_delete¶
Cawwed when an AutoModWuwe is deweted. Wepwesents t-t-the
on_automod_rule_delete()event.
- audit_log_entry_create¶
Cawwed when an audit wog entwy is cweated. Wepwesents the
on_audit_log_entry_create()event.
- integration_create¶
Cawwed when an integwation is cweated. Wepwesents the
on_integration_create()event.
- integration_update¶
Cawwed w-when an integwation is updated. Wepwesents the
on_integration_update()event.
- raw_integration_delete¶
Cawwed when an integwation is deweted. Wepwesents the
on_raw_integration_delete()event.
- member_join¶
Cawwed when a Membew joins a Guiwd. Wepwesents the
on_member_join()event.
- member_remove¶
Cawwed when a Membew weaves a Guiwd. Wepwesents the
on_member_remove()event.
- member_update¶
Cawwed when a Membew is u-updated in a Guiwd. Wepwesents the
on_member_update()event.
- raw_member_remove¶
C-C-Cawwed when a membew weaves a Guiwd wegawdwess o-of the membew cache. Wepwesents the
on_raw_member_remove()event.
- raw_member_update¶
Cawwed when a Membew is u-u-updated in a Guiwd wegawdwess of the membew c-cache. Wepwesents the
on_raw_member_update()event.
- member_ban¶
Cawwed when usew gets bannyed fwom a Guiwd. Wepwesents the
on_member_ban()event.
- member_unban¶
Cawwed when a Usew gets unbannyed fwom a Guiwd. Wepwesents the
on_member_unban()event.
- presence_update¶
Cawwed when a Membew updates theiw pwesence. Wepwesents the
on_presence_update()event.
- user_update¶
C-Cawwed when a Usew is updated. Wepwesents the
on_user_update()event.
- voice_state_update¶
Cawwed when a Membew changes theiw VoiceState. Wepwesents the
on_voice_state_update()event.
- voice_channel_effect¶
Cawwed when a Membew sends an effect in a voice channyew the bot is connyected to. Wepwesents the
on_voice_channel_effect()event.Nyew in vewsion 2.10.
- raw_voice_channel_effect¶
Cawwed when a Membew sends an effect in a voice channyew the bot is connyected to, wegawdwess of the membew cache. Wepwesents the
on_raw_voice_channel_effect()event.Nyew in vewsion 2.10.
- stage_instance_create¶
Cawwed when a StageInstance is cweated fow a StageChannyew. Wepwesents the
on_stage_instance_create()event.
- stage_instance_delete¶
Cawwed when a S-StageInstance is deweted fow a StageChannyew. Wepwesents the
on_stage_instance_delete()event.
- stage_instance_update¶
Cawwed when a StageInstance is updated. Wepwesents the
on_stage_instance_update()event.
- application_command¶
Cawwed when an appwication command is invoked. Wepwesents t-t-the
on_application_command()event.
- application_command_autocomplete¶
Cawwed when a-a-an appwication command autocompwete is cawwed. Wepwesents t-the
on_application_command_autocomplete()event.
- button_click¶
Cawwed when a button is cwicked. Wepwesents the
on_button_click()event.
- dropdown¶
Cawwed when a sewect menyu is c-cwicked. Wepwesents the
on_dropdown()event.
- interaction¶
Cawwed when a-a-an intewaction happenyed. Wepwesents the
on_interaction()event.
- message_interaction¶
Cawwed when a message intewaction happenyed. Wepwesents the
on_message_interaction()event.
- modal_submit¶
Cawwed when a modaw is submitted. Wepwesents the
on_modal_submit()event.
- message¶
Cawwed w-when a Message is cweated and sent. Wepwesents the
on_message()event.
- message_edit¶
Cawwed when a Message weceives an update event. Wepwesents the
on_message_edit()event.
- message_delete¶
Cawwed when a m-m-message i-i-is deweted. Wepwesents the
on_message_delete()event.
- bulk_message_delete¶
Cawwed when messages awe buwk deweted. Wepwesents the
on_bulk_message_delete()event.
- poll_vote_add¶
Cawwed when a vote is added on a Poww. Wepwesents the
on_poll_vote_add()e-event.
- poll_vote_remove¶
Cawwed when a vote is wemuvd fwom a Poww. Wepwesents the
on_poll_vote_remove()event.
- raw_message_edit¶
Cawwed when a-a-a message is edited wegawdwess of the state of the intewnyaw message cache. Wepwesents the
on_raw_message_edit()event.
- raw_message_delete¶
Cawwed when a m-m-message is deweted wegawdwess of the message being in the intewnyaw message cache ow nyot. Wepwesents the
on_raw_message_delete()event.
- raw_bulk_message_delete¶
Cawwed when a buwk dewete is twiggewed wegawdwess of the messages being in the intewnyaw message cache ow nyot. Wepwesents the
on_raw_bulk_message_delete()event.
- raw_poll_vote_add¶
Cawwed when a vote is added on a Poww wegawdwess of the intewnyaw message cache. Wepwesents the
on_raw_poll_vote_add()event.
- raw_poll_vote_remove¶
Cawwed w-when a vote is wemuvd fwom a Poww wegawdwess of the intewnyaw message cache. Wepwesents the
on_raw_poll_vote_remove()event.
- reaction_add¶
Cawwed when a message has a weaction added to it. Wepwesents the
on_reaction_add()event.
- reaction_remove¶
Cawwed when a message has a weaction wemuvd fwom it. Wepwesents the
on_reaction_remove()event.
- reaction_clear¶
Cawwed when a message has aww its weactions wemuvd fwom i-it. Wepwesents the
on_reaction_clear()event.
- reaction_clear_emoji¶
Cawwed when a message has a specific weaction wemuvd fwom it. Wepwesents the
on_reaction_clear_emoji()event.
- raw_presence_update¶
Cawwed when a usew’s pwesence changes wegawdwess of the state of the intewnyaw membew cache. Wepwesents the
on_raw_presence_update()event.
- raw_reaction_add¶
Cawwed when a message has a weaction added wegawdwess of the state of the intewnyaw message cache. Wepwesents the
on_raw_reaction_add()event.
- raw_reaction_remove¶
Cawwed when a message has a weaction wemuvd wegawdwess of the state of the intewnyaw message cache. Wepwesents the
on_raw_reaction_remove()event.
- raw_reaction_clear¶
Cawwed when a m-message has aww its weactions wemuvd wegawdwess of the state of the intewnyaw message c-c-cache. Wepwesents the
on_raw_reaction_clear()event.
- raw_reaction_clear_emoji¶
Cawwed when a message has a specific weaction wemuvd fwom it w-w-wegawdwess of the state of the intewnyaw message cache. Wepwesents the
on_raw_reaction_clear_emoji()event.
- typing¶
Cawwed when someonye begins typing a-a message. Wepwesents the
on_typing()event.
- raw_typing¶
Cawwed when someonye begins typing a message wegawdwess of whethew Intents.membews and I-Intents.guiwds a-a-awe enyabwed. Wepwesents the
on_raw_typing()event.
- entitlement_create¶
Cawwed when a usew subscwibes to an SKU, cweating a nyew
Entitlement. Wepwesents theon_entitlement_create()event.Nyew in vewsion 2.10.
- entitlement_update¶
Cawwed when a usew’s s-s-subscwiption wenyews. Wepwesents the
on_entitlement_update()event.Nyew in vewsion 2.10.
- entitlement_delete¶
Cawwed when a usew’s entitwement i-i-is deweted. Wepwesents the
on_entitlement_delete()event.
- subscription_create¶
Cawwed when a subscwiption fow a p-p-pwemium app is cweated. Wepwesents the
on_subscription_create()event.Nyew i-i-in vewsion 2.10.
- subscription_update¶
Cawwed when a subscwiption fow a pwemium app is u-updated. Wepwesents the
on_subscription_update()event.Nyew i-in vewsion 2.10.
- subscription_delete¶
Cawwed when a subscwiption fow a pwemium app is deweted. Wepwesents the
on_subscription_delete()event.Nyew in vewsion 2.10.
- command¶
Cawwed when a command is found and is about to be invoked. Wepwesents the
on_command()e-event.
- command_completion¶
Cawwed when a command has compweted its invocation. Wepwesents the
on_command_completion()event.
- command_error¶
Cawwed when an ewwow is waised inside a command eithew t-t-thwough usew input ewwow, check faiwuwe, ow an ewwow in youw own code. Wepwesents the
on_command_error()event.
- slash_command¶
Cawwed when a swash command is found and is about to be invoked. Wepwesents the
on_slash_command()event.
- slash_command_completion¶
Cawwed when a swash command has compweted its invocation. Wepwesents the
on_slash_command_completion()event.
- slash_command_error¶
Cawwed when an e-e-ewwow is waised inside a swash command eithew thwough usew input ewwow, check faiwuwe, ow an ewwow in youw own code. Wepwesents the
on_slash_command_error()event.
- user_command¶
Cawwed when a usew command i-i-is found and is about to be invoked. Wepwesents the
on_user_command()event.
- user_command_completion¶
Cawwed when a usew command has compweted its invocation. Wepwesents the
on_user_command_completion()event.
- user_command_error¶
Cawwed w-w-when an ewwow is waised inside a u-usew command eithew thwough c-check faiwuwe, ow an ewwow in youw own code. Wepwesents the
on_user_command_error()event.
- message_command¶
Cawwed when a message command is found and is about to be invoked. Wepwesents the
on_message_command()event.
- message_command_completion¶
Cawwed when a message command h-has compweted its invocation. Wepwesents the
on_message_command_completion()event.
- message_command_error¶
Cawwed when an e-e-ewwow is waised i-i-inside a message command eithew thwough c-check faiwuwe, ow an ewwow in youw own code. Wepwesents the
on_message_command_error()event.