User

discord_http.user module

class discord_http.user.PartialUser(*, state: DiscordAPI, id: int)[source]

Bases: PartialBase

async create_dm() DMChannel[source]

DMChannel: Creates a DM channel with the user

property default_avatar: Asset

Returns the default avatar of the user

Type:

Asset

async fetch() User[source]

User: Fetches the user

property mention: str

Returns a string that allows you to mention the user

Type:

str

async send(content: str | None = <MISSING>, *, channel_id: int | None = <MISSING>, embed: ~discord_http.embeds.Embed | None = <MISSING>, embeds: list[~discord_http.embeds.Embed] | None = <MISSING>, file: ~discord_http.file.File | None = <MISSING>, files: list[~discord_http.file.File] | None = <MISSING>, view: ~discord_http.view.View | None = <MISSING>, tts: bool | None = False, type: ~discord_http.enums.ResponseType | int = 4, allowed_mentions: ~discord_http.mentions.AllowedMentions | None = <MISSING>, delete_after: float | None = None) Message[source]

Send a message to the user

Parameters:
  • content (Optional[str]) – Content of the message

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

  • embed (Optional[Embed]) – Embed of the message

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

  • file (Optional[File]) – File of the message

  • files (Optional[Union[list[File], File]]) – Files of the message

  • view (Optional[View]) – Components of the message

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

  • type (Optional[ResponseType]) – Which type of response should be sent

  • allowed_mentions (Optional[AllowedMentions]) – Allowed mentions of the message

  • delete_after (Optional[float]) – How long to wait before deleting the message

Returns:

The message that was sent

Return type:

Message

class discord_http.user.User(*, state: DiscordAPI, data: dict)[source]

Bases: PartialUser

property display_avatar: Asset | None

Returns the display avatar of the member

Type:

Optional[Asset]

property display_name: str

Returns the user’s display name

Type:

str

property global_avatar: Asset | None

Alias for User.avatar

Type:

Asset

class discord_http.user.UserClient(*, state: DiscordAPI, data: dict)[source]

Bases: User

async edit(*, username: str | None = <MISSING>, avatar: bytes | None = <MISSING>, banner: bytes | None = <MISSING>) UserClient[source]