Class User

User Class

Hierarchy

  • User

Constructors

Properties

#collection: UserCollection
id: string

Accessors

  • get animatedAvatarURL(): string
  • URL to the user's animated avatar

    Returns string

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

    Returns undefined | {
        owner: string;
    }

  • get createdAt(): Date
  • Time when this user created their account

    Returns Date

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

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

  • get relationship(): "None" | "User" | "Friend" | "Outgoing" | "Incoming" | "Blocked" | "BlockedOther"
  • Relationship with user

    Returns "None" | "User" | "Friend" | "Outgoing" | "Incoming" | "Blocked" | "BlockedOther"

  • 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";
            } | {
                height: 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?: null | number;
        bot?: null | {
            owner: string;
        };
        discriminator: string;
        display_name?: null | string;
        flags?: null | number;
        online?: null | boolean;
        privileged?: boolean;
        profile?: null | {
            background?: null | {
                _id: string;
                content_type: string;
                deleted?: null | boolean;
                filename: string;
                message_id?: null | string;
                metadata: {
                    type: "File";
                } | {
                    type: "Text";
                } | {
                    height: 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;
            };
            content?: null | string;
        };
        relations?: null | {
            _id: string;
            status: "None" | "User" | "Friend" | "Outgoing" | "Incoming" | "Blocked" | "BlockedOther";
        }[];
        relationship?: null | "None" | "User" | "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;
          };
          remove?: null | ("Avatar" | "StatusText" | "StatusPresence" | "ProfileContent" | "ProfileBackground" | "DisplayName")[];
          status?: null | {
              presence?: null | "Online" | "Idle" | "Focus" | "Busy" | "Invisible";
              text?: null | string;
          };
      }

      Changes

      • Optional avatar?: null | string

        Description

        Attachment Id for avatar

      • Optional badges?: null | number

        Format: int32

        Description

        Bitfield of user badges

      • Optional display_name?: null | string

        Description

        New display name

      • Optional flags?: null | number

        Format: int32

        Description

        Enum of user flags

      • Optional profile?: null | {
            background?: null | string;
            content?: null | string;
        }

        Description

        New user profile data

        This is applied as a partial.

      • Optional remove?: null | ("Avatar" | "StatusText" | "StatusPresence" | "ProfileContent" | "ProfileBackground" | "DisplayName")[]

        Description

        Fields to remove from user object

      • Optional status?: null | {
            presence?: null | "Online" | "Idle" | "Focus" | "Busy" | "Invisible";
            text?: null | string;
        }

        Description

        New user status

    Returns Promise<void>

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

    Returns

    The mutual connections of the current user and a target user

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

  • Fetch the profile of a user

    Returns

    The profile of the user

    Returns Promise<{
        background?: null | {
            _id: string;
            content_type: string;
            deleted?: null | boolean;
            filename: string;
            message_id?: null | string;
            metadata: {
                type: "File";
            } | {
                type: "Text";
            } | {
                height: 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;
        };
        content?: null | string;
    }>

  • Remove a user from the friend list

    Returns Promise<void>

  • Generate status message

    Returns

    Status message

    Parameters

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

      Translation function

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

          • presence: "Online" | "Idle" | "Focus" | "Busy" | "Invisible"

          Returns string

    Returns undefined | string

  • Write to string as a user mention

    Returns

    Formatted String

    Returns string

Generated using TypeDoc