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
.
Hint
You can use any of the enum classe members as an attribute of an instance of it to get a bool
whether the instance has this value.
Example:
# channel could be any channel like object
if channel.type.private: # True if channel is a DMChannel
...
# This is the same as
if channel.type == discord.ChannelType.private:
...
- class discord.MessageType
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.
- recipient_add
The system message when a recipient is added to a group private message, i.e. a private channel of type
ChannelType.group
.
- recipient_remove
The system message when a recipient is removed from a group private message, i.e. a private channel of type
ChannelType.group
.
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.
- guild_invite_reminder
The system message denoting that a guild invite reminder has been sent.
New in version 2.0.
A message that is a context menu command.
New in version 2.0.
- role_subscription_purchase
A message informing about a role subscription purchase.
New in version 2.0.
A message informing about a premium upsell.
New in version 2.0.
- stage_raise_hand
A message informing about someone raising their hand in a stage.
New in version 2.0.
The system message denoting that a member has subscribed to a guild application.
New in version 2.4.
- class discord.ReactionType
The type of a
Reaction
.New in version 2.0.
- class discord.SelectDefaultValueType
- user
The
id
represents a user, only valid forUserSelect
andMentionableSelect
- role
The
id
represents a role, only valid forRoleSelect
andMentionableSelect
- channel
The
id
represents a channel, only valid forChannelSelect
- class discord.ButtonStyle
The possible styles for a
Button
- class discord.InteractionType
Specifies the type of an interaction received from discord.
- PingAck
A ping interaction, those are only used for http-only interactions wich are currently not supported by discord4py.
- class discord.InteractionCallbackType
InteractionCallbackType to react to an
BaseInteraction
NAME
VALUE
DESCRIPTION
USAGE
EXAMPLE
1
ACK a
Ping
ACK a Ping to Discord
~
4
respond to an interaction with a message
Interaction.respond
Click to view example
5
ACK an interaction and edit a response later, the user sees a loading state
Possible
response_type
for _deferClick to view example
6
for components, ACK an interaction and edit the original message later; the user does not see a loading state
Possible
response_type
for _deferClick to view example
7
for components, edit the message the component was attached to
Interaction.edit
Click to view example
- class discord.Locale
Valid locals that are used at different places in the discord api.
Note
Usually you can use the lowercase
Language Name
(spaces replaced with underscores) as a valid locale too.Locale
Language Name
Native Name
Danish
Dansk
German
Deutsch
English, UK
English, UK
English, US
English, US
Spanish
Español
French
Français
Croatian
Hrvatski
Italian
Italiano
Lithuanian
Lietuviškai
Hungarian
Magyar
Dutch
Nederlands
Norwegian
Norsk
Polish
Polski
Portuguese/Brazilian
Português do Brasil
Romanian, Romania
Română
Finnish
Suomi
Swedish
Svenska
Vietnamese
Tiếng Việt
Turkish
Türkçe
Czech
Čeština
Greek
Ελληνικά
Bulgarian
български
Russian
Pусский
Ukrainian
Українська
Hindi
हिन्दी
Thai
ไทย
Chinese, China
中文
Japanese
日本語
Chinese, Taiwan
繁體中文
Korean
한국어
- class discord.ActivityType
Specifies the type of
Activity
. This is used to check how to interpret the activity itself.
- class discord.VoiceRegion
Specifies the region a voice server belongs to.
Note
If you wan't to fetch all currently available voice regions, consider using
Client.fetch_voice_regions()
.
- class discord.VideoQualityMode
Specifies the camera video quality for all channel participants in a
VoiceChannel
/StageChannel
.
- class discord.VerificationLevel
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.- 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.
- 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.
- table_flip
An alias for
high
.
- double_table_flip
An alias for
extreme
.
- very_high
An alias for
extreme
.New in version 1.4.
- class discord.NotificationLevel
Specifies whether a
Guild
has notifications on for all messages or mentions only by default.
- class discord.ContentFilter
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.- 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.
- class discord.Status
Specifies a
Member
‘s status.- do_not_disturb
An alias for
dnd
.
- 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.
- class discord.AuditLogAction
Represents the type of action being done for a
AuditLogEntry
, which is retrievable viaGuild.audit_logs()
.- 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
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.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.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.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 undo’d)
When this is the action, the type of
target
is theMember
orUser
who got updated.Possible attributes for
AuditLogDiff
:
- member_role_update
A member’s role has been updated. This triggers when a member either gains a role or losses a role.
When this is the action, the type of
target
is theMember
orUser
who got the role.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.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 theRole
or aObject
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 theObject
with the webhook ID.Possible attributes for
AuditLogDiff
:
- 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 theObject
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
:
- 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.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.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.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 theObject
with the integration ID of the integration which was created.New in version 1.3.
- class discord.AuditLogActionCategory
Represents the category that the
AuditLogAction
belongs to.This can be retrieved via
AuditLogEntry.category
.
- class discord.PremiumType
Represents the user’s Discord Nitro subscription type.
Deprecated since version 1.7.
Note
This only applies to users, not bots.
- class discord.Theme
Represents the theme synced across all Discord clients.
Deprecated since version 1.7.
Note
This only applies to users, not bots.
- class discord.TeamMembershipState
Represents the membership state of a team member retrieved through
Bot.application_info()
.New in version 1.3.
- TeamRole:
A
TeamMember
can be one of four roles (owner, admin, developer, and read-only), and each role inherits the access of those below it. Represents the role of a team member retrieved throughBot.application_info()
.New in version 2.0.
- discord.owner
Owners are the most permissiable role, and can take destructive, irreversible actions like deleting team-owned apps or the team itself. Teams are limited to 1 owner.
- discord.admin
Admins have similar access as an
owner
, except they cannot take destructive actions on the team or team-owned apps.
- discord.developer
Developers can access information about team-owned apps, like the client secret or public key. They can also take limited actions on team-owned apps, like configuring interaction endpoints or resetting the bot token. Members with the Developer role cannot manage the team or its members, or take destructive actions on team-owned apps.
- class discord.TimestampStyle
The Styles you could use for the
style
of adiscord.utils.styled_timestamp()
See also in the Discord-Documentation
- class discord.ExpireBehaviour
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.
- class discord.DefaultAvatar
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
- gray
An alias for
grey
.
- 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 discord.EventEntityType
The location where a
GuildScheduledEvent
will be scheduled at
- class discord.EventStatus
The status of a
GuildScheduledEvent
Note
* Once
status
is set tocompleted
orcanceled
, thestatus
can no longer be updatedValid Guild Scheduled Event Status Transitions
scheduled
–>active
active
——–>completed
scheduled
–>canceled
- class discord.AutoModEventType
Indicates in what event context a
AutoModRule
should be checked.
- class discord.AutoModActionType
The type of action that should be taken in an
AutoModAction
.- timeout_user
Timeout the user for a specific duration
Note
This can only be used when the
trigger_type
iskeyword
- class discord.TextInputStyle
The style a
TextInput
should have- singleline
An aliase for
short
- multiline
An aliase for
paragraph
- class discord.OptionType
Option types for
SlashCommandOption
- string
A string (
str
)
- integer
Any integer between -2^53 and 2^53 (
int
)
- boolean
A boolean (
bool
)
- channel
Includes all channel types + categories
Note
To only accept specific channel types use
SlashCommandOption.channel_types
- role
A role (
Role
)
- number
Any double between -2^53 and 2^53 (
float
)
- attachment
An
Attachment
- class discord.PostSortOrder
Type used to order posts in
ForumChannel
channels.
- class discord.OnboardingMode
Defines the criteria used to satisfy Onboarding constraints that are required for enabling.
- class discord.SKUType
Represents the type of a
SKU
.