Class User

User Class

Constructors

Properties

id: string

Accessors

  • get bot(): undefined | { owner: string }

    Bot information

    Returns undefined | { owner: string }

  • get limits(): | undefined
    | {
        bots: number;
        file_upload_size_limits: { [key: string]: number };
        message_attachments: number;
        message_length: number;
        outgoing_friend_requests: number;
        servers: number;
        video: boolean;
        video_aspect_ratio: number[];
        video_resolution: number[];
        voice_quality: number;
    }

    Backend enforced limits for a user

    Returns
        | undefined
        | {
            bots: number;
            file_upload_size_limits: { [key: string]: number };
            message_attachments: number;
            message_length: number;
            outgoing_friend_requests: number;
            servers: number;
            video: boolean;
            video_aspect_ratio: number[];
            video_resolution: number[];
            voice_quality: number;
        }

    • undefined
    • {
          bots: number;
          file_upload_size_limits: { [key: string]: number };
          message_attachments: number;
          message_length: number;
          outgoing_friend_requests: number;
          servers: number;
          video: boolean;
          video_aspect_ratio: number[];
          video_resolution: number[];
          voice_quality: number;
      }
      • bots: number

        Format: int64

        Max Owned Bots

      • file_upload_size_limits: { [key: string]: number }
      • message_attachments: number

        Format: int64

        max message attachments

      • message_length: number

        Format: int64

        Max message content length

      • outgoing_friend_requests: number

        Format: int64

        Max Outgoing Friend Requests

      • servers: number

        Format: int64

        max servers

      • video: boolean

        video streaming enabled

      • video_aspect_ratio: number[]

        min/max aspect ratios

      • video_resolution: number[]

        max video resolution (vertical, horizontal)

      • voice_quality: number

        Format: int64

        max audio quality

  • get presence(): "Online" | "Idle" | "Focus" | "Busy" | "Invisible"

    Presence

    Returns "Online" | "Idle" | "Focus" | "Busy" | "Invisible"

  • get status(): | undefined
    | {
        presence?: null
        | "Online"
        | "Idle"
        | "Focus"
        | "Busy"
        | "Invisible";
        text?: null | string;
    }

    User Status

    Returns
        | undefined
        | {
            presence?: null
            | "Online"
            | "Idle"
            | "Focus"
            | "Busy"
            | "Invisible";
            text?: null | string;
        }

Methods

  • Change the username of the current user

    Parameters

    • username: string

      New username

    • password: string

      Current password

    Returns Promise<
        {
            _id: string;
            avatar?: | null
            | {
                _id: string;
                content_type: string;
                deleted?: null
                | boolean;
                filename: string;
                message_id?: null | string;
                metadata:
                    | { type: "File" }
                    | { type: "Text" }
                    | {
                        animated?: null | boolean;
                        height: number;
                        thumbhash?: null | number[];
                        type: "Image";
                        width: number;
                    }
                    | { height: number; type: "Video"; width: number }
                    | { type: "Audio" };
                object_id?: null | string;
                reported?: null | boolean;
                server_id?: null | string;
                size: number;
                tag: string;
                user_id?: null | string;
            };
            badges?: number;
            bot?: null
            | { owner: string };
            discriminator: string;
            display_name?: null | string;
            flags?: number;
            online: boolean;
            privileged?: boolean;
            pronouns?: null | string;
            relations?: {
                _id: string;
                status:
                    | "User"
                    | "None"
                    | "Friend"
                    | "Outgoing"
                    | "Incoming"
                    | "Blocked"
                    | "BlockedOther";
            }[];
            relationship: | "User"
            | "None"
            | "Friend"
            | "Outgoing"
            | "Incoming"
            | "Blocked"
            | "BlockedOther";
            status?: | null
            | {
                presence?: null
                | "Online"
                | "Idle"
                | "Focus"
                | "Busy"
                | "Invisible";
                text?: null | string;
            };
            username: string;
        },
    >

  • Edit the user

    Parameters

    • data: {
          avatar?: null | string;
          badges?: null | number;
          display_name?: null | string;
          flags?: null | number;
          profile?: null | { background?: null | string; content?: null | string };
          pronouns?: null | string;
          remove?: (
              | "Avatar"
              | "StatusText"
              | "StatusPresence"
              | "ProfileContent"
              | "ProfileBackground"
              | "DisplayName"
              | "Pronouns"
              | "Internal"
          )[];
          status?: | null
          | {
              presence?: null
              | "Online"
              | "Idle"
              | "Focus"
              | "Busy"
              | "Invisible";
              text?: null | string;
          };
      }

      Changes

      • Optionalavatar?: null | string

        Attachment Id for avatar

      • Optionalbadges?: null | number

        Format: int32

        Bitfield of user badges

      • Optionaldisplay_name?: null | string

        New display name

      • Optionalflags?: null | number

        Format: int32

        Enum of user flags

      • Optionalprofile?: null | { background?: null | string; content?: null | string }

        New user profile data

        This is applied as a partial.

      • Optionalpronouns?: null | string

        New pronouns

      • Optionalremove?: (
            | "Avatar"
            | "StatusText"
            | "StatusPresence"
            | "ProfileContent"
            | "ProfileBackground"
            | "DisplayName"
            | "Pronouns"
            | "Internal"
        )[]

        Fields to remove from user object

        []
        
      • Optionalstatus?:
            | null
            | {
                presence?: null
                | "Online"
                | "Idle"
                | "Focus"
                | "Busy"
                | "Invisible";
                text?: null | string;
            }

        New user status

    Returns Promise<void>

  • Fetch the mutual connections of the current user and a target user

    Returns Promise<{ servers: string[]; users: string[] }>

    The mutual connections of the current user and a target user

  • Remove a user from the friend list

    Returns Promise<void>

  • Generate status message

    Parameters

    • translate: (presence: "Online" | "Idle" | "Focus" | "Busy" | "Invisible") => string = ...

      Translation function

    Returns undefined | string

    Status message

  • Write to string as a user mention

    Returns string

    Formatted String