Discord Objects¶
- class discord.objects.Application[source]¶
-
- approximate_user_authorization_count: Optional[int]¶
Approximate count of users that have OAuth2 authorization for the app
- approximate_user_install_count: Optional[int]¶
Approximate count of users that have installed the app (authorized with
application.commandsas a scope)
- bot_public: bool¶
When
False, only the app owner can add the app to the guilds
- bot_require_code_grant: bool¶
When
True, the app’s bot will only join upon completion of the full OAuth2 code grant flow
- description: str¶
Description of the app
- event_webhook_status: Optional[ApplicationEventWebhookStatus]¶
If webhook events are enabled for the app.
1(default) means disabled,2means enabled,3means disabled by Discord
- event_webhooks_types: Optional[list[WebhookEventType]]¶
List of
WebhookEventTypes the app subscribes to
- event_webhooks_url: Optional[Nullable[str]]¶
Event webhooks URL for the app to receive webhook events
- flags: Optional[ApplicationFlag]¶
App’s public flags
- guild_id: Optional[Snowflake]¶
Guild associated with the app. For example, a developer support server.
- install_params: Optional[InstallParams]¶
Settings for the app’s default in-app authorization link, if enabled
- integration_types_config: Optional[dict[ApplicationIntegrationType, ApplicationIntegrationTypeConfiguration]]¶
Default scopes and permissions for each supported installation context
- name: str¶
Name of the app
- primary_sku_id: Optional[Snowflake]¶
If this app is a game sold on Discord, this field will be the id of the “Game SKU” that is created, if exists
- role_connections_verification_url: Optional[Nullable[str]]¶
Role connections verification URL for the app
- slug: Optional[str]¶
If this app is a game sold on Discord, this field will be the URL slug that links to the store page
- tags: Optional[list[str]]¶
List of tags describing the content and functionality of the app. Max of 5 tags.
- verify_key: str¶
Hex encoded key for verification in interactions and the Game SDK’s GetTicket
- class discord.objects.ApplicationCommandPermissions[source]¶
Application command permissions allow you to enable or disable commands for specific users, roles, or channels within a guild.
- permission: bool¶
Trueto allow,Falseto disallow
- type: ApplicationCommandPermissionType¶
Role, user, or channel
- class discord.objects.ApplicationIntegrationTypeConfiguration[source]¶
- oauth2_install_params: Optional[InstallParams]¶
Install params for each installation context’s default in-app authorization link
- class discord.objects.AutoModerationAction[source]¶
An action which will execute whenever a rule is triggered.
*
metadatacan be omitted based ontype.- metadata: Optional[AutoModerationActionMetadata]¶
Additional metadata needed during execution for this specific action type
- type: AutoModerationActionType¶
The type of action
- class discord.objects.AutoModerationActionMetadata[source]¶
Additional data used when an action is executed. Different fields are relevant based on the value of
action type.- channel_id: Snowflake¶
Channel to which user content should be logged.
Associated action type:
SEND_ALERT_MESSAGEConstraints: Existing channel
- custom_message: Optional[str]¶
Additional explanation that will be shown to members whenever their message is blocked.
Associated action type:
BLOCK_MESSAGEConstraints: Maximum of
150characters
- class discord.objects.AutoModerationRule[source]¶
- actions: list[AutoModerationAction]¶
The actions which will execute when the rule is triggered
- enabled: bool¶
Whether the rule is enabled
- event_type: AutoModerationRuleEventType¶
The rule event type
- exempt_channels: list[Snowflake]¶
The channel IDs that should not be affected by the rule (maximum of 20)
- name: str¶
The rule name
- trigger_metadata: AutoModerationRuleTriggerMetadata¶
The rule trigger metadata
- trigger_type: AutoModerationRuleTriggerType¶
The rule trigger type
- class discord.objects.AutoModerationRuleTriggerMetadata[source]¶
Additional data used to determine whether a rule should be triggered. Different fields are relevant based on the value of
trigger_type.- allow_list: list[str]¶
Substrings which should not trigger the rule (maximum of 100 or 1000).
Associated trigger types:
KEYWORD,KEYWORD_PRESET,MEMBER_PROFILETip
Each
allow_listkeyword can be a phrase which contains multiple words. Wildcard symbols can be used to customize how each keyword will be matched. Rules withKEYWORDtrigger type accept a maximum of 100 keywords. Rules withKEYWORD_PRESETtrigger type accept a maximum of 1000 keywords.
- keyword_filter: list[str]¶
Substrings which will be searched for in content (maximum of 1000).
Associated trigger types:
KEYWORD,MEMBER_PROFILETip
A keyword can be a phrase which contains multiple words. Wildcard symbols can be used to customize how each keyword will be matched. Each keyword must be 60 characters or less.
- mention_raid_protection_enabled: bool¶
Whether to automatically detect mention raids.
Associated trigger types:
MENTION_SPAM
- mention_total_limit: int¶
Total number of unique role and user mentions allowed per message (maximum of 50).
Associated trigger types:
MENTION_SPAM
- presets: list[AutoModerationRuleKeywordPresetType]¶
The internally pre-defined wordsets which will be searched for in content.
Associated trigger types:
KEYWORD_PRESET
- regex_patterns: list[str]¶
Regular expression patterns which will be matched against content (maximum of 10).
Associated trigger types:
KEYWORD,MEMBER_PROFILENote
Only Rust-flavored regex is currently supported, which can be tested in online editors such as Rustexp. Each regex pattern must be 260 characters or less.
- class discord.objects.AvatarDecorationData[source]¶
The data for the user’s avatar decoration
- asset: str¶
The avatar decoration hash
- class discord.objects.Channel[source]¶
Represents a guild or DM channel within Discord.
- app_permissions: Optional[PermissionFlag]¶
Computed permissions for the bot user in the channel, including overwrites, only included when part of the
resolveddata received on an interaction. This does not include implicit permissions, which may need to be checked separately
- applied_tags: Optional[list[Snowflake]]¶
The IDs of the set of tags that have been applied to a thread in a
GUILD_FORUMor aGUILD_MEDIAchannel
- available_tags: Optional[list[ForumTag]]¶
The set of tags that can be used in a
GUILD_FORUMor aGUILD_MEDIAchannel
- default_auto_archive_duration: Optional[int]¶
Default duration, copied onto newly created threads, in minutes, threads will stop showing in the channel list after the specified period of inactivity, can be set to: 60, 1440, 4320, 10080
- default_forum_layout: Optional[ForumLayoutType]¶
The default forum layout view used to display posts in
GUILD_FORUMchannels. Defaults toNOT_SET, which indicates a layout view has not been set by a channel admin
- default_reaction_emoji: Optional[Nullable[DefaultReaction]]¶
The emoji to show in the add reaction button on a thread in a
GUILD_FORUMor aGUILD_MEDIAchannel
- default_sort_order: Optional[Nullable[DefaultSortOrderType]]¶
The default sort order type used to order posts in
GUILD_FORUMandGUILD_MEDIAchannels. Defaults toNone, which indicates a preferred sort order hasn’t been set by a channel admin
- default_thread_rate_limit_per_user: Optional[int]¶
The initial
rate_limit_per_userto set on newly created threads in a channel. This field is copied to the thread at creation time and does not live update
- flags: Optional[ChannelFlag]¶
Channel flags combined as a bitfield
- guild_id: Optional[Snowflake]¶
The ID of the guild (may be missing for some channel objects received over gateway guild dispatches)
- last_message_id: Optional[Nullable[Snowflake]]¶
The ID of the last message sent in this channel (or thread for
discord.enums.ChannelType.GUILD_FORUMorGUILD_MEDIAchannels) (may not point to an existing or valid message or thread)
- last_pin_timestamp: Optional[Nullable[ISO8601Timestamp]]¶
When the last pinned message was pinned. This may be
Nonein events such asGUILD_CREATEwhen a message is not pinned
- managed: Optional[bool]¶
For group DM channels: whether the channel is managed by an application via the
gdm.joinOAuth2 scope
- member: Optional[ThreadMember]¶
Thread member object for the current user, if they have joined the thread, only included on certain API endpoints
- message_count: Optional[int]¶
Number of messages (not including the initial message or deleted messages) in a thread.
Note
For threads created before July 1, 2022, the message count is inaccurate when it’s greater than 50.
- parent_id: Optional[Nullable[Snowflake]]¶
For guild channels: ID of the parent category for a channel (each parent category can contain up to 50 channels), for threads: ID of the text channel this thread was created
- permission_overwrites: Optional[list[PermissionOverwrite]]¶
Explicit permission overwrites for members and roles
- permissions: Optional[PermissionFlag]¶
Computed permissions for the invoking user in the channel, including overwrites, only included when part of the
resolveddata received on an interaction. This does not include implicit permissions, which may need to be checked separately
- position: Optional[int]¶
Sorting position of the channel (channels with the same position are sorted by id)
- rate_limit_per_user: Optional[int]¶
Amount of seconds a user has to wait before sending another message (0-21600); bots, as well as users with the permission
BYPASS_SLOWMODE, are unaffectedTip
rate_limit_per_useralso applies to thread creation. Users can send one message and create one thread during eachrate_limit_per_userinterval.
- rtc_region: Optional[Nullable[str]]¶
Voice region ID for the voice channel, automatic when set to null
- thread_metadata: Optional[ThreadMetadata]¶
Thread-specific fields not needed by other channels
- topic: Optional[Nullable[str]]¶
The channel topic (0-4096 characters for
GUILD_FORUMandGUILD_MEDIAchannels, 0-1024 characters for all others)
- total_messages_sent: Optional[int]¶
Number of messages ever sent in a thread, it’s similar to
message_counton message creation, but will not decrement the number when a message is deleted
- type: ChannelType¶
The type of channel
- video_quality_mode: Optional[VideoQualityMode]¶
The camera video quality mode of the voice channel,
1when not present
- class discord.objects.Collectible[source]¶
The collectibles the user has, excluding Avatar Decorations and Profile Effects.
- class discord.objects.DefaultReaction[source]¶
An object that specifies the emoji to use as the default way to react to a forum post. Exactly one of
emoji_idandemoji_namemust be set
- class discord.objects.Emoji[source]¶
- class discord.objects.ForumTag[source]¶
Represents a tag that is able to be applied to a thread in a
GUILD_FORUMorGUILD_MEDIAchannel.Important
When updating a
GUILD_FORUMor aGUILD_MEDIAchannel, tag objects inavailable_tagsonly require thenamefield.* At most one of
emoji_idandemoji_namemay be set to a non-null value.- moderated: bool¶
Whether this tag can only be added to or removed from threads by a member with the
MANAGE_THREADSpermission
- name: str¶
The name of the tag (0-20 characters)
- class discord.objects.Guild[source]¶
Represents an isolated collection of users and channels, and are often referred to as “servers” in the UI.
- afk_timeout: int¶
AFK timeout in seconds
- approximate_member_count: Optional[int]¶
Approximate number of members in this guild, retunred from the
GET /guilds/<id>and/users/@me/guildsendpoints whenwith_countsisTrue
- approximate_presence_count: Optional[int]¶
Approximate number of non-offline members in this guild, returned from the
GET /guilds/<id>and/users/@me/guildsendpoints whenwith_countsisTrue
- default_message_notifications: DefaultMessageNotificationLevel¶
Default message notifications level
- discovery_splash: Nullable[str]¶
Discovery splash hash; only present for guilds with the “DISCOVERABLE” feature
- explicit_content_filter: ExplicitContentFilterLevel¶
Explicit content filter level
- features: list[GuildFeature]¶
Enabled guild feature
- incidents_data: Nullable[IncidentsData]¶
The incidents data for this guild
- max_presences: Optional[Nullable[int]]¶
The maximum number of presences for the guild (
Noneis always returned, arapt from the largest of guilds)
- name: str¶
Guild name (2-100 characters, excluding trailing and leading whitespace)
- nsfw_level: GuildAgeRestrictionLevel¶
Guild age-restriction level
- owner_id: Snowflake¶
ID of the owner.
Note
This field is only sent when using the
get_current_user_guilds()endpoint and are relative to the requested user.
- permissions: Optional[PermissionFlag]¶
Total permissiosn for the user in the guild (excludes overwrites and implicit permissions).
Note
This field is only sent when using the
get_current_user_guilds()endpoint and are relative to the requested user.
- preferred_locale: Locale¶
The preferred locale of a Community guild; used in server discovery and notices from Discord, and sent in interactions; defaults to
ENGLISH_US
Whether the guild has the boost progress bar enabled
The number of boosts this guild currently has
Premium tier (Server Boost level)
- public_updates_channel_id: Nullable[Snowflake]¶
The ID of the channel where admins and moderators of Community guilds receive notices from Discord
- region: Optional[Nullable[str]]¶
Voice region Id of the guild (deprecated).
Attention
This field is deprecated and is replaced by
discord.objects.Channel.rtc_region.
- rules_channels_id: Nullable[Snowflake]¶
The ID of the channel where Community guilds can display rules and/or guidelines
- safety_alerts_channel_id: Nullable[Snowflake]¶
The ID of the channel where admins and moderators of Community guilds receive safety alerts from Discord
- system_channel_flags: SystemChannelFlag¶
System channel flags
- system_channel_id: Nullable[Snowflake]¶
The ID of the channel where guild notices such as welcome messages and boost events are posted
- verification_level: VerificationLevel¶
Verification level required for the guild
- welcome_screen: Optional[WelcomeScreen]¶
The welcome screen of a Community guild, shown to new members, returned in an
Invite’s guild object
- class discord.objects.GuildApplicationCommandPermissions[source]¶
Returned when fetching the permissions for an app’s command(s) in a guild.
When the
idfield is the application ID instead of a command ID, the permissions apply to all commands that do not contain explicit overwrites.- permissions: list[ApplicationCommandPermissions]¶
Permissions for the command in the guild, max of 100
- class discord.objects.GuildMember[source]¶
Note
The field
userwon’t be included in the member object attached toMESSAGE_CREATEandMESSAGE_UPDATEgateway events.Note
In
GUILD_events,pendingwill always be included asTrueorFalse. In non-GUILD_events which can only be triggered by non-pendingusers,pendingwlil not be included.Note
Member objects retrieved from
VOICE_STATE_UPDATEevents will havejoined_atset asNoneif the member was invited as a guest.- avatar_decoration_data: Optional[Nullable[AvatarDecorationData]]¶
Data for the member’s guild avatar decoration.
- collectibles: Optional[Nullable[Collectible]]¶
Data for the member’s collectibles.
- communication_disabled_until: Optional[Nullable[ISO8601Timestamp]]¶
When the user’s timeout will expire and the user will be able to communicate in teh guild again, null or a time in the past if the user is not timed out.
- deaf: bool¶
Whether the user is deafened in voice channels.
- flags: GuildMemberFlag¶
Guild member flags represented as a bit set, defaults to
0.
- joined_at: Optional[ISO8601Timestamp]¶
When the user joined the guild.
- mute: bool¶
Whether the user is muted in voice channels.
- pending: Optional[bool]¶
Whether the user has not yet passed the guild’s Membership Screening requirements.
- permissions: Optional[PermissionFlag]¶
Total permissions of the member in the channel, including overwrites, returned when in the interaction object.
When the user started boosting the guild.
- class discord.objects.IncidentsData[source]¶
- dm_spam_detected_at: Optional[Nullable[ISO8601Timestamp]]¶
When the dm spam was detected
- dms_disabled_until: Nullable[ISO8601Timestamp]¶
When direct messages get enabled again
- invites_disabled_until: Nullable[ISO8601Timestamp]¶
When invites get enabled again
- raid_detected_at: Optional[Nullable[ISO8601Timestamp]]¶
When the raid was detected
- class discord.objects.InstallParams[source]¶
- permissions: PermissionFlag¶
Permissions to request for the bot role
- scopes: list[str]¶
Scopes to add the application to the server with
- class discord.objects.Nameplate[source]¶
The nameplate the user has.
- asset: str¶
Path to the nameplate asset
- label: str¶
The label of this nameplate. Currently unused
- palette: NameplatePalette¶
Background color of the nameplate
- class discord.objects.PermissionOverwrite[source]¶
- allow: PermissionFlag¶
Permission bit set to allow
- deny: PermissionFlag¶
Permission bit set to deny
- type: int¶
Either
0(role) or1(member)
- class discord.objects.Role[source]¶
Roles represent a set of permissions attached to a group of users.
- color: int¶
Deprecated. Integer representation of hexadecimal color code.
- colors: RoleColors¶
The role’s colors
- hoist: bool¶
If this role is pinned in the user listing
- managed: bool¶
Whether this role is managed by an integration
- mentionable: bool¶
Whether this role is mentionable
- name: str¶
Role name
- permissions: PermissionFlag¶
Permission bit set
- position: int¶
Position of this role (roles with the same position are sorted by ID)
- class discord.objects.SessionStartLimit[source]¶
- max_concurrency: int¶
Number of identify requests allowed per 5 seconds
- remaining: int¶
Remaining number of session starts the current user is allowed
- reset_after: int¶
Number of milliseconds after which the limit resets
- total: int¶
Total number of session starts the current user is allowed
- class discord.Snowflake[source]¶
Represents a Discord snowflake
- property increment: int¶
For every ID that is generated on that process, this number is incremented
- property internal_process_id: int¶
- property internal_worker_id: int¶
- property timestamp: int¶
Milliseconds since Discord Epoch, the first second of 2015 or
1420070400000
- class discord.objects.Sticker[source]¶
Represents a sticker that can be sent in messages.
- available: Optional[bool]¶
Whether this guild sticker can be used, may be
Falsedue to loss of Server Boosts
- format_type: StickerFormatType¶
Type of sticker format
- name: str¶
Name of the sticker
- tags: list[str]¶
Autocomplete/suggestion tags for the sticker (max 200 characters).
Important
A comma separated list of keywords is the format used in this field by standard stickers, but this is just a convention. Incidentally the client will always use a name generated from an emoji as the value of this field when creating or modifying a guild sticker.
- type: StickerType¶
Type of sticker
- class discord.objects.Team[source]¶
-
- members: list[TeamMember]¶
Members of the team
- name: str¶
Name of the team
- class discord.objects.TeamMember[source]¶
- membership_state: MembershipState¶
User’s membership state on the team
- role: TeamMemberRole¶
Role of the team member
- class discord.objects.ThreadMember[source]¶
Contains information about a user that has joined a thread.
- flags: int¶
Any user-thread settings, currently only used for notifications
- id: Optional[Snowflake]¶
ID of the thread.
Note
Omitted on the member sent within each thread in the
GUILD_CREATEevent.
- join_timestamp: ISO8601Timestamp¶
Time the user last joined the thread
- member: Optional[GuildMember]¶
Additional information about the user.
Important
Only present when
with_memberis set toTruewhen callinglist_thread_members()orget_thread_member().
- class discord.objects.ThreadMetadata[source]¶
Contains number of thread-specific channel fields that are not needed by other channel types.
- archive_timestamp: ISO8601Timestamp¶
Timestamp when the thread’s archive status was last changed, used for calculating recent activity.
- archived: bool¶
Whether the thread is archived.
- auto_archive_duration: int¶
The thread will stop showing in the channel list after
auto_archive_durationminutes of inactivity, can be set to: 60, 1440, 4320, 10080.
- create_timestamp: Optional[ISO8601Timestamp]¶
Timestamp when the thread was created; only populated for threads created after 2022-01-09.
- invitable: Optional[bool]¶
Whether the non-moderators can add other non-moderators to a thread; only available on private threads.
- locked: bool¶
Whether the thread is locked; when a thread is locked, only users with
MANAGE_THREADScan unarchive it.
Represents an Offline Guild, or a Guild whose information has not been provided through Guild Create events during the Gateway connect
- class discord.objects.User[source]¶
Represents a Discord user
- accent_color: Optional[Nullable[int]]¶
The user’s banner color encoded as an integer representation of hexadecimal color code
- avatar_decoration_data: Optional[Nullable[AvatarDecorationData]]¶
Data for the user’s avatar decoration
- collectibles: Optional[Nullable[Collectible]]¶
Data for the user’s collectibles
- discriminator: str¶
The user’s Discord-tag
The type of Nitro subscription on a user’s account
- primary_guild: Optional[Nullable[UserPrimaryGuild]]¶
The user’s primary guild
- system: Optional[bool]¶
Whether the user is an Official Discord System user (part of the urgent message system)
- username: str¶
The user’s username, not unique across the platform
- class discord.objects.UserPrimaryGuild[source]¶
- class discord.objects.WelcomeScreen[source]¶
-
- welcome_channels: list[WelcomeScreenChannel]¶
The channels shown in the welcome screen, up to 5