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(): "Invisible" | "Online" | "Idle" | "Focus" | "Busy"
  • Presence

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

  • 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 | "Invisible" | "Online" | "Idle" | "Focus" | "Busy";
        text?: null | string;
    }
  • User Status

    Returns undefined | {
        presence?: null | "Invisible" | "Online" | "Idle" | "Focus" | "Busy";
        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?: number;
        bot?: null | {
            owner: string;
        };
        discriminator: string;
        display_name?: null | string;
        flags?: number;
        online: boolean;
        privileged?: boolean;
        relations?: {
            _id: string;
            status: "None" | "User" | "Friend" | "Outgoing" | "Incoming" | "Blocked" | "BlockedOther";
        }[];
        relationship: "None" | "User" | "Friend" | "Outgoing" | "Incoming" | "Blocked" | "BlockedOther";
        status?: null | {
            presence?: null | "Invisible" | "Online" | "Idle" | "Focus" | "Busy";
            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 | "Invisible" | "Online" | "Idle" | "Focus" | "Busy";
              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 | "Invisible" | "Online" | "Idle" | "Focus" | "Busy";
            text?: null | string;
        }

        Description

        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) => string) = ...

      Translation function

        • (presence): string
        • Parameters

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

          Returns string

    Returns undefined | string

    Status message

  • Write to string as a user mention

    Returns string

    Formatted String

Generated using TypeDoc