API Reference¶
The following section outlines the API of disnake.
Note
This module uses the Python logging module to log diagnostic and errors in an output independent way. If the logging module is not configured, these logs will not be output anywhere. See Setting Up Logging for more information on how to set up and use the logging module with disnake.
Clients¶
Client¶
- activity
- allowed_mentions
- application_flags
- application_id
- cached_messages
- emojis
- global_application_commands
- global_message_commands
- global_slash_commands
- global_user_commands
- guilds
- i18n
- intents
- latency
- loop
- persistent_views
- private_channels
- session_start_limit
- status
- stickers
- user
- users
- voice_clients
- ws
- defadd_view
- asyncapplication_info
- asyncbefore_identify_hook
- asyncbulk_fetch_command_permissions
- asyncbulk_overwrite_global_commands
- asyncbulk_overwrite_guild_commands
- asyncchange_presence
- defclear
- asyncclose
- asyncconnect
- asynccreate_dm
- asynccreate_global_command
- asynccreate_guild
- asynccreate_guild_command
- asyncdelete_global_command
- asyncdelete_guild_command
- asyncdelete_invite
- asyncedit_global_command
- asyncedit_guild_command
- asyncedit_role_connection_metadata
- @event
- asyncfetch_channel
- asyncfetch_command_permissions
- asyncfetch_global_command
- asyncfetch_global_commands
- asyncfetch_guild
- asyncfetch_guild_command
- asyncfetch_guild_commands
- asyncfetch_guild_preview
- deffetch_guilds
- asyncfetch_invite
- asyncfetch_premium_sticker_packs
- asyncfetch_role_connection_metadata
- asyncfetch_stage_instance
- asyncfetch_sticker
- asyncfetch_template
- asyncfetch_user
- asyncfetch_voice_regions
- asyncfetch_webhook
- asyncfetch_widget
- defget_all_channels
- defget_all_members
- defget_channel
- defget_emoji
- defget_global_command
- defget_global_command_named
- defget_guild
- defget_guild_application_commands
- defget_guild_command
- defget_guild_command_named
- defget_guild_message_commands
- defget_guild_slash_commands
- defget_guild_user_commands
- defget_message
- asyncget_or_fetch_user
- defget_partial_messageable
- defget_stage_instance
- defget_sticker
- defget_user
- asyncgetch_user
- defguild_builder
- defis_closed
- defis_ready
- defis_ws_ratelimited
- asynclogin
- asyncon_error
- asyncon_gateway_error
- defrun
- asyncstart
- asyncwait_for
- asyncwait_until_first_connect
- asyncwait_until_ready
- class disnake.Client(*, asyncio_debug=False, loop=None, shard_id=None, shard_count=None, enable_debug_events=False, enable_gateway_error_handler=True, localization_provider=None, strict_localization=False, gateway_params=None, connector=None, proxy=None, proxy_auth=None, assume_unsync_clock=True, max_messages=1000, application_id=None, heartbeat_timeout=60.0, guild_ready_timeout=2.0, allowed_mentions=None, activity=None, status=None, intents=None, chunk_guilds_at_startup=None, member_cache_flags=None)[source]¶
Represents a client connection that connects to Discord. This class is used to interact with the Discord WebSocket and API.
A number of options can be passed to the
Client
.- Parameters:
max_messages (Optional[
int
]) –The maximum number of messages to store in the internal message cache. This defaults to
1000
. Passing inNone
disables the message cache.Changed in version 1.3: Allow disabling the message cache and change the default size to
1000
.loop (Optional[
asyncio.AbstractEventLoop
]) – Theasyncio.AbstractEventLoop
to use for asynchronous operations. Defaults toNone
, in which case the default event loop is used viaasyncio.get_event_loop()
.asyncio_debug (
bool
) – Whether to enable asyncio debugging when the client starts. Defaults to False.connector (Optional[
aiohttp.BaseConnector
]) – The connector to use for connection pooling.proxy (Optional[
str
]) – Proxy URL.proxy_auth (Optional[
aiohttp.BasicAuth
]) – An object that represents proxy HTTP Basic Authorization.shard_id (Optional[
int
]) – Integer starting at0
and less thanshard_count
.shard_count (Optional[
int
]) – The total number of shards.application_id (
int
) – The client’s application ID.intents (Optional[
Intents
]) –The intents that you want to enable for the session. This is a way of disabling and enabling certain gateway events from triggering and being sent. If not given, defaults to a regularly constructed
Intents
class.New in version 1.5.
member_cache_flags (
MemberCacheFlags
) –Allows for finer control over how the library caches members. If not given, defaults to cache as much as possible with the currently selected intents.
New in version 1.5.
chunk_guilds_at_startup (
bool
) –Indicates if
on_ready()
should be delayed to chunk all guilds at start-up if necessary. This operation is incredibly slow for large amounts of guilds. The default isTrue
ifIntents.members
isTrue
.New in version 1.5.
status (Optional[Union[class:str,
Status
]]) – A status to start your presence with upon logging on to Discord.activity (Optional[
BaseActivity
]) – An activity to start your presence with upon logging on to Discord.allowed_mentions (Optional[
AllowedMentions
]) –Control how the client handles mentions by default on every message sent.
New in version 1.4.
heartbeat_timeout (
float
) – The maximum numbers of seconds before timing out and restarting the WebSocket in the case of not receiving a HEARTBEAT_ACK. Useful if processing the initial packets take too long to the point of disconnecting you. The default timeout is 60 seconds.guild_ready_timeout (
float
) –The maximum number of seconds to wait for the GUILD_CREATE stream to end before preparing the member cache and firing READY. The default timeout is 2 seconds.
New in version 1.4.
assume_unsync_clock (
bool
) –Whether to assume the system clock is unsynced. This applies to the ratelimit handling code. If this is set to
True
, the default, then the library uses the time to reset a rate limit bucket given by Discord. If this isFalse
then your system clock is used to calculate how long to sleep for. If this is set toFalse
it is recommended to sync your system clock to Google’s NTP server.New in version 1.3.
enable_debug_events (
bool
) –Whether to enable events that are useful only for debugging gateway related information.
Right now this involves
on_socket_raw_receive()
andon_socket_raw_send()
. If this isFalse
then those events will not be dispatched (due to performance considerations). To enable these events, this must be set toTrue
. Defaults toFalse
.New in version 2.0.
enable_gateway_error_handler (
bool
) –Whether to enable the
disnake.on_gateway_error()
event. Defaults toTrue
.If this is disabled, exceptions that occur while parsing (known) gateway events won’t be handled and the pre-v2.6 behavior of letting the exception propagate up to the
connect()
/start()
/run()
call is used instead.New in version 2.6.
localization_provider (
LocalizationProtocol
) –An implementation of
LocalizationProtocol
to use for localization of application commands. If not provided, the defaultLocalizationStore
implementation is used.New in version 2.5.
Changed in version 2.6: Can no longer be provided together with
strict_localization
, as it does not apply to the custom localization provider entered in this parameter.strict_localization (
bool
) –Whether to raise an exception when localizations for a specific key couldn’t be found. This is mainly useful for testing/debugging, consider disabling this eventually as missing localized names will automatically fall back to the default/base name without it. Only applicable if the
localization_provider
parameter is not provided. Defaults toFalse
.New in version 2.5.
Changed in version 2.6: Can no longer be provided together with
localization_provider
, as this parameter is ignored for custom localization providers.gateway_params (
GatewayParams
) –Allows configuring parameters used for establishing gateway connections, notably enabling/disabling compression (enabled by default). Encodings other than JSON are not supported.
New in version 2.6.
- ws¶
The websocket gateway the client is currently connected to. Could be
None
.
- loop¶
The event loop that the client uses for asynchronous operations.
- session_start_limit¶
Information about the current session start limit. Only available after initiating the connection.
New in version 2.5.
- Type:
Optional[
SessionStartLimit
]
- i18n¶
An implementation of
LocalizationProtocol
used for localization of application commands.New in version 2.5.
- Type:
- @event[source]¶
A decorator that registers an event to listen to.
You can find more info about the events on the documentation below.
The events must be a coroutine, if not,
TypeError
is raised.Example
@client.event async def on_ready(): print('Ready!')
- Raises:
TypeError – The coroutine passed is not actually a coroutine.
- async for ... in fetch_guilds(*, limit=100, before=None, after=None)[source]¶
Retrieves an
AsyncIterator
that enables receiving your guilds.Note
Using this, you will only receive
Guild.owner
,Guild.icon
,Guild.id
, andGuild.name
perGuild
.Note
This method is an API call. For general usage, consider
guilds
instead.Examples
Usage
async for guild in client.fetch_guilds(limit=150): print(guild.name)
Flattening into a list
guilds = await client.fetch_guilds(limit=150).flatten() # guilds is now a list of Guild...
All parameters are optional.
- Parameters:
limit (Optional[
int
]) – The number of guilds to retrieve. IfNone
, it retrieves every guild you have access to. Note, however, that this would make it a slow operation. Defaults to100
.before (Union[
abc.Snowflake
,datetime.datetime
]) – Retrieves guilds before this date or object. If a datetime is provided, it is recommended to use a UTC aware datetime. If the datetime is naive, it is assumed to be local time.after (Union[
abc.Snowflake
,datetime.datetime
]) – Retrieve guilds after this date or object. If a datetime is provided, it is recommended to use a UTC aware datetime. If the datetime is naive, it is assumed to be local time.
- Raises:
HTTPException – Retrieving the guilds failed.
- Yields:
Guild
– The guild with the guild data parsed.
- property latency[source]¶
Measures latency between a HEARTBEAT and a HEARTBEAT_ACK in seconds.
This could be referred to as the Discord WebSocket protocol latency.
- Type:
- is_ws_ratelimited()[source]¶
Whether the websocket is currently rate limited.
This can be useful to know when deciding whether you should query members using HTTP or via the gateway.
New in version 1.6.
- Return type:
- property user[source]¶
Represents the connected client.
None
if not logged in.- Type:
Optional[
ClientUser
]
- property stickers[source]¶
The stickers that the connected client has.
New in version 2.0.
- Type:
List[
GuildSticker
]
- property cached_messages[source]¶
Read-only list of messages the connected client has cached.
New in version 1.1.
- Type:
Sequence[
Message
]
- property private_channels[source]¶
The private channels that the connected client is participating on.
Note
This returns only up to 128 most recent private channels due to an internal working on how Discord deals with private channels.
- Type:
List[
abc.PrivateChannel
]
- property voice_clients[source]¶
Represents a list of voice connections.
These are usually
VoiceClient
instances.- Type:
List[
VoiceProtocol
]
- property application_id[source]¶
The client’s application ID.
If this is not passed via
__init__
then this is retrieved through the gateway when an event contains the data. Usually afteron_connect()
is called.New in version 2.0.
- Type:
Optional[
int
]
- property global_application_commands[source]¶
The client’s global application commands.
- Type:
List[Union[
APIUserCommand
,APIMessageCommand
,APISlashCommand
]
- property global_slash_commands[source]¶
The client’s global slash commands.
- Type:
List[
APISlashCommand
]
- property global_user_commands[source]¶
The client’s global user commands.
- Type:
List[
APIUserCommand
]
- property global_message_commands[source]¶
The client’s global message commands.
- Type:
List[
APIMessageCommand
]
- await get_or_fetch_user(user_id, *, strict=False)[source]¶
This function is a coroutine.
Tries to get the user from the cache. If fails, it tries to fetch the user from the API.
- Parameters:
user_id (
int
) – The ID to search for.strict (
bool
) – Whether to propagate exceptions fromfetch_user()
instead of returningNone
in case of failure (e.g. if the user wasn’t found). Defaults toFalse
.
- Returns:
The user with the given ID, or
None
if not found andstrict
is set toFalse
.- Return type:
Optional[
User
]
- await getch_user(user_id, *, strict=False)[source]¶
This function is a coroutine.
Tries to get the user from the cache. If fails, it tries to fetch the user from the API.
- Parameters:
user_id (
int
) – The ID to search for.strict (
bool
) – Whether to propagate exceptions fromfetch_user()
instead of returningNone
in case of failure (e.g. if the user wasn’t found). Defaults toFalse
.
- Returns:
The user with the given ID, or
None
if not found andstrict
is set toFalse
.- Return type:
Optional[
User
]
- await on_error(event_method, *args, **kwargs)[source]¶
This function is a coroutine.
The default error handler provided by the client.
By default this prints to
sys.stderr
however it could be overridden to have a different implementation. Checkon_error()
for more details.
- await on_gateway_error(event, data, shard_id, exc, /)[source]¶
This function is a coroutine.
The default gateway error handler provided by the client.
By default this prints to
sys.stderr
however it could be overridden to have a different implementation. Checkon_gateway_error()
for more details.New in version 2.6.
Note
Unlike
on_error()
, the exception is available as theexc
parameter and cannot be obtained throughsys.exc_info()
.
- await before_identify_hook(shard_id, *, initial=False)[source]¶
This function is a coroutine.
A hook that is called before IDENTIFYing a session. This is useful if you wish to have more control over the synchronization of multiple IDENTIFYing clients.
The default implementation sleeps for 5 seconds.
New in version 1.4.
- await login(token)[source]¶
This function is a coroutine.
Logs in the client with the specified credentials.
- Parameters:
token (
str
) – The authentication token. Do not prefix this token with anything as the library will do it for you.- Raises:
LoginFailure – The wrong credentials are passed.
HTTPException – An unknown HTTP related error occurred, usually when it isn’t 200 or the known incorrect credentials passing status code.
- await connect(*, reconnect=True, ignore_session_start_limit=False)[source]¶
This function is a coroutine.
Creates a websocket connection and lets the websocket listen to messages from Discord. This is a loop that runs the entire event system and miscellaneous aspects of the library. Control is not resumed until the WebSocket connection is terminated.
Changed in version 2.6: Added usage of
SessionStartLimit
when connecting to the API. Added theignore_session_start_limit
parameter.- Parameters:
reconnect (
bool
) – Whether reconnecting should be attempted, either due to internet failure or a specific failure on Discord’s part. Certain disconnects that lead to bad state will not be handled (such as invalid sharding payloads or bad tokens).ignore_session_start_limit (
bool
) –Whether the API provided session start limit should be ignored when connecting to the API.
New in version 2.6.
- Raises:
GatewayNotFound – If the gateway to connect to Discord is not found. Usually if this is thrown then there is a Discord API outage.
ConnectionClosed – The websocket connection has been terminated.
SessionStartLimitReached – If the client doesn’t have enough connects remaining in the current 24-hour window and
ignore_session_start_limit
isFalse
this will be raised rather than connecting to the gateawy and Discord resetting the token. However, ifignore_session_start_limit
isTrue
, the client will connect regardless and this exception will not be raised.
- clear()[source]¶
Clears the internal state of the bot.
After this, the bot can be considered “re-opened”, i.e.
is_closed()
andis_ready()
both returnFalse
along with the bot’s internal cache cleared.
- await start(token, *, reconnect=True, ignore_session_start_limit=False)[source]¶
This function is a coroutine.
A shorthand coroutine for
login()
+connect()
.- Raises:
TypeError – An unexpected keyword argument was received.
- run(*args, **kwargs)[source]¶
A blocking call that abstracts away the event loop initialisation from you.
If you want more control over the event loop then this function should not be used. Use
start()
coroutine orconnect()
+login()
.Roughly Equivalent to:
try: loop.run_until_complete(start(*args, **kwargs)) except KeyboardInterrupt: loop.run_until_complete(close()) # cancel all tasks lingering finally: loop.close()
Warning
This function must be the last function to call due to the fact that it is blocking. That means that registration of events or anything being called after this function call will not execute until it returns.
- property activity[source]¶
The activity being used upon logging in.
- Type:
Optional[
BaseActivity
]
- property status[source]¶
The status being used upon logging on to Discord.
New in version 2.0.
- Type:
- property allowed_mentions[source]¶
The allowed mention configuration.
New in version 1.4.
- Type:
Optional[
AllowedMentions
]
- get_channel(id, /)[source]¶
Returns a channel or thread with the given ID.
- Parameters:
id (
int
) – The ID to search for.- Returns:
The returned channel or
None
if not found.- Return type:
Optional[Union[
abc.GuildChannel
,Thread
,abc.PrivateChannel
]]
- get_partial_messageable(id, *, type=None)[source]¶
Returns a partial messageable with the given channel ID.
This is useful if you have a channel_id but don’t want to do an API call to send messages to it.
New in version 2.0.
- Parameters:
id (
int
) – The channel ID to create a partial messageable for.type (Optional[
ChannelType
]) – The underlying channel type for the partial messageable.
- Returns:
The partial messageable
- Return type:
- get_stage_instance(id, /)[source]¶
Returns a stage instance with the given stage channel ID.
New in version 2.0.
- Parameters:
id (
int
) – The ID to search for.- Returns:
The returns stage instance or
None
if not found.- Return type:
Optional[
StageInstance
]
- get_sticker(id, /)[source]¶
Returns a guild sticker with the given ID.
New in version 2.0.
Note
To retrieve standard stickers, use
fetch_sticker()
. orfetch_premium_sticker_packs()
.- Returns:
The sticker or
None
if not found.- Return type:
Optional[
GuildSticker
]
- for ... in get_all_channels()[source]¶
A generator that retrieves every
abc.GuildChannel
the client can ‘access’.This is equivalent to:
for guild in client.guilds: for channel in guild.channels: yield channel
Note
Just because you receive a
abc.GuildChannel
does not mean that you can communicate in said channel.abc.GuildChannel.permissions_for()
should be used for that.- Yields:
abc.GuildChannel
– A channel the client can ‘access’.
- for ... in get_all_members()[source]¶
Returns a generator with every
Member
the client can see.This is equivalent to:
for guild in client.guilds: for member in guild.members: yield member
- Yields:
Member
– A member the client can see.
- get_guild_application_commands(guild_id)[source]¶
Returns a list of all application commands in the guild with the given ID.
- Parameters:
guild_id (
int
) – The ID to search for.- Returns:
The list of application commands.
- Return type:
List[Union[
APIUserCommand
,APIMessageCommand
,APISlashCommand
]]
- get_guild_slash_commands(guild_id)[source]¶
Returns a list of all slash commands in the guild with the given ID.
- Parameters:
guild_id (
int
) – The ID to search for.- Returns:
The list of slash commands.
- Return type:
List[
APISlashCommand
]
- get_guild_user_commands(guild_id)[source]¶
Returns a list of all user commands in the guild with the given ID.
- Parameters:
guild_id (
int
) – The ID to search for.- Returns:
The list of user commands.
- Return type:
List[
APIUserCommand
]
- get_guild_message_commands(guild_id)[source]¶
Returns a list of all message commands in the guild with the given ID.
- Parameters:
guild_id (
int
) – The ID to search for.- Returns:
The list of message commands.
- Return type:
List[
APIMessageCommand
]
- get_global_command(id)[source]¶
Returns a global application command with the given ID.
- Parameters:
id (
int
) – The ID to search for.- Returns:
The application command.
- Return type:
Optional[Union[
APIUserCommand
,APIMessageCommand
,APISlashCommand
]]
- get_guild_command(guild_id, id)[source]¶
Returns a guild application command with the given guild ID and application command ID.
- Parameters:
- Returns:
The application command.
- Return type:
Optional[Union[
APIUserCommand
,APIMessageCommand
,APISlashCommand
]]
- get_global_command_named(name, cmd_type=None)[source]¶
Returns a global application command matching the given name.
- Parameters:
name (
str
) – The name to look for.cmd_type (
ApplicationCommandType
) – The type to look for. By default, no types are checked.
- Returns:
The application command.
- Return type:
Optional[Union[
APIUserCommand
,APIMessageCommand
,APISlashCommand
]]
- get_guild_command_named(guild_id, name, cmd_type=None)[source]¶
Returns a guild application command matching the given name.
- Parameters:
guild_id (
int
) – The guild ID to search for.name (
str
) – The command name to search for.cmd_type (
ApplicationCommandType
) – The type to look for. By default, no types are checked.
- Returns:
The application command.
- Return type:
Optional[Union[
APIUserCommand
,APIMessageCommand
,APISlashCommand
]]
- await wait_until_ready()[source]¶
This function is a coroutine.
Waits until the client’s internal cache is all ready.
- await wait_until_first_connect()[source]¶
This function is a coroutine.
Waits until the first connect.
- wait_for(event, *, check=None, timeout=None)[source]¶
This function is a coroutine.
Waits for a WebSocket event to be dispatched.
This could be used to wait for a user to reply to a message, or to react to a message, or to edit a message in a self-contained way.
The
timeout
parameter is passed ontoasyncio.wait_for()
. By default, it does not timeout. Note that this does propagate theasyncio.TimeoutError
for you in case of timeout and is provided for ease of use.In case the event returns multiple arguments, a
tuple
containing those arguments is returned instead. Please check the documentation for a list of events and their parameters.This function returns the first event that meets the requirements.
Examples
Waiting for a user reply:
@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 msg = await client.wait_for('message', check=check) await channel.send(f'Hello {msg.author}!') # using events enums: @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 msg = await client.wait_for(Event.message, check=check) await channel.send(f'Hello {msg.author}!')
Waiting for a thumbs up reaction from the message author:
@client.event async def on_message(message): if message.content.startswith('$thumb'): channel = message.channel await channel.send('Send me that 👍 reaction, mate') def check(reaction, user): return user == message.author and str(reaction.emoji) == '👍' try: reaction, user = await client.wait_for('reaction_add', timeout=60.0, check=check) except asyncio.TimeoutError: await channel.send('👎') else: await channel.send('👍')
- Parameters:
event (Union[
str
,Event
]) – The event name, similar to the event reference, but without theon_
prefix, to wait for. It’s recommended to useEvent
.check (Optional[Callable[…,
bool
]]) – A predicate to check what to wait for. The arguments must meet the parameters of the event being waited for.timeout (Optional[
float
]) – The number of seconds to wait before timing out and raisingasyncio.TimeoutError
.
- Raises:
asyncio.TimeoutError – If a timeout is provided and it was reached.
- Returns:
Returns no arguments, a single argument, or a
tuple
of multiple arguments that mirrors the parameters passed in the event reference.- Return type:
Any
- await change_presence(*, activity=None, status=None)[source]¶
This function is a coroutine.
Changes the client’s presence.
Changed in version 2.6: Raises
TypeError
instead ofInvalidArgument
.Example
game = disnake.Game("with the API") await client.change_presence(status=disnake.Status.idle, activity=game)
Changed in version 2.0: Removed the
afk
keyword-only parameter.- Parameters:
activity (Optional[
BaseActivity
]) – The activity being done.None
if no currently active activity is done.status (Optional[
Status
]) – Indicates what status to change to. IfNone
, thenStatus.online
is used.
- Raises:
TypeError – If the
activity
parameter is not the proper type.
- await fetch_template(code)[source]¶
This function is a coroutine.
Retrieves a
Template
from a discord.new URL or code.- Parameters:
code (Union[
Template
,str
]) – The Discord Template Code or URL (must be a discord.new URL).- Raises:
NotFound – The template is invalid.
HTTPException – Retrieving the template failed.
- Returns:
The template from the URL/code.
- Return type:
- await fetch_guild(guild_id, /)[source]¶
This function is a coroutine.
Retrieves a
Guild
from the given ID.Note
Using this, you will not receive
Guild.channels
,Guild.members
,Member.activity
andMember.voice
perMember
.Note
This method is an API call. For general usage, consider
get_guild()
instead.- Parameters:
guild_id (
int
) – The ID of the guild to retrieve.- Raises:
Forbidden – You do not have access to the guild.
HTTPException – Retrieving the guild failed.
- Returns:
The guild from the given ID.
- Return type:
- await fetch_guild_preview(guild_id, /)[source]¶
This function is a coroutine.
Retrieves a
GuildPreview
from the given ID. Your bot does not have to be in this guild.Note
This method may fetch any guild that has
DISCOVERABLE
inGuild.features
, but this information can not be known ahead of time.This will work for any guild that you are in.
- await create_guild(*, name, icon=..., code=...)[source]¶
This function is a coroutine.
Creates a
Guild
.See
guild_builder()
for a more comprehensive alternative.Bot accounts in 10 or more guilds are not allowed to create guilds.
Changed in version 2.5: Removed the
region
parameter.Changed in version 2.6: Raises
ValueError
instead ofInvalidArgument
.- Parameters:
name (
str
) – The name of the guild.icon (Union[
bytes
,Asset
,Emoji
,PartialEmoji
,StickerItem
,Sticker
]) –The icon of the guild. See
ClientUser.edit()
for more details on what is expected.Changed in version 2.5: Now accepts various resource types in addition to
bytes
.code (
str
) –The code for a template to create the guild with.
New in version 1.4.
- Raises:
NotFound – The
icon
asset couldn’t be found.HTTPException – Guild creation failed.
ValueError – Invalid icon image format given. Must be PNG or JPG.
TypeError – The
icon
asset is a lottie sticker (seeSticker.read
).
- Returns:
The created guild. This is not the same guild that is added to cache.
- Return type:
- guild_builder(name)[source]¶
Creates a builder object that can be used to create more complex guilds.
This is a more comprehensive alternative to
create_guild()
. SeeGuildBuilder
for details and examples.Bot accounts in 10 or more guilds are not allowed to create guilds.
New in version 2.8.
- Parameters:
name (
str
) – The name of the guild.- Returns:
The guild builder object for configuring and creating a new guild.
- Return type:
- await fetch_stage_instance(channel_id, /)[source]¶
This function is a coroutine.
Retrieves a
StageInstance
with the given ID.Note
This method is an API call. For general usage, consider
get_stage_instance()
instead.New in version 2.0.
- Parameters:
channel_id (
int
) – The stage channel ID.- Raises:
NotFound – The stage instance or channel could not be found.
HTTPException – Retrieving the stage instance failed.
- Returns:
The stage instance from the given ID.
- Return type:
- await fetch_invite(url, *, with_counts=True, with_expiration=True, guild_scheduled_event_id=None)[source]¶
This function is a coroutine.
Retrieves an
Invite
from a discord.gg URL or ID.Note
If the invite is for a guild you have not joined, the guild and channel attributes of the returned
Invite
will bePartialInviteGuild
andPartialInviteChannel
respectively.- Parameters:
url (Union[
Invite
,str
]) – The Discord invite ID or URL (must be a discord.gg URL).with_counts (
bool
) – Whether to include count information in the invite. This fills theInvite.approximate_member_count
andInvite.approximate_presence_count
fields.with_expiration (
bool
) –Whether to include the expiration date of the invite. This fills the
Invite.expires_at
field.New in version 2.0.
guild_scheduled_event_id (
int
) –The ID of the scheduled event to include in the invite. If not provided, defaults to the
event
parameter in the URL if it exists, or the ID of the scheduled event contained in the provided invite object.New in version 2.3.
- Raises:
NotFound – The invite has expired or is invalid.
HTTPException – Retrieving the invite failed.
- Returns:
The invite from the URL/ID.
- Return type:
- await delete_invite(invite)[source]¶
This function is a coroutine.
Revokes an
Invite
, URL, or ID to an invite.You must have
manage_channels
permission in the associated guild to do this.- Parameters:
- Raises:
Forbidden – You do not have permissions to revoke invites.
NotFound – The invite is invalid or expired.
HTTPException – Revoking the invite failed.
- await fetch_voice_regions(guild_id=None)[source]¶
Retrieves a list of
VoiceRegion
s.Retrieves voice regions for the user, or a guild if provided.
New in version 2.5.
- Parameters:
guild_id (Optional[
int
]) – The guild to get regions for, if provided.- Raises:
HTTPException – Retrieving voice regions failed.
NotFound – The provided
guild_id
could not be found.
- await fetch_widget(guild_id, /)[source]¶
This function is a coroutine.
Retrieves a
Widget
for the given guild ID.Note
The guild must have the widget enabled to get this information.
- Parameters:
guild_id (
int
) – The ID of the guild.- Raises:
Forbidden – The widget for this guild is disabled.
HTTPException – Retrieving the widget failed.
- Returns:
The guild’s widget.
- Return type:
- await application_info()[source]¶
This function is a coroutine.
Retrieves the bot’s application information.
- Raises:
HTTPException – Retrieving the information failed somehow.
- Returns:
The bot’s application information.
- Return type:
- await fetch_user(user_id, /)[source]¶
This function is a coroutine.
Retrieves a
User
based on their ID. You do not have to share any guilds with the user to get this information, however many operations do require that you do.Note
This method is an API call. If you have
disnake.Intents.members
and member cache enabled, considerget_user()
instead.- Parameters:
user_id (
int
) – The ID of the user to retrieve.- Raises:
NotFound – A user with this ID does not exist.
HTTPException – Retrieving the user failed.
- Returns:
The user you requested.
- Return type:
- await fetch_channel(channel_id, /)[source]¶
This function is a coroutine.
Retrieves a
abc.GuildChannel
,abc.PrivateChannel
, orThread
with the specified ID.Note
This method is an API call. For general usage, consider
get_channel()
instead.New in version 1.2.
- Parameters:
channel_id (
int
) – The ID of the channel to retrieve.- Raises:
InvalidData – An unknown channel type was received from Discord.
HTTPException – Retrieving the channel failed.
NotFound – Invalid Channel ID.
Forbidden – You do not have permission to fetch this channel.
- Returns:
The channel from the ID.
- Return type:
Union[
abc.GuildChannel
,abc.PrivateChannel
,Thread
]
- await fetch_webhook(webhook_id, /)[source]¶
This function is a coroutine.
Retrieves a
Webhook
with the given ID.- Parameters:
webhook_id (
int
) – The ID of the webhook to retrieve.- Raises:
HTTPException – Retrieving the webhook failed.
NotFound – Invalid webhook ID.
Forbidden – You do not have permission to fetch this webhook.
- Returns:
The webhook you requested.
- Return type:
- await fetch_sticker(sticker_id, /)[source]¶
This function is a coroutine.
Retrieves a
Sticker
with the given ID.New in version 2.0.
- Parameters:
sticker_id (
int
) – The ID of the sticker to retrieve.- Raises:
HTTPException – Retrieving the sticker failed.
NotFound – Invalid sticker ID.
- Returns:
The sticker you requested.
- Return type:
Union[
StandardSticker
,GuildSticker
]
This function is a coroutine.
Retrieves all available premium sticker packs.
New in version 2.0.
- Raises:
HTTPException – Retrieving the sticker packs failed.
- Returns:
All available premium sticker packs.
- Return type:
List[
StickerPack
]
- await create_dm(user)[source]¶
This function is a coroutine.
Creates a
DMChannel
with the given user.This should be rarely called, as this is done transparently for most people.
New in version 2.0.
- add_view(view, *, message_id=None)[source]¶
Registers a
View
for persistent listening.This method should be used for when a view is comprised of components that last longer than the lifecycle of the program.
New in version 2.0.
- Parameters:
view (
disnake.ui.View
) – The view to register for dispatching.message_id (Optional[
int
]) – The message ID that the view is attached to. This is currently used to refresh the view’s state during message update events. If not given then message update events are not propagated for the view.
- Raises:
TypeError – A view was not passed.
ValueError – The view is not persistent. A persistent view has no timeout and all their components have an explicitly provided custom_id.
- property persistent_views[source]¶
A sequence of persistent views added to the client.
New in version 2.0.
- Type:
Sequence[
View
]
- await fetch_global_commands(*, with_localizations=True)[source]¶
This function is a coroutine.
Retrieves a list of global application commands.
New in version 2.1.
- Parameters:
with_localizations (
bool
) –Whether to include localizations in the response. Defaults to
True
.New in version 2.5.
- Returns:
A list of application commands.
- Return type:
List[Union[
APIUserCommand
,APIMessageCommand
,APISlashCommand
]]
- await fetch_global_command(command_id)[source]¶
This function is a coroutine.
Retrieves a global application command.
New in version 2.1.
- Parameters:
command_id (
int
) – The ID of the command to retrieve.- Returns:
The requested application command.
- Return type:
- await create_global_command(application_command)[source]¶
This function is a coroutine.
Creates a global application command.
New in version 2.1.
- Parameters:
application_command (
ApplicationCommand
) – An object representing the application command to create.- Returns:
The application command that was created.
- Return type:
- await edit_global_command(command_id, new_command)[source]¶
This function is a coroutine.
Edits a global application command.
New in version 2.1.
- Parameters:
command_id (
int
) – The ID of the application command to edit.new_command (
ApplicationCommand
) – An object representing the edited application command.
- Returns:
The edited application command.
- Return type:
- await delete_global_command(command_id)[source]¶
This function is a coroutine.
Deletes a global application command.
New in version 2.1.
- Parameters:
command_id (
int
) – The ID of the application command to delete.
- await bulk_overwrite_global_commands(application_commands)[source]¶
This function is a coroutine.
Overwrites several global application commands in one API request.
New in version 2.1.
- Parameters:
application_commands (List[
ApplicationCommand
]) – A list of application commands to insert instead of the existing commands.- Returns:
A list of registered application commands.
- Return type:
List[Union[
APIUserCommand
,APIMessageCommand
,APISlashCommand
]]
- await fetch_guild_commands(guild_id, *, with_localizations=True)[source]¶
This function is a coroutine.
Retrieves a list of guild application commands.
New in version 2.1.
- Parameters:
- Returns:
A list of application commands.
- Return type:
List[Union[
APIUserCommand
,APIMessageCommand
,APISlashCommand
]]
- await fetch_guild_command(guild_id, command_id)[source]¶
This function is a coroutine.
Retrieves a guild application command.
New in version 2.1.
- Parameters:
- Returns:
The requested application command.
- Return type:
- await create_guild_command(guild_id, application_command)[source]¶
This function is a coroutine.
Creates a guild application command.
New in version 2.1.
- Parameters:
guild_id (
int
) – The ID of the guild where the application command should be created.application_command (
ApplicationCommand
) – The application command.
- Returns:
The newly created application command.
- Return type:
- await edit_guild_command(guild_id, command_id, new_command)[source]¶
This function is a coroutine.
Edits a guild application command.
New in version 2.1.
- Parameters:
guild_id (
int
) – The ID of the guild where the application command should be edited.command_id (
int
) – The ID of the application command to edit.new_command (
ApplicationCommand
) – An object representing the edited application command.
- Returns:
The newly edited application command.
- Return type:
- await delete_guild_command(guild_id, command_id)[source]¶
This function is a coroutine.
Deletes a guild application command.
New in version 2.1.
- await bulk_overwrite_guild_commands(guild_id, application_commands)[source]¶
This function is a coroutine.
Overwrites several guild application commands in one API request.
New in version 2.1.
- Parameters:
guild_id (
int
) – The ID of the guild where the application commands should be overwritten.application_commands (List[
ApplicationCommand
]) – A list of application commands to insert instead of the existing commands.
- Returns:
A list of registered application commands.
- Return type:
List[Union[
APIUserCommand
,APIMessageCommand
,APISlashCommand
]]
- await bulk_fetch_command_permissions(guild_id)[source]¶
This function is a coroutine.
Retrieves a list of
GuildApplicationCommandPermissions
configured for the guild with the given ID.New in version 2.1.
- Parameters:
guild_id (
int
) – The ID of the guild to inspect.
- await fetch_command_permissions(guild_id, command_id)[source]¶
This function is a coroutine.
Retrieves
GuildApplicationCommandPermissions
for a specific application command in the guild with the given ID.New in version 2.1.
- Parameters:
- Returns:
The permissions configured for the specified application command.
- Return type:
- await fetch_role_connection_metadata()[source]¶
This function is a coroutine.
Retrieves the
ApplicationRoleConnectionMetadata
records for the application.New in version 2.8.
- Raises:
HTTPException – Retrieving the metadata records failed.
- Returns:
The list of metadata records.
- Return type:
- await edit_role_connection_metadata(records)[source]¶
This function is a coroutine.
Edits the
ApplicationRoleConnectionMetadata
records for the application.An application can have up to 5 metadata records.
Warning
This will overwrite all existing metadata records. Consider
fetching
them first, and constructing the new list of metadata records based off of the returned list.New in version 2.8.
- Parameters:
records (Sequence[
ApplicationRoleConnectionMetadata
]) – The new metadata records.- Raises:
HTTPException – Editing the metadata records failed.
- Returns:
The list of newly edited metadata records.
- Return type:
AutoShardedClient¶
- asyncchange_presence
- asyncclose
- asyncconnect
- defget_shard
- defis_ws_ratelimited
- class disnake.AutoShardedClient(*args, shard_ids=None, **kwargs)[source]¶
A client similar to
Client
except it handles the complications of sharding for the user into a more manageable and transparent single process bot.When using this client, you will be able to use it as-if it was a regular
Client
with a single shard when implementation wise internally it is split up into multiple shards. This allows you to not have to deal with IPC or other complicated infrastructure.It is recommended to use this client only if you have surpassed at least 1000 guilds.
If no
shard_count
is provided, then the library will use the Bot Gateway endpoint call to figure out how many shards to use.If a
shard_ids
parameter is given, then those shard IDs will be used to launch the internal shards. Note thatshard_count
must be provided if this is used. By default, when omitted, the client will launch shards from 0 toshard_count - 1
.- property latency[source]¶
Measures latency between a HEARTBEAT and a HEARTBEAT_ACK in seconds.
This operates similarly to
Client.latency()
except it uses the average latency of every shard’s latency. To get a list of shard latency, check thelatencies
property. Returnsnan
if there are no shards ready.- Type:
- property latencies[source]¶
A list of latencies between a HEARTBEAT and a HEARTBEAT_ACK in seconds.
This returns a list of tuples with elements
(shard_id, latency)
.
- get_shard(shard_id)[source]¶
Gets the shard information of a given shard ID, or
None
if not found.- Return type:
Optional[
ShardInfo
]
- property shards[source]¶
Returns a mapping of shard IDs to their respective info object.
- Type:
Mapping[int,
ShardInfo
]
- await connect(*, reconnect=True, ignore_session_start_limit=False)[source]¶
This function is a coroutine.
Creates a websocket connection and lets the websocket listen to messages from Discord. This is a loop that runs the entire event system and miscellaneous aspects of the library. Control is not resumed until the WebSocket connection is terminated.
Changed in version 2.6: Added usage of
SessionStartLimit
when connecting to the API. Added theignore_session_start_limit
parameter.- Parameters:
reconnect (
bool
) – Whether reconnecting should be attempted, either due to internet failure or a specific failure on Discord’s part. Certain disconnects that lead to bad state will not be handled (such as invalid sharding payloads or bad tokens).ignore_session_start_limit (
bool
) –Whether the API provided session start limit should be ignored when connecting to the API.
New in version 2.6.
- Raises:
GatewayNotFound – If the gateway to connect to Discord is not found. Usually if this is thrown then there is a Discord API outage.
ConnectionClosed – The websocket connection has been terminated.
SessionStartLimitReached – If the client doesn’t have enough connects remaining in the current 24-hour window and
ignore_session_start_limit
isFalse
this will be raised rather than connecting to the gateawy and Discord resetting the token. However, ifignore_session_start_limit
isTrue
, the client will connect regardless and this exception will not be raised.
- await change_presence(*, activity=None, status=None, shard_id=None)[source]¶
This function is a coroutine.
Changes the client’s presence.
Example:
game = disnake.Game("with the API") await client.change_presence(status=disnake.Status.idle, activity=game)
Changed in version 2.0: Removed the
afk
keyword-only parameter.Changed in version 2.6: Raises
TypeError
instead ofInvalidArgument
.- Parameters:
activity (Optional[
BaseActivity
]) – The activity being done.None
if no currently active activity is done.status (Optional[
Status
]) – Indicates what status to change to. IfNone
, thenStatus.online
is used.shard_id (Optional[
int
]) – The shard_id to change the presence to. If not specified orNone
, then it will change the presence of every shard the bot can see.
- Raises:
TypeError – If the
activity
parameter is not of proper type.
- is_ws_ratelimited()[source]¶
Whether the websocket is currently rate limited.
This can be useful to know when deciding whether you should query members using HTTP or via the gateway.
This implementation checks if any of the shards are rate limited. For more granular control, consider
ShardInfo.is_ws_ratelimited()
.New in version 1.6.
- Return type:
Application Info¶
AppInfo¶
- class disnake.AppInfo[source]¶
Represents the application info for the bot provided by Discord.
- bot_public¶
Whether the bot can be invited by anyone or if it is locked to the application owner.
- Type:
- bot_require_code_grant¶
Whether the bot requires the completion of the full oauth2 code grant flow to join.
- Type:
- verify_key¶
The hex encoded key for verification in interactions and the GameSDK’s GetTicket.
New in version 1.3.
- Type:
- guild_id¶
If this application is a game sold on Discord, this field will be the guild to which it has been linked to.
New in version 1.3.
- Type:
Optional[
int
]
- primary_sku_id¶
If this application is a game sold on Discord, this field will be the ID of the “Game SKU” that is created, if it exists.
New in version 1.3.
- Type:
Optional[
int
]
- slug¶
If this application is a game sold on Discord, this field will be the URL slug that links to the store page.
New in version 1.3.
- Type:
Optional[
str
]
- terms_of_service_url¶
The application’s terms of service URL, if set.
New in version 2.0.
- Type:
Optional[
str
]
- privacy_policy_url¶
The application’s privacy policy URL, if set.
New in version 2.0.
- Type:
Optional[
str
]
- flags¶
The application’s public flags.
New in version 2.3.
- Type:
Optional[
ApplicationFlags
]
- install_params¶
The installation parameters for this application.
New in version 2.5.
- Type:
Optional[
InstallParams
]
- custom_install_url¶
The custom installation url for this application.
New in version 2.5.
- Type:
Optional[
str
]
- role_connections_verification_url¶
The application’s role connection verification entry point, which when configured will render the app as a verification method in the guild role verification configuration.
New in version 2.8.
- Type:
Optional[
str
]
- property cover_image[source]¶
Retrieves the cover image on a store embed, if any.
This is only available if the application is a game sold on Discord.
- Type:
Optional[
Asset
]
- property guild[source]¶
If this application is a game sold on Discord, this field will be the guild to which it has been linked
New in version 1.3.
- Type:
Optional[
Guild
]
- property summary[source]¶
If this application is a game sold on Discord, this field will be the summary field for the store page of its primary SKU.
New in version 1.3.
Deprecated since version 2.5: This field is deprecated by discord and is now always blank. Consider using
description
instead.- Type:
PartialAppInfo¶
- class disnake.PartialAppInfo[source]¶
Represents a partial AppInfo given by
create_invite()
.New in version 2.0.
- property summary[source]¶
If this application is a game sold on Discord, this field will be the summary field for the store page of its primary SKU.
Deprecated since version 2.5: This field is deprecated by discord and is now always blank. Consider using
description
instead.- Type:
Team¶
- class disnake.Team[source]¶
Represents an application team for a bot provided by Discord.
- members¶
A list of the members in the team.
New in version 1.3.
- Type:
List[
TeamMember
]
- property owner[source]¶
The team’s owner.
- Type:
Optional[
TeamMember
]
TeamMember¶
- class disnake.TeamMember[source]¶
Represents a team member in a team.
- x == y
Checks if two team members are equal.
- x != y
Checks if two team members are not equal.
- hash(x)
Return the team member’s hash.
- str(x)
Returns the team member’s name with discriminator.
New in version 1.3.
- discriminator¶
The team member’s discriminator. This is given when the username has conflicts.
- Type:
- membership_state¶
The membership state of the member (e.g. invited or accepted)
- Type:
InstallParams¶
- defto_url
Event Reference¶
This section outlines the different types of events listened by Client
.
There are two ways to register an event, the first way is through the use of
Client.event()
. The second way is through subclassing Client
and
overriding the specific events. For example:
import disnake
class MyClient(disnake.Client):
async def on_message(self, message):
if message.author == self.user:
return
if message.content.startswith('$hello'):
await message.channel.send('Hello World!')
If an event handler raises an exception, on_error()
will be called
to handle it, which defaults to print a traceback and ignoring the exception.
Warning
All the events must be a coroutine. If they aren’t, then you might get unexpected
errors. In order to turn a function into a coroutine they must be async def
functions.
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()
, or, if used, Bots listeners such aslisten()
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()
, or, if used, Bots listeners such aslisten()
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_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_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_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_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_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.
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.
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.
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
leaves or joins aGuild
. 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
updates their profile. 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
. 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 updates their profile. Unlike
on_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_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
public_flags
This requires
Intents.members
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.
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.
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_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_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_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_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_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_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_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
. If channel is anabc.Messageable
instance, it could be aTextChannel
,VoiceChannel
,StageChannel
,GroupChannel
, orDMChannel
.Changed in version 2.5:
channel
may be a typeForumChannel
If the
channel
is aTextChannel
,ForumChannel
,VoiceChannel
, orStageChannel
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
]) – 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.
Utility Functions¶
- disnake.utils.find(predicate, seq)[source]¶
A helper to return the first element found in the sequence that meets the predicate. For example:
member = disnake.utils.find(lambda m: m.name == 'Mighty', channel.guild.members)
would find the first
Member
whose name is ‘Mighty’ and return it. If an entry is not found, thenNone
is returned.This is different from
filter()
due to the fact it stops the moment it finds a valid entry.- Parameters:
predicate – A function that returns a boolean-like result.
seq (
collections.abc.Iterable
) – The iterable to search through.
- disnake.utils.get(iterable, **attrs)[source]¶
A helper that returns the first element in the iterable that meets all the traits passed in
attrs
. This is an alternative forfind()
.When multiple attributes are specified, they are checked using logical AND, not logical OR. Meaning they have to meet every attribute passed in and not one of them.
To have a nested attribute search (i.e. search by
x.y
) then pass inx__y
as the keyword argument.If nothing is found that matches the attributes passed, then
None
is returned.Examples
Basic usage:
member = disnake.utils.get(message.guild.members, name='Foo')
Multiple attribute matching:
channel = disnake.utils.get(guild.voice_channels, name='Foo', bitrate=64000)
Nested attribute matching:
channel = disnake.utils.get(client.get_all_channels(), guild__name='Cool', name='general')
- Parameters:
iterable – An iterable to search through.
**attrs – Keyword arguments that denote attributes to search with.
- disnake.utils.snowflake_time(id)[source]¶
- Parameters:
id (
int
) – The snowflake ID.- Returns:
An aware datetime in UTC representing the creation time of the snowflake.
- Return type:
- disnake.utils.oauth_url(client_id, *, permissions=..., guild=..., redirect_uri=..., scopes=..., disable_guild_select=False)[source]¶
A helper function that returns the OAuth2 URL for inviting the bot into guilds.
- Parameters:
permissions (
Permissions
) – The permissions you’re requesting. If not given then you won’t be requesting any permissions.guild (
Snowflake
) – The guild to pre-select in the authorization screen, if available.redirect_uri (
str
) – An optional valid redirect URI.scopes (Iterable[
str
]) –An optional valid list of scopes. Defaults to
('bot',)
.New in version 1.7.
disable_guild_select (
bool
) –Whether to disallow the user from changing the guild dropdown.
New in version 2.0.
- Returns:
The OAuth2 URL for inviting the bot into guilds.
- Return type:
- disnake.utils.remove_markdown(text, *, ignore_links=True)[source]¶
A helper function that removes markdown characters.
New in version 1.7.
Note
This function is not markdown aware and may remove meaning from the original text. For example, if the input contains
10 * 5
then it will be converted into10 5
.- Parameters:
- Returns:
The text with the markdown special characters removed.
- Return type:
- disnake.utils.escape_markdown(text, *, as_needed=False, ignore_links=True)[source]¶
A helper function that escapes Discord’s markdown.
- Parameters:
text (
str
) – The text to escape markdown from.as_needed (
bool
) – Whether to escape the markdown characters as needed. This means that it does not escape extraneous characters if it’s not necessary, e.g.**hello**
is escaped into\*\*hello**
instead of\*\*hello\*\*
. Note however that this can open you up to some clever syntax abuse. Defaults toFalse
.ignore_links (
bool
) – Whether to leave links alone when escaping markdown. For example, if a URL in the text contains characters such as_
then it will be left alone. This option is not supported withas_needed
. Defaults toTrue
.
- Returns:
The text with the markdown special characters escaped with a slash.
- Return type:
- disnake.utils.escape_mentions(text)[source]¶
A helper function that escapes everyone, here, role, and user mentions.
Note
This does not include channel mentions.
Note
For more granular control over what mentions should be escaped within messages, refer to the
AllowedMentions
class.
- disnake.utils.resolve_invite(invite, *, with_params=False)[source]¶
Resolves an invite from a
Invite
, URL or code.- Parameters:
- Returns:
The invite code if
with_params
isFalse
, otherwise a tuple containing the invite code and the url’s query parameters, if applicable.- Return type:
- disnake.utils.resolve_template(code)[source]¶
Resolves a template code from a
Template
, URL or code.New in version 1.4.
- await disnake.utils.sleep_until(when, result=None)[source]¶
This function is a coroutine.
Sleep until a specified time.
If the time supplied is in the past this function will yield instantly.
New in version 1.3.
- Parameters:
when (
datetime.datetime
) – The timestamp in which to sleep until. If the datetime is naive then it is assumed to be local time.result (Any) – If provided, is returned to the caller when the coroutine completes.
- disnake.utils.utcnow()[source]¶
A helper function to return an aware UTC datetime representing the current time.
This should be preferred to
datetime.datetime.utcnow()
since it is an aware datetime, compared to the naive datetime in the standard library.New in version 2.0.
- Returns:
The current aware datetime in UTC.
- Return type:
- disnake.utils.format_dt(dt, /, style='f')[source]¶
A helper function to format a
datetime.datetime
,int
orfloat
for presentation within Discord.This allows for a locale-independent way of presenting data using Discord specific Markdown.
Style
Example Output
Description
t
22:57
Short Time
T
22:57:58
Long Time
d
17/05/2016
Short Date
D
17 May 2016
Long Date
f (default)
17 May 2016 22:57
Short Date Time
F
Tuesday, 17 May 2016 22:57
Long Date Time
R
5 years ago
Relative Time
Note that the exact output depends on the user’s locale setting in the client. The example output presented is using the
en-GB
locale.New in version 2.0.
- Parameters:
dt (Union[
datetime.datetime
,int
,float
]) – The datetime to format. If this is a naive datetime, it is assumed to be local time.style (
str
) – The style to format the datetime with. Defaults tof
- Returns:
The formatted string.
- Return type:
- disnake.utils.as_chunks(iterator, max_size)[source]¶
A helper function that collects an iterator into chunks of a given size.
New in version 2.0.
- Parameters:
iterator (Union[
collections.abc.Iterator
,collections.abc.AsyncIterator
]) – The iterator to chunk, can be sync or async.max_size (
int
) – The maximum chunk size.
Warning
The last chunk collected may not be as large as
max_size
.- Returns:
A new iterator which yields chunks of a given size.
- Return type:
Union[
Iterator
,AsyncIterator
]
Enumerations¶
The API provides some enumerations for certain types of strings to avoid the API from being stringly typed in case the strings change in the future.
All enumerations are subclasses of an internal class which mimics the behaviour
of enum.Enum
.
- class disnake.ChannelType[source]¶
Specifies the type of channel.
- text¶
A text channel.
- voice¶
A voice channel.
- private¶
A private text channel. Also called a direct message.
- group¶
A private group text channel.
- category¶
A category channel.
- news¶
A guild news channel.
- stage_voice¶
A guild stage voice channel.
New in version 1.7.
- news_thread¶
A news thread.
New in version 2.0.
- public_thread¶
A public thread.
New in version 2.0.
- private_thread¶
A private thread.
New in version 2.0.
- guild_directory¶
A student hub channel.
New in version 2.1.
- forum¶
A channel of only threads.
New in version 2.5.
- class disnake.MessageType[source]¶
Specifies the type of
Message
. This is used to denote if a message is to be interpreted as a system message or a regular message.- x == y
Checks if two messages are equal.
- x != y
Checks if two messages are not equal.
- default¶
The default message type. This is the same as regular messages.
- recipient_add¶
The system message when a user is added to a group private message or a thread.
- recipient_remove¶
The system message when a user is removed from a group private message or a thread.
- call¶
The system message denoting call state, e.g. missed call, started call, etc.
- channel_name_change¶
The system message denoting that a channel’s name has been changed.
- channel_icon_change¶
The system message denoting that a channel’s icon has been changed.
- pins_add¶
The system message denoting that a pinned message has been added to a channel.
- new_member¶
The system message denoting that a new member has joined a Guild.
The system message denoting that a member has “nitro boosted” a guild.
The system message denoting that a member has “nitro boosted” a guild and it achieved level 1.
The system message denoting that a member has “nitro boosted” a guild and it achieved level 2.
The system message denoting that a member has “nitro boosted” a guild and it achieved level 3.
- channel_follow_add¶
The system message denoting that an announcement channel has been followed.
New in version 1.3.
- guild_stream¶
The system message denoting that a member is streaming in the guild.
New in version 1.7.
- guild_discovery_disqualified¶
The system message denoting that the guild is no longer eligible for Server Discovery.
New in version 1.7.
- guild_discovery_requalified¶
The system message denoting that the guild has become eligible again for Server Discovery.
New in version 1.7.
- guild_discovery_grace_period_initial_warning¶
The system message denoting that the guild has failed to meet the Server Discovery requirements for one week.
New in version 1.7.
- guild_discovery_grace_period_final_warning¶
The system message denoting that the guild has failed to meet the Server Discovery requirements for 3 weeks in a row.
New in version 1.7.
- thread_created¶
The system message denoting that a thread has been created. This is only sent if the thread has been created from an older message. The period of time required for a message to be considered old cannot be relied upon and is up to Discord.
New in version 2.0.
- reply¶
The system message denoting that the author is replying to a message.
New in version 2.0.
- application_command¶
The system message denoting that an application (or “slash”) command was executed.
New in version 2.0.
- guild_invite_reminder¶
The system message sent as a reminder to invite people to the guild.
New in version 2.0.
- thread_starter_message¶
The system message denoting the message in the thread that is the one that started the thread’s conversation topic.
New in version 2.0.
The system message denoting that a context menu command was executed.
New in version 2.3.
- auto_moderation_action¶
The system message denoting that an auto moderation action was executed.
New in version 2.5.
- role_subscription_purchase¶
The system message denoting that a role subscription was purchased.
New in version 2.9.
The system message for an application premium subscription upsell.
New in version 2.8.
- stage_start¶
The system message denoting the stage has been started.
New in version 2.9.
- stage_end¶
The system message denoting the stage has ended.
New in version 2.9.
- stage_speaker¶
The system message denoting a user has become a speaker.
New in version 2.9.
- stage_topic¶
The system message denoting the stage topic has been changed.
New in version 2.9.
The system message denoting that a guild member has subscribed to an application.
New in version 2.8.
- class disnake.UserFlags[source]¶
Represents Discord User flags.
- staff¶
The user is a Discord Employee.
- partner¶
The user is a Discord Partner.
- hypesquad¶
The user is a HypeSquad Events member.
- bug_hunter¶
The user is a Bug Hunter.
- mfa_sms¶
The user has SMS recovery for Multi Factor Authentication enabled.
The user has dismissed the Discord Nitro promotion.
- hypesquad_bravery¶
The user is a HypeSquad Bravery member.
- hypesquad_brilliance¶
The user is a HypeSquad Brilliance member.
- hypesquad_balance¶
The user is a HypeSquad Balance member.
- early_supporter¶
The user is an Early Supporter.
- team_user¶
The user is a Team User.
- system¶
The user is a system user (i.e. represents Discord officially).
- has_unread_urgent_messages¶
The user has an unread system message.
- bug_hunter_level_2¶
The user is a Bug Hunter Level 2.
- verified_bot¶
The user is a Verified Bot.
- verified_bot_developer¶
The user is an Early Verified Bot Developer.
- discord_certified_moderator¶
The user is a Discord Certified Moderator.
- http_interactions_bot¶
The user is a bot that only uses HTTP interactions.
New in version 2.3.
- spammer¶
The user is marked as a spammer.
New in version 2.3.
- active_developer¶
The user is an Active Developer.
New in version 2.8.
- class disnake.ActivityType[source]¶
Specifies the type of
Activity
. This is used to check how to interpret the activity itself.- unknown¶
An unknown activity type. This should generally not happen.
- playing¶
A “Playing” activity type.
- streaming¶
A “Streaming” activity type.
- listening¶
A “Listening” activity type.
- watching¶
A “Watching” activity type.
- custom¶
A custom activity type.
- competing¶
A competing activity type.
New in version 1.5.
- class disnake.PartyType[source]¶
Represents the type of a voice channel activity/application.
- poker¶
The “Poker Night” activity.
- betrayal¶
The “Betrayal.io” activity.
- fishing¶
The “Fishington.io” activity.
- chess¶
The “Chess In The Park” activity.
- letter_tile¶
The “Letter Tile” activity.
- word_snack¶
The “Word Snacks” activity.
- doodle_crew¶
The “Doodle Crew” activity.
- checkers¶
The “Checkers In The Park” activity.
New in version 2.3.
- spellcast¶
The “SpellCast” activity.
New in version 2.3.
- watch_together¶
The “Watch Together” activity, a Youtube application.
New in version 2.3.
- sketch_heads¶
The “Sketch Heads” activity.
New in version 2.4.
- ocho¶
The “Ocho” activity.
New in version 2.4.
- class disnake.ApplicationCommandType[source]¶
Represents the type of an application command.
New in version 2.1.
- chat_input¶
Represents a slash command.
- user¶
Represents a user command from the context menu.
- message¶
Represents a message command from the context menu.
- class disnake.ApplicationCommandPermissionType[source]¶
Represents the type of a permission of an application command.
New in version 2.5.
- role¶
Represents a permission that affects roles.
- user¶
Represents a permission that affects users.
- channel¶
Represents a permission that affects channels.
- class disnake.InteractionType[source]¶
Specifies the type of
Interaction
.New in version 2.0.
- ping¶
Represents Discord pinging to see if the interaction response server is alive.
- application_command¶
Represents an application command interaction.
- component¶
Represents a component based interaction, i.e. using the Discord Bot UI Kit.
- application_command_autocomplete¶
Represents an application command autocomplete interaction.
- modal_submit¶
Represents a modal submit interaction.
- class disnake.InteractionResponseType[source]¶
Specifies the response type for the interaction.
New in version 2.0.
- pong¶
Pongs the interaction when given a ping.
See also
InteractionResponse.pong()
- channel_message¶
Respond to the interaction with a message.
See also
InteractionResponse.send_message()
- deferred_channel_message¶
Responds to the interaction with a message at a later time.
See also
InteractionResponse.defer()
- deferred_message_update¶
Acknowledges the component interaction with a promise that the message will update later (though there is no need to actually update the message).
See also
InteractionResponse.defer()
- message_update¶
Responds to the interaction by editing the message.
See also
InteractionResponse.edit_message()
- application_command_autocomplete_result¶
Responds to the autocomplete interaction with suggested choices.
See also
InteractionResponse.autocomplete()
- modal¶
Responds to the interaction by displaying a modal.
See also
InteractionResponse.send_modal()
- class disnake.ComponentType[source]¶
Represents the component type of a component.
New in version 2.0.
- action_row¶
Represents the group component which holds different components in a row.
- button¶
Represents a button component.
- string_select¶
Represents a string select component.
New in version 2.7.
- select¶
An alias of
string_select
.
- text_input¶
Represents a text input component.
- user_select¶
Represents a user select component.
New in version 2.7.
- role_select¶
Represents a role select component.
New in version 2.7.
- mentionable_select¶
Represents a mentionable (user/member/role) select component.
New in version 2.7.
- channel_select¶
Represents a channel select component.
New in version 2.7.
- class disnake.OptionType[source]¶
Represents the type of an option.
New in version 2.1.
- sub_command¶
Represents a sub command of the main command or group.
- sub_command_group¶
Represents a sub command group of the main command.
- string¶
Represents a string option.
- integer¶
Represents an integer option.
- boolean¶
Represents a boolean option.
- user¶
Represents a user option.
- channel¶
Represents a channel option.
- role¶
Represents a role option.
- mentionable¶
Represents a role + user option.
- number¶
Represents a float option.
- attachment¶
Represents an attachment option.
New in version 2.4.
- class disnake.ButtonStyle[source]¶
Represents the style of the button component.
New in version 2.0.
- primary¶
Represents a blurple button for the primary action.
- secondary¶
Represents a grey button for the secondary action.
- success¶
Represents a green button for a successful action.
- danger¶
Represents a red button for a dangerous action.
- link¶
Represents a link button.
- class disnake.TextInputStyle[source]¶
Represents a style of the text input component.
New in version 2.4.
- short¶
Represents a single-line text input component.
- paragraph¶
Represents a multi-line text input component.
- class disnake.VerificationLevel[source]¶
Specifies a
Guild
's verification level, which is the criteria in which a member must meet before being able to send messages to the guild.New in version 2.0.
- x == y
Checks if two verification levels are equal.
- x != y
Checks if two verification levels are not equal.
- x > y
Checks if a verification level is higher than another.
- x < y
Checks if a verification level is lower than another.
- x >= y
Checks if a verification level is higher or equal to another.
- x <= y
Checks if a verification level is lower or equal to another.
- none¶
No criteria set.
- low¶
Member must have a verified email on their Discord account.
- medium¶
Member must have a verified email and be registered on Discord for more than five minutes.
- high¶
Member must have a verified email, be registered on Discord for more than five minutes, and be a member of the guild itself for more than ten minutes.
- highest¶
Member must have a verified phone on their Discord account.
- class disnake.NotificationLevel[source]¶
Specifies whether a
Guild
has notifications on for all messages or mentions only by default.New in version 2.0.
- x == y
Checks if two notification levels are equal.
- x != y
Checks if two notification levels are not equal.
- x > y
Checks if a notification level is higher than another.
- x < y
Checks if a notification level is lower than another.
- x >= y
Checks if a notification level is higher or equal to another.
- x <= y
Checks if a notification level is lower or equal to another.
- all_messages¶
Members receive notifications for every message regardless of them being mentioned.
- only_mentions¶
Members receive notifications for messages they are mentioned in.
- class disnake.ContentFilter[source]¶
Specifies a
Guild
's explicit content filter, which is the machine learning algorithms that Discord uses to detect if an image contains pornography or otherwise explicit content.New in version 2.0.
- x == y
Checks if two content filter levels are equal.
- x != y
Checks if two content filter levels are not equal.
- x > y
Checks if a content filter level is higher than another.
- x < y
Checks if a content filter level is lower than another.
- x >= y
Checks if a content filter level is higher or equal to another.
- x <= y
Checks if a content filter level is lower or equal to another.
- disabled¶
The guild does not have the content filter enabled.
- no_role¶
The guild has the content filter enabled for members without a role.
- all_members¶
The guild has the content filter enabled for every member.
- class disnake.Status[source]¶
Specifies a
Member
‘s status.- online¶
The member is online.
- offline¶
The member is offline.
- idle¶
The member is idle.
- dnd¶
The member is “Do Not Disturb”.
- invisible¶
The member is “invisible”. In reality, this is only used in sending a presence a la
Client.change_presence()
. When you receive a user’s presence this will beoffline
instead.
- streaming¶
The member is live streaming to Twitch.
New in version 2.3.
- class disnake.AuditLogAction[source]¶
Represents the type of action being done for a
AuditLogEntry
, which is retrievable viaGuild.audit_logs()
or via theon_audit_log_entry_create()
event.- guild_update¶
The guild has updated. Things that trigger this include:
Changing the guild vanity URL
Changing the guild invite splash
Changing the guild AFK channel or timeout
Changing the guild voice server region
Changing the guild icon, banner, or discovery splash
Changing the guild moderation settings
Changing things related to the guild widget
When this is the action, the type of
target
is theGuild
.Possible attributes for
AuditLogDiff
:
- channel_create¶
A new channel was created.
When this is the action, the type of
target
is either aabc.GuildChannel
orObject
with an ID.A more filled out object in the
Object
case can be found by usingafter
.Possible attributes for
AuditLogDiff
:
- channel_update¶
A channel was updated. Things that trigger this include:
The channel name or topic was changed
The channel bitrate was changed
When this is the action, the type of
target
is theabc.GuildChannel
orObject
with an ID.A more filled out object in the
Object
case can be found by usingafter
orbefore
.Possible attributes for
AuditLogDiff
:
- channel_delete¶
A channel was deleted.
When this is the action, the type of
target
is anObject
with an ID.A more filled out object can be found by using the
before
object.Possible attributes for
AuditLogDiff
:
- overwrite_create¶
A channel permission overwrite was created.
When this is the action, the type of
target
is theabc.GuildChannel
orObject
with an ID.When this is the action, the type of
extra
is either aRole
orMember
. If the object is not found then it is aObject
with an ID being filled, a name, and atype
attribute set to either'role'
or'member'
to help dictate what type of ID it is.Possible attributes for
AuditLogDiff
:
- overwrite_update¶
A channel permission overwrite was changed, this is typically when the permission values change.
See
overwrite_create
for more information on how thetarget
andextra
fields are set.Possible attributes for
AuditLogDiff
:
- overwrite_delete¶
A channel permission overwrite was deleted.
See
overwrite_create
for more information on how thetarget
andextra
fields are set.Possible attributes for
AuditLogDiff
:
- kick¶
A member was kicked.
When this is the action, the type of
target
is theUser
who got kicked. If the user is not found then it is aObject
with the user’s ID.When this is the action,
changes
is empty.
- member_prune¶
A member prune was triggered.
When this is the action, the type of
target
is set toNone
.When this is the action, the type of
extra
is set to an unspecified proxy object with two attributes:delete_members_days
: An integer specifying how far the prune was.members_removed
: An integer specifying how many members were removed.
When this is the action,
changes
is empty.
- ban¶
A member was banned.
When this is the action, the type of
target
is theUser
who got banned. If the user is not found then it is aObject
with the user’s ID.When this is the action,
changes
is empty.
- unban¶
A member was unbanned.
When this is the action, the type of
target
is theUser
who got unbanned. If the user is not found then it is aObject
with the user’s ID.When this is the action,
changes
is empty.
- member_update¶
A member has updated. This triggers in the following situations:
A nickname was changed
They were server muted or deafened (or it was undone)
They were timed out
When this is the action, the type of
target
is theMember
orUser
who got updated. If the user is not found then it is aObject
with the user’s ID.Possible attributes for
AuditLogDiff
:
- member_role_update¶
A member’s role has been updated. This triggers when a member either gains a role or loses a role.
When this is the action, the type of
target
is theMember
orUser
who got the role. If the user is not found then it is aObject
with the user’s ID.Possible attributes for
AuditLogDiff
:
- member_move¶
A member’s voice channel has been updated. This triggers when a member is moved to a different voice channel.
When this is the action, the type of
extra
is set to an unspecified proxy object with two attributes:channel
: ATextChannel
orObject
with the channel ID where the members were moved.count
: An integer specifying how many members were moved.
New in version 1.3.
- member_disconnect¶
A member’s voice state has changed. This triggers when a member is force disconnected from voice.
When this is the action, the type of
extra
is set to an unspecified proxy object with one attribute:count
: An integer specifying how many members were disconnected.
New in version 1.3.
- bot_add¶
A bot was added to the guild.
When this is the action, the type of
target
is theMember
orUser
which was added to the guild. If the user is not found then it is aObject
with an ID.New in version 1.3.
- role_create¶
A new role was created.
When this is the action, the type of
target
is theRole
or aObject
with the ID.Possible attributes for
AuditLogDiff
:
- role_update¶
A role was updated. This triggers in the following situations:
The name has changed
The permissions have changed
The colour has changed
Its hoist/mentionable state has changed
When this is the action, the type of
target
is theRole
or aObject
with the ID.Possible attributes for
AuditLogDiff
:
- role_delete¶
A role was deleted.
When this is the action, the type of
target
is theObject
with the ID.Possible attributes for
AuditLogDiff
:
- invite_create¶
An invite was created.
When this is the action, the type of
target
is theInvite
that was created.Possible attributes for
AuditLogDiff
:
- invite_update¶
An invite was updated.
When this is the action, the type of
target
is theInvite
that was updated.
- invite_delete¶
An invite was deleted.
When this is the action, the type of
target
is theInvite
that was deleted.Possible attributes for
AuditLogDiff
:
- webhook_create¶
A webhook was created.
When this is the action, the type of
target
is theWebhook
orObject
with the webhook ID.Possible attributes for
AuditLogDiff
:Changed in version 2.6: Added
application_id
.Changed in version 2.6:
type
for this action is now aWebhookType
.
- webhook_update¶
A webhook was updated. This trigger in the following situations:
The webhook name changed
The webhook channel changed
When this is the action, the type of
target
is theWebhook
orObject
with the webhook ID.Possible attributes for
AuditLogDiff
:
- webhook_delete¶
A webhook was deleted.
When this is the action, the type of
target
is theObject
with the webhook ID.Possible attributes for
AuditLogDiff
:Changed in version 2.6: Added
application_id
.Changed in version 2.6:
type
for this action is now aWebhookType
.
- emoji_create¶
An emoji was created.
When this is the action, the type of
target
is theEmoji
orObject
with the emoji ID.Possible attributes for
AuditLogDiff
:
- emoji_update¶
An emoji was updated. This triggers when the name has changed.
When this is the action, the type of
target
is theEmoji
orObject
with the emoji ID.Possible attributes for
AuditLogDiff
:
- emoji_delete¶
An emoji was deleted.
When this is the action, the type of
target
is theObject
with the emoji ID.Possible attributes for
AuditLogDiff
:
- message_delete¶
A message was deleted by a moderator. Note that this only triggers if the message was deleted by someone other than the author.
When this is the action, the type of
target
is theMember
orUser
who had their message deleted. If the user is not found then it is aObject
with the user’s ID.When this is the action, the type of
extra
is set to an unspecified proxy object with two attributes:count
: An integer specifying how many messages were deleted.channel
: ATextChannel
orObject
with the channel ID where the message got deleted.
- message_bulk_delete¶
Messages were bulk deleted by a moderator.
When this is the action, the type of
target
is theTextChannel
orObject
with the ID of the channel that was purged.When this is the action, the type of
extra
is set to an unspecified proxy object with one attribute:count
: An integer specifying how many messages were deleted.
New in version 1.3.
- message_pin¶
A message was pinned in a channel.
When this is the action, the type of
target
is theMember
orUser
who had their message pinned. If the user is not found then it is aObject
with the user’s ID.When this is the action, the type of
extra
is set to an unspecified proxy object with two attributes:channel
: ATextChannel
orObject
with the channel ID where the message was pinned.message_id
: the ID of the message which was pinned.
New in version 1.3.
- message_unpin¶
A message was unpinned in a channel.
When this is the action, the type of
target
is theMember
orUser
who had their message unpinned. If the user is not found then it is aObject
with the user’s ID.When this is the action, the type of
extra
is set to an unspecified proxy object with two attributes:channel
: ATextChannel
orObject
with the channel ID where the message was unpinned.message_id
: the ID of the message which was unpinned.
New in version 1.3.
- integration_create¶
A guild integration was created.
When this is the action, the type of
target
is thePartialIntegration
orObject
with the integration ID of the integration which was created.Possible attributes for
AuditLogDiff
:New in version 1.3.
Changed in version 2.6: Added support for
PartialIntegration
instead of plainObject
s.
- integration_update¶
A guild integration was updated.
When this is the action, the type of
target
is thePartialIntegration
orObject
with the integration ID of the integration which was updated.New in version 1.3.
Changed in version 2.6: Added support for
PartialIntegration
instead of plainObject
s.
- integration_delete¶
A guild integration was deleted.
When this is the action, the type of
target
is theObject
with the integration ID of the integration which was deleted.Possible attributes for
AuditLogDiff
:New in version 1.3.
- guild_scheduled_event_create¶
A guild scheduled event was created.
When this is the action, the type of
target
is theGuildScheduledEvent
orObject
with the ID of the event which was created.Possible attributes for
AuditLogDiff
:New in version 2.3.
- guild_scheduled_event_update¶
A guild scheduled event was updated.
When this is the action, the type of
target
is theGuildScheduledEvent
orObject
with the ID of the event which was updated.Possible attributes for
AuditLogDiff
:New in version 2.3.
- guild_scheduled_event_delete¶
A guild scheduled event was deleted.
When this is the action, the type of
target
is theObject
with the ID of the event which was deleted.Possible attributes for
AuditLogDiff
:New in version 2.3.
- stage_instance_create¶
A stage instance was started.
When this is the action, the type of
target
is theStageInstance
orObject
with the ID of the stage instance which was created.When this is the action, the type of
extra
is set to an unspecified proxy object with one attribute:channel
: TheStageChannel
orObject
with the channel ID where the stage instance was started.
Possible attributes for
AuditLogDiff
:New in version 2.0.
- stage_instance_update¶
A stage instance was updated.
When this is the action, the type of
target
is theStageInstance
orObject
with the ID of the stage instance which was updated.See
stage_instance_create
for more information on how theextra
field is set.Possible attributes for
AuditLogDiff
:New in version 2.0.
- stage_instance_delete¶
A stage instance was ended.
See
stage_instance_create
for more information on how theextra
field is set.Possible attributes for
AuditLogDiff
:New in version 2.0.
- sticker_create¶
A sticker was created.
When this is the action, the type of
target
is theGuildSticker
orObject
with the ID of the sticker which was created.Possible attributes for
AuditLogDiff
:New in version 2.0.
- sticker_update¶
A sticker was updated.
When this is the action, the type of
target
is theGuildSticker
orObject
with the ID of the sticker which was updated.Possible attributes for
AuditLogDiff
:New in version 2.0.
- sticker_delete¶
A sticker was deleted.
When this is the action, the type of
target
is theObject
with the ID of the sticker which was deleted.Possible attributes for
AuditLogDiff
:New in version 2.0.
- thread_create¶
A thread was created.
When this is the action, the type of
target
is theThread
orObject
with the ID of the thread which was created.Possible attributes for
AuditLogDiff
:New in version 2.0.
- thread_update¶
A thread was updated.
When this is the action, the type of
target
is theThread
orObject
with the ID of the thread which was updated.Possible attributes for
AuditLogDiff
:New in version 2.0.
- thread_delete¶
A thread was deleted.
When this is the action, the type of
target
is theObject
with the ID of the thread which was deleted.Possible attributes for
AuditLogDiff
:New in version 2.0.
- application_command_permission_update¶
The permissions of an application command were updated.
When this is the action, the type of
target
is theApplicationCommand
,PartialIntegration
, orObject
with the ID of the command whose permissions were updated or the application ID if these are application-wide permissions.When this is the action, the type of
extra
is set to an unspecified proxy object with one attribute:integration
: ThePartialIntegration
orObject
with the application ID of the associated application.
Possible attributes for
AuditLogDiff
:New in version 2.5.
Changed in version 2.6: Added support for
PartialIntegration
, and addedintegration
toextra
.
- automod_rule_create¶
An auto moderation rule was created.
When this is the action, the type of
target
is theAutoModRule
orObject
with the ID of the auto moderation rule which was created.Possible attributes for
AuditLogDiff
:New in version 2.6.
- automod_rule_update¶
An auto moderation rule was updated.
When this is the action, the type of
target
is theAutoModRule
orObject
with the ID of the auto moderation rule which was updated.Possible attributes for
AuditLogDiff
:New in version 2.6.
- automod_rule_delete¶
An auto moderation rule was deleted.
When this is the action, the type of
target
is theObject
with the ID of the auto moderation rule which was deleted.Possible attributes for
AuditLogDiff
:New in version 2.6.
- automod_block_message¶
A message was blocked by an auto moderation rule.
When this is the action, the type of
target
is theMember
orUser
who had their message blocked. If the user is not found then it is aObject
with the user’s ID.When this is the action, the type of
extra
is set to an unspecified proxy object with these attributes:channel
: AGuildChannel
,Thread
orObject
with the channel ID where the message got blocked.rule_name
: Astr
with the name of the rule that matched.rule_trigger_type
: AnAutoModTriggerType
value with the trigger type of the rule.
- automod_send_alert_message¶
An alert message was sent by an auto moderation rule.
When this is the action, the type of
target
is theMember
orUser
who had their message flagged. If the user is not found then it is aObject
with the user’s ID.See
automod_block_message
for more information on how theextra
field is set.
- class disnake.AuditLogActionCategory[source]¶
Represents the category that the
AuditLogAction
belongs to.This can be retrieved via
AuditLogEntry.category
.- create¶
The action is the creation of something.
- delete¶
The action is the deletion of something.
- update¶
The action is the update of something.
- class disnake.TeamMembershipState[source]¶
Represents the membership state of a team member retrieved through
Client.application_info()
.New in version 1.3.
- invited¶
Represents an invited member.
- accepted¶
Represents a member currently in the team.
- class disnake.WebhookType[source]¶
Represents the type of webhook that can be received.
New in version 1.3.
- incoming¶
Represents a webhook that can post messages to channels with a token.
- channel_follower¶
Represents a webhook that is internally managed by Discord, used for following channels.
- application¶
Represents a webhook that is used for interactions or applications.
New in version 2.0.
- class disnake.ExpireBehaviour[source]¶
Represents the behaviour the
Integration
should perform when a user’s subscription has finished.There is an alias for this called
ExpireBehavior
.New in version 1.4.
- remove_role¶
This will remove the
StreamIntegration.role
from the user when their subscription is finished.
- kick¶
This will kick the user when their subscription is finished.
- class disnake.DefaultAvatar[source]¶
Represents the default avatar of a Discord
User
- blurple¶
Represents the default avatar with the color blurple. See also
Colour.blurple
- grey¶
Represents the default avatar with the color grey. See also
Colour.greyple
- green¶
Represents the default avatar with the color green. See also
Colour.green
- orange¶
Represents the default avatar with the color orange. See also
Colour.orange
- red¶
Represents the default avatar with the color red. See also
Colour.red
- class disnake.StickerType[source]¶
Represents the type of sticker.
New in version 2.0.
- standard¶
Represents a standard sticker that all Nitro users can use.
- guild¶
Represents a custom sticker created in a guild.
- class disnake.StickerFormatType[source]¶
Represents the type of sticker images.
New in version 1.6.
- png¶
Represents a sticker with a png image.
- apng¶
Represents a sticker with an apng image.
- lottie¶
Represents a sticker with a lottie image.
- gif¶
Represents a sticker with a gif image.
New in version 2.8.
- class disnake.InviteTarget[source]¶
Represents the invite type for voice channel invites.
New in version 2.0.
- unknown¶
The invite doesn’t target anyone or anything.
- stream¶
A stream invite that targets a user.
- embedded_application¶
A stream invite that targets an embedded application.
- class disnake.VideoQualityMode[source]¶
Represents the camera video quality mode for voice channel participants.
New in version 2.0.
- auto¶
Represents auto camera video quality.
- full¶
Represents full camera video quality.
- class disnake.StagePrivacyLevel[source]¶
Represents a stage instance’s privacy level.
New in version 2.0.
- public¶
The stage instance can be joined by external users.
Deprecated since version 2.5: Public stages are no longer supported by discord.
- closed¶
The stage instance can only be joined by members of the guild.
- class disnake.NSFWLevel[source]¶
Represents the NSFW level of a guild.
New in version 2.0.
- x == y
Checks if two NSFW levels are equal.
- x != y
Checks if two NSFW levels are not equal.
- x > y
Checks if a NSFW level is higher than another.
- x < y
Checks if a NSFW level is lower than another.
- x >= y
Checks if a NSFW level is higher or equal to another.
- x <= y
Checks if a NSFW level is lower or equal to another.
- default¶
The guild has not been categorised yet.
- explicit¶
The guild contains NSFW content.
- safe¶
The guild does not contain any NSFW content.
- age_restricted¶
The guild may contain NSFW content.
- class disnake.GuildScheduledEventEntityType[source]¶
Represents the type of a guild scheduled event entity.
New in version 2.3.
- stage_instance¶
The guild scheduled event will take place in a stage channel.
- voice¶
The guild scheduled event will take place in a voice channel.
- external¶
The guild scheduled event will take place in a custom location.
- class disnake.GuildScheduledEventStatus[source]¶
Represents the status of a guild scheduled event.
New in version 2.3.
- scheduled¶
Represents a scheduled event.
- active¶
Represents an active event.
- completed¶
Represents a completed event.
- canceled¶
Represents a canceled event.
- class disnake.GuildScheduledEventPrivacyLevel[source]¶
Represents the privacy level of a guild scheduled event.
New in version 2.3.
- guild_only¶
The guild scheduled event is only for a specific guild.
- class disnake.ThreadArchiveDuration[source]¶
Represents the automatic archive duration of a thread in minutes.
New in version 2.3.
- hour¶
The thread will archive after an hour of inactivity.
- day¶
The thread will archive after a day of inactivity.
- three_days¶
The thread will archive after three days of inactivity.
- week¶
The thread will archive after a week of inactivity.
- class disnake.WidgetStyle[source]¶
Represents the supported widget image styles.
New in version 2.5.
- shield¶
A shield style image with a Discord icon and the online member count.
- banner1¶
A large image with guild icon, name and online member count and a footer.
- banner2¶
A small image with guild icon, name and online member count.
- banner3¶
A large image with guild icon, name and online member count and a footer, with a “Chat Now” label on the right.
- banner4¶
A large image with a large Discord logo, guild icon, name and online member count, with a “Join My Server” label at the bottom.
- class disnake.Locale[source]¶
Represents supported locales by Discord.
New in version 2.5.
- bg¶
The
bg
(Bulgarian) locale.
- cs¶
The
cs
(Czech) locale.
- da¶
The
da
(Danish) locale.
- de¶
The
de
(German) locale.
- el¶
The
el
(Greek) locale.
- en_GB¶
The
en_GB
(English, UK) locale.
- en_US¶
The
en_US
(English, US) locale.
- es_ES¶
The
es_ES
(Spanish) locale.
- fi¶
The
fi
(Finnish) locale.
- fr¶
The
fr
(French) locale.
- hi¶
The
hi
(Hindi) locale.
- hr¶
The
hr
(Croatian) locale.
- hu¶
The
hu
(Hungarian) locale.
- id¶
The
id
(Indonesian) locale.New in version 2.8.
- it¶
The
it
(Italian) locale.
- ja¶
The
ja
(Japanese) locale.
- ko¶
The
ko
(Korean) locale.
- lt¶
The
lt
(Lithuanian) locale.
- nl¶
The
nl
(Dutch) locale.
- no¶
The
no
(Norwegian) locale.
- pl¶
The
pl
(Polish) locale.
- pt_BR¶
The
pt_BR
(Portuguese) locale.
- ro¶
The
ro
(Romanian) locale.
- ru¶
The
ru
(Russian) locale.
- sv_SE¶
The
sv_SE
(Swedish) locale.
- th¶
The
th
(Thai) locale.
- tr¶
The
tr
(Turkish) locale.
- uk¶
The
uk
(Ukrainian) locale.
- vi¶
The
vi
(Vietnamese) locale.
- zh_CN¶
The
zh_CN
(Chinese, China) locale.
- zh_TW¶
The
zh_TW
(Chinese, Taiwan) locale.
- class disnake.AutoModActionType[source]¶
Represents the type of action an auto moderation rule will take upon execution.
New in version 2.6.
- block_message¶
The rule will prevent matching messages from being posted.
- send_alert_message¶
The rule will send an alert to a specified channel.
- timeout¶
The rule will timeout the user that sent the message.
Note
This action type is only available for rules with trigger type
keyword
ormention_spam
, andmoderate_members
permissions are required to use it.
- class disnake.AutoModEventType[source]¶
Represents the type of event/context an auto moderation rule will be checked in.
New in version 2.6.
- message_send¶
The rule will apply when a member sends or edits a message in the guild.
- class disnake.AutoModTriggerType[source]¶
Represents the type of content that can trigger an auto moderation rule.
New in version 2.6.
- keyword¶
The rule will filter messages based on a custom keyword list.
This trigger type requires additional
metadata
.
- harmful_link¶
The rule will filter messages containing malicious links.
- spam¶
The rule will filter messages suspected of being spam.
- class disnake.ThreadSortOrder[source]¶
Represents the sort order of threads in
ForumChannel
s.New in version 2.6.
- latest_activity¶
Sort forum threads by activity.
- creation_date¶
Sort forum threads by creation date/time (from newest to oldest).
- class disnake.ThreadLayout[source]¶
Represents the layout of threads in
ForumChannel
s.New in version 2.8.
- not_set¶
No preferred layout has been set.
- list_view¶
Display forum threads in a text-focused list.
- gallery_view¶
Display forum threads in a media-focused collection of tiles.
- class disnake.ApplicationRoleConnectionMetadataType[source]¶
Represents the type of a role connection metadata value.
These offer comparison operations, which allow guilds to configure role requirements based on the metadata value for each user and a guild-specified configured value.
New in version 2.8.
- integer_less_than_or_equal¶
The metadata value (
integer
) is less than or equal to the guild’s configured value.
- integer_greater_than_or_equal¶
The metadata value (
integer
) is greater than or equal to the guild’s configured value.
- integer_equal¶
The metadata value (
integer
) is equal to the guild’s configured value.
- integer_not_equal¶
The metadata value (
integer
) is not equal to the guild’s configured value.
- datetime_less_than_or_equal¶
The metadata value (
ISO8601 string
) is less than or equal to the guild’s configured value (integer
; days before current date).
- datetime_greater_than_or_equal¶
The metadata value (
ISO8601 string
) is greater than or equal to the guild’s configured value (integer
; days before current date).
- boolean_equal¶
The metadata value (
integer
) is equal to the guild’s configured value.
- boolean_not_equal¶
The metadata value (
integer
) is not equal to the guild’s configured value.
- 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_update = <Event.guild_role_update: 'guild_role_update'>¶
Called when a Guild updates a Role. Represents the
on_guild_role_update()
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_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