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

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>) 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

Returns:

The message that was sent

Return type:

Message

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

Bases: PartialUser

property display_name: str

Returns the user’s display name

Type:

str

property global_avatar: Asset | None

Alias for User.avatar

Type:

Asset