User Models#

class interactions.api.models.user.User(kwargs_dict=None, /, **other_kwargs)[source]#

A class object representing a user.

Variables:
  • id (Snowflake) – The User ID

  • username (str) – The Username associated (not necessarily unique across the platform)

  • discriminator (str) – The User’s 4-digit discord-tag (i.e.: XXXX)

  • avatar (Optional[str]) – The user’s avatar hash, if any

  • bot (Optional[bool]) – A status denoting if the user is a bot

  • system (Optional[bool]) – A status denoting if the user is an Official Discord System user

  • mfa_enabled (Optional[bool]) – A status denoting if the user has 2fa on their account

  • banner (Optional[str]) – The user’s banner hash, if any

  • banner_color (Optional[str]) – The user’s banner color as a hex, if any

  • accent_color (Optional[int]) – The user’s banner color as an integer represented of hex color codes

  • locale (Optional[str]) – The user’s chosen language option

  • verified (Optional[bool]) – Whether the email associated with this account has been verified

  • email (Optional[str]) – The user’s email, if any

  • flags (Optional[UserFlags]) – The user’s flags

  • premium_type (Optional[int]) – The type of Nitro subscription the user has

  • public_flags (Optional[UserFlags]) – The user’s public flags

has_public_flag(flag)[source]#

New in version 4.3.0.

Returns whether the user has public flag.

Return type:

bool

property mention: str#

New in version 4.1.0.

Returns a string that allows you to mention the given user.

Returns:

The string of the mentioned user.

Return type:

str

property avatar_url: str#

New in version 4.2.0.

Returns the URL of the user’s avatar

Returns:

URL of the user’s avatar.

Return type:

str

property banner_url: Optional[str]#

New in version 4.2.0.

Returns the URL of the user’s banner.

Returns:

URL of the user’s banner (None will be returned if no banner is set)

Return type:

str

property presence: Optional[Presence]#

New in version 4.3.2.

Returns the presence of the user.

Returns:

Presence of the user (None will be returned if not cached)

Return type:

Optional[Presence]

property created_at: datetime#

New in version 4.4.0.

Returns when the user was created.

async send(content=<interactions.MISSING>, *, components=<interactions.MISSING>, tts=<interactions.MISSING>, attachments=<interactions.MISSING>, files=<interactions.MISSING>, embeds=<interactions.MISSING>, allowed_mentions=<interactions.MISSING>)[source]#

New in version 4.3.2.

Sends a DM to the user.

Parameters:
  • content (Optional[str]) – The contents of the message as a string or string-converted value.

  • components (Optional[Union[ActionRow, Button, SelectMenu, List[ActionRow], List[Button], List[SelectMenu]]]) – A component, or list of components for the message.

  • tts (Optional[bool]) – Whether the message utilizes the text-to-speech Discord programme or not.

  • attachments (Optional[List[Attachment]]) – The attachments to attach to the message. Needs to be uploaded to the CDN first

  • files (Optional[Union[File, List[File]]]) – A file or list of files to be attached to the message.

  • embeds (Optional[Union[Embed, List[Embed]]]) – An embed, or list of embeds for the message.

  • allowed_mentions (Optional[Union[AllowedMentions, dict]]) – The allowed mentions for the message.

Returns:

The sent message as an object.

Return type:

Message

async get_dm_channel()[source]#

New in version 4.4.0.

Gets the DM channel with the user

Returns:

The DM channel with the user

Return type:

Channel