Class UserCollection

Collection of Users

Hierarchy

Constructors

Properties

#objects: ReactiveMap<string, User> = ...
#storage: ObjectStorage<HydratedUser> = ...
client: Client
getUnderlyingObject: ((id) => HydratedUser)

Type declaration

    • (id): HydratedUser
    • Parameters

      • id: string

      Returns HydratedUser

updateUnderlyingObject: SetStoreFunction<Record<string, HydratedUser>>

Methods

  • Create a new instance of an object

    Parameters

    • id: string

      Id

    • type: "user" | "server" | "channel" | "bot" | "channelUnread" | "channelWebhook" | "emoji" | "message" | "serverMember" | "session"

      Type

    • instance: User

      Instance

    • context: unknown

      Context

    • Optional data: unknown

      Data

    Returns void

  • Execute a provided function over each key, value pair in the map

    Parameters

    • cb: ((value, key, map) => void)

      Callback for each pair

        • (value, key, map): void
        • Parameters

          • value: User
          • key: string
          • map: ReactiveMap<string, User>

          Returns void

    Returns void

    Iterable

  • Get or create

    Parameters

    • id: string

      Id

    • data: {
          _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;
      }

      Data

      • _id: string

        Description

        Unique Id

      • Optional 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;
        }

        Description

        Avatar attachment

      • Optional badges?: number

        Format: uint32

      • Optional bot?: null | {
            owner: string;
        }

        Description

        Bot information

      • discriminator: string

        Description

        Discriminator

      • Optional display_name?: null | string

        Description

        Display name

      • Optional flags?: number

        Format: uint32

      • online: boolean

        Description

        Whether this user is currently online

      • Optional privileged?: boolean

        Description

        Whether this user is privileged

      • Optional relations?: {
            _id: string;
            status: "None" | "User" | "Friend" | "Outgoing" | "Incoming" | "Blocked" | "BlockedOther";
        }[]

        Description

        Relationships with other users

      • relationship: "None" | "User" | "Friend" | "Outgoing" | "Incoming" | "Blocked" | "BlockedOther"

        Description

        Current session user's relationship with this user

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

        Description

        User's current status

      • username: string

        Description

        Username

    Returns User

  • Map the collection using a given callback

    Type Parameters

    • O

    Parameters

    • cb: ((value, key) => O)

      Callback

        • (value, key): O
        • Parameters

          • value: User
          • key: string

          Returns O

    Returns O[]

Generated using TypeDoc