User

discord_http.user module

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

Bases: PartialBase

Represents a user client object.

Parameters:
verified
property created_at: datetime

The datetime of the snowflake.

id: int

The ID of the snowflake.

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.

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: PartialUser | None

The owner of the application, if any.

verify_key: str

The verify key of the application.

guild: PartialGuild | None

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

primary_sku: PartialSKU | None

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, if the application is a game sold on Discord.

approximate_user_authorization_count: int | None

The approximate number of users that have authorized the application, if the application is a game sold on Discord.

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.

class discord_http.user.AvatarDecoration(state, data)

Bases: Snowflake

Represents an avatar decoration of a user.

Parameters:
sku_id: int

The ID of the SKU associated with the avatar decoration.

asset

The asset of the avatar decoration.

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.

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.

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.

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

Bases: PartialBase

Represents a partial user object.

Parameters:
property mention: str

Returns a string that allows you to mention the user.

property default_avatar: Asset

Returns the default avatar of 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

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.User(*, state, data)

Bases: PartialUser

Represents a user object.

Parameters:
avatar: Asset | None

The avatar of the user, if any.

banner: Asset | None

The banner of the user, if any.

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.

accent_colour: Colour | None

The accent colour of the user, if any.

banner_colour: Colour | None

The banner colour of the user, if any.

global_name: str | None

The global name of the user, if any.

public_flags: UserFlags | None

The public flags of the user, if any.

primary_guild: PrimaryGuild | None

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

avatar_decoration: AvatarDecoration | None

The avatar decoration of the member, if available.

nameplate: Nameplate | None

The nameplate of the member, if available.

display_name_styles: DisplayNameStyles | None

The display name style of the user, if any.

property global_avatar: Asset | None

Alias for User.avatar.

property global_banner: Asset | None

Alias for User.banner.

property display_name: str

Returns the user’s display name.

property display_avatar: Asset

Returns the display avatar of the member.

property display_banner: Asset | None

An alias to merge with Member.display_banner.

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.

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

Returns 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

Returns 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