Class User

User Class

Constructors

Properties

id: string

Accessors

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

    Bot information

    Returns undefined | { owner: string }

  • 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" }
                    | { 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:
                    | "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 };
          remove?:
              | null
              | (
                  | "Avatar"
                  | "StatusText"
                  | "StatusPresence"
                  | "ProfileContent"
                  | "ProfileBackground"
                  | "DisplayName"
                  | "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.

      • Optionalremove?:
            | null
            | (
                | "Avatar"
                | "StatusText"
                | "StatusPresence"
                | "ProfileContent"
                | "ProfileBackground"
                | "DisplayName"
                | "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