User

discord_http.user module

class discord_http.user.Application(*, state, data)

Bases: PartialBase

Represents a user client object.

Parameters:
name: str

The name of the application.

icon: Asset | None

The icon of the application, if any.

description: str | None

The description of the application, if any.

rpc_origins: list[str]

The RPC origins of the application.

verified
property created_at: datetime

The datetime of the snowflake.

id: int

The ID of the snowflake.

bot_public: bool

Whether the bot is public.

bot_require_code_grant: bool

Whether the bot requires code grant.

bot: User | None

The bot user of the application, if any.

terms_of_service_url: str | None

The URL of the terms of service of the application, if any.

privacy_policy_url: str | None

The URL of the privacy policy of the application, if any.

owner_id: int | None

The ID of the owner of the application, if any.

verify_key: str

The verify key of the application.

guild_id: int | None

The ID of the guild of the application, if the application is a game sold on Discord.

primary_sku_id: int | None

The ID of the primary SKU of the application, if the application is a game sold on Discord.

slug: str | None

The slug of the application, if any.

cover_image: Asset | None

The cover image of the application, if any.

flags: ApplicationFlags

The flags of the application.

approximate_guild_count: int | None

The approximate number of guilds the application is in, if the application is a game sold on Discord.

approximate_user_install_count: int | None

The approximate number of users that have the application installed.

approximate_user_authorization_count: int | None

The approximate number of users that have authorized the application.

redirect_uris: list[str]

The redirect URIs of the application, if any.

interactions_endpoint_url: str | None

The interactions endpoint URL of the application, if any.

role_connections_verification_url: str | None

The role connections verification URL of the application, if any.

event_webhooks_url: str | None

The event webhooks URL of the application, if any.

event_webhooks_status: ApplicationEventWebhookStatus

The event webhooks status of the application.

event_webhooks_types: list[str]

The event webhooks types of the application.

tags: list[str]

The tags of the application.

custom_install_url: str | None

The custom install URL of the application, if any.

install_params: dict | None

The install params of the application, if any.

integration_types_config: dict

The integration types config of the application.

team: Team | None

The team that owns the application, if any.

property owner: PartialUser | None

The owner of the application, if any.

property guild: PartialGuild | None

The guild of the application, if the application is a game sold on Discord.

property primary_sku: PartialSKU | None

The primary SKU of the application, if the application is a game sold on Discord.

async edit(*, custom_install_url=<MISSING>, description=<MISSING>, role_connections_verification_url=<MISSING>, install_params=<MISSING>, integration_types_config=<MISSING>, flags=<MISSING>, icon=<MISSING>, cover_image=<MISSING>, interactions_endpoint_url=<MISSING>, tags=<MISSING>, event_webhooks_url=<MISSING>, event_webhooks_status=<MISSING>, event_webhooks_types=<MISSING>) → Application

Edit the current application.

Only limited intent flags can be updated through flags.

Parameters:
  • custom_install_url (str | None) – New custom install URL of the application

  • description (str | None) – New description of the application

  • role_connections_verification_url (str | None) – New role connections verification URL of the application

  • install_params (dict | None) – New install params of the application

  • integration_types_config (dict | None) – New integration types config of the application

  • flags (ApplicationFlags | int | None) – New flags of the application

  • icon (File | bytes | None) – New icon of the application

  • cover_image (File | bytes | None) – New cover image of the application

  • interactions_endpoint_url (str | None) – New interactions endpoint URL of the application

  • tags (list[str] | None) – New tags of the application

  • event_webhooks_url (str | None) – New event webhooks URL of the application

  • event_webhooks_status (ApplicationEventWebhookStatus | int | None) – New event webhooks status of the application

  • event_webhooks_types (list[str] | None) – New event webhooks types of the application

Return type:

Application

Returns:

The edited application

async fetch_role_connection_metadata() → list[ApplicationRoleConnectionMetadata]

Fetches the role connection metadata records for the application.

Return type:

list[ApplicationRoleConnectionMetadata]

async edit_role_connection_metadata(records) → list[ApplicationRoleConnectionMetadata]

Updates the role connection metadata records for the application.

Parameters:

records (list[ApplicationRoleConnectionMetadata]) – The new metadata records for the application (max 5)

Return type:

list[ApplicationRoleConnectionMetadata]

Returns:

The updated metadata records

class discord_http.user.ApplicationRoleConnectionMetadata(*, type, key, name, description, name_localizations=None, description_localizations=None)

Bases: object

Represents a single application role connection metadata record.

Parameters:
type: ApplicationRoleConnectionMetadataType

The type of comparison the metadata value is checked against.

key: str

The dictionary key for the metadata field.

name: str

The name of the metadata field.

description: str

The description of the metadata field.

name_localizations: dict[str, str]

The localizations of the name of the metadata field.

description_localizations: dict[str, str]

The localizations of the description of the metadata field.

classmethod from_dict(data) → ApplicationRoleConnectionMetadata

Creates an ApplicationRoleConnectionMetadata from a dict provided by Discord.

Return type:

ApplicationRoleConnectionMetadata

Parameters:

data (dict)

to_dict() → dict

Returns a dict representation of the metadata record.

Return type:

dict

class discord_http.user.AvatarDecoration(state, data)

Bases: Snowflake

Represents an avatar decoration of a user.

Parameters:
asset

The asset of the avatar decoration.

property sku_id: int

The ID of the SKU associated with the avatar decoration (alias of id).

property shop_url: str

The URL of the avatar decoration asset.

property created_at: datetime

The datetime of the snowflake.

id: int

The ID of the snowflake.

class discord_http.user.DisplayNameStyles(data)

Bases: object

Represents the display name style of a user.

Warning

This is not officially documented by Discord, things can change.

Parameters:

data (dict)

colours: list[Colour]

The colors of the display name, if any.

font: DisplayNameFontType

The font of the display name, if any.

effect: DisplayNameEffectType

The effect of the display name, if any.

to_dict() → dict

Converts the display name style to a dictionary.

Return type:

dict

classmethod create(*, colours, font, effect) → DisplayNameStyles

Creates a display name style object.

Used to easily have an object to pass to the API when editing the application’s display name style.

Parameters:
Return type:

DisplayNameStyles

Returns:

The display name style object.

class discord_http.user.Nameplate(state, data)

Bases: object

Represents a nameplate collectible of a user.

Parameters:
sku_id: int

The ID of the SKU associated with the nameplate.

label: str

The label of the nameplate.

palette: str

The palette of the nameplate.

asset: Asset

The asset of the nameplate.

property shop_url: str

The URL of the avatar decoration asset.

property sku: PartialSKU

The partial SKU associated with the nameplate.

class discord_http.user.PartialUser(*, state, id)

Bases: PartialBase

Represents a partial user object.

Parameters:
property mention: str

A string that allows you to mention the user.

property default_avatar: Asset

The default avatar of the user.

property display_avatar: Asset

The display avatar of the member.

async send(content=<MISSING>, *, channel_id=<MISSING>, embed=<MISSING>, embeds=<MISSING>, file=<MISSING>, files=<MISSING>, view=<MISSING>, tts=False, type=4, flags=<MISSING>, allowed_mentions=<MISSING>, delete_after=None) → Message

Send a message to the user.

Parameters:
  • content (str | None) – Content of the message

  • channel_id (int | None) – Channel ID to send the message to, if not provided, it will create a DM channel

  • embed (Embed | None) – Embed of the message

  • embeds (list[Embed] | None) – Embeds of the message

  • file (File | None) – File of the message

  • files (list[File] | None) – Files of the message

  • view (View | None) – Components of the message

  • tts (bool | None) – Whether the message should be sent as TTS

  • type (ResponseType | int) – Which type of response should be sent

  • flags (MessageFlags | None) – Flags of the message

  • allowed_mentions (AllowedMentions | None) – Allowed mentions of the message

  • delete_after (float | None) – How long to wait before deleting the message

Return type:

Message

Returns:

The message that was sent

async create_dm() → DMChannel

Creates a DM channel with the user.

Return type:

DMChannel

async fetch() → User

Fetches the user.

Return type:

User

async edit(*, username=<MISSING>, avatar=<MISSING>, banner=<MISSING>) → User

Edit the user (only works for the current bot).

Parameters:
  • username (str | None) – The username to change the user to

  • avatar (bytes | None) – New avatar for the user

  • banner (bytes | None) – New banner for the user

Return type:

User

Returns:

The user that was edited

property created_at: datetime

The datetime of the snowflake.

id: int

The ID of the snowflake.

class discord_http.user.PrimaryGuild(state, data)

Bases: object

Represents a primary guild of a user.

This is commonly known as ‘clan’.

Parameters:
guild_id: int | None

The ID of the guild.

tag: str | None

The tag of the guild, if any.

badge: Asset | None

The badge of the guild, if any.

guild() → Guild | PartialGuild | None

Returns the guild object.

Return type:

Guild | PartialGuild | None

class discord_http.user.Team(*, state, data)

Bases: PartialBase

Represents a Discord developer team.

Parameters:
name: str

The name of the team.

icon: Asset | None

The icon of the team, if any.

owner_user_id: int

The ID of the user that owns the team.

members: list[TeamMember]

The members of the team.

property owner: PartialUser

The user that owns the team.

property created_at: datetime

The datetime of the snowflake.

id: int

The ID of the snowflake.

class discord_http.user.TeamMember(*, state, team_id, data)

Bases: PartialBase

Represents a member of a developer team.

Parameters:
team_id: int

The ID of the team this member belongs to.

membership_state: TeamMembershipState

The membership state of the team member.

role: str

The role of the team member.

user: User

The user associated with the team member.

property created_at: datetime

The datetime of the snowflake.

id: int

The ID of the snowflake.

class discord_http.user.User(*, state, data)

Bases: PartialUser

Represents a user object.

Parameters:
name: str

The name of the user.

bot: bool

Whether the user is a bot.

system: bool

Whether the user is a system user.

verified: bool

Whether the user is verified (usually for bots).

discriminator: str | None

The discriminator of the user, if any.

global_name: str | None

The global name of the user, if any.

property avatar: Asset | None

The avatar of the user, if any.

property public_flags: UserFlags | None

The public flags of the user, if any.

property banner: Asset | None

The banner of the user, if any.

property accent_colour: Colour | None

The accent colour of the user, if any.

property banner_colour: Colour | None

The banner colour of the user, if any.

property avatar_decoration: AvatarDecoration | None

The avatar decoration of the member, if available.

property nameplate: Nameplate | None

The nameplate of the member, if available.

property name_style: DisplayNameStyles | None

The display name style of the user, if any.

property primary_guild: PrimaryGuild | None

The primary guild of the user (aka. clan), if any.

property global_avatar: Asset | None

Alias for User.avatar.

property global_banner: Asset | None

Alias for User.banner.

property display_name: str

The user’s display name.

property display_avatar: Asset

The display avatar of the member.

property display_banner: Asset | None

An alias to merge with Member.display_banner.

property display_name_style: DisplayNameStyles | None

An alias to merge with Member.display_name_style.

property display_avatar_decoration: AvatarDecoration | None

An alias to merge with Member.display_avatar_decoration.

property global_avatar_decoration: AvatarDecoration | None

Alias for User.avatar_decoration.

property global_nameplate: Nameplate | None

Alias for User.nameplate.

property display_nameplate: Nameplate | None

An alias to merge with Member.display_nameplate.

is_default_avatar() → bool

Returns whether the user has a default avatar.

Return type:

bool

async create_dm() → DMChannel

Creates a DM channel with the user.

Return type:

DMChannel

property created_at: datetime

The datetime of the snowflake.

property default_avatar: Asset

The default avatar of the user.

async edit(*, username=<MISSING>, avatar=<MISSING>, banner=<MISSING>) → User

Edit the user (only works for the current bot).

Parameters:
  • username (str | None) – The username to change the user to

  • avatar (bytes | None) – New avatar for the user

  • banner (bytes | None) – New banner for the user

Return type:

User

Returns:

The user that was edited

async fetch() → User

Fetches the user.

Return type:

User

id: int

The ID of the snowflake.

property mention: str

A string that allows you to mention the user.

async send(content=<MISSING>, *, channel_id=<MISSING>, embed=<MISSING>, embeds=<MISSING>, file=<MISSING>, files=<MISSING>, view=<MISSING>, tts=False, type=4, flags=<MISSING>, allowed_mentions=<MISSING>, delete_after=None) → Message

Send a message to the user.

Parameters:
  • content (str | None) – Content of the message

  • channel_id (int | None) – Channel ID to send the message to, if not provided, it will create a DM channel

  • embed (Embed | None) – Embed of the message

  • embeds (list[Embed] | None) – Embeds of the message

  • file (File | None) – File of the message

  • files (list[File] | None) – Files of the message

  • view (View | None) – Components of the message

  • tts (bool | None) – Whether the message should be sent as TTS

  • type (ResponseType | int) – Which type of response should be sent

  • flags (MessageFlags | None) – Flags of the message

  • allowed_mentions (AllowedMentions | None) – Allowed mentions of the message

  • delete_after (float | None) – How long to wait before deleting the message

Return type:

Message

Returns:

The message that was sent