Class UserCollection

Collection of Users

Hierarchy

Constructors

Properties

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

Type declaration

    • (id: string): 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

  • Find some value based on a predicate

    Parameters

    • predicate: ((value: User, key: string) => boolean)

      Predicate to satisfy

        • (value: User, key: string): boolean
        • Parameters

          • value: User
          • key: string

          Returns boolean

    Returns undefined | User

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

    Returns

    Iterable

    Parameters

    • cb: ((value: User, key: string, map: ReactiveMap<string, User>) => void)

      Callback for each pair

        • (value: User, key: string, map: ReactiveMap<string, User>): void
        • Parameters

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

          Returns void

    Returns void

  • 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?: 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;
      }

      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?: null | number

        Format: int32

        Description

        Bitfield of user badges

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

        Description

        Bot information

      • discriminator: string

        Description

        Discriminator

      • Optional display_name?: null | string

        Description

        Display name

      • Optional flags?: null | number

        Format: int32

        Description

        Enum of user flags

      • Optional online?: null | boolean

        Description

        Whether this user is currently online

      • Optional privileged?: boolean

        Description

        Whether this user is privileged

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

        Description

        User's profile page

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

        Description

        Relationships with other users

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

        Description

        Current session user's relationship with this user

      • Optional status?: null | {
            presence?: null | "Online" | "Idle" | "Focus" | "Busy" | "Invisible";
            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: User, key: string) => O)

      Callback

        • (value: User, key: string): O
        • Parameters

          • value: User
          • key: string

          Returns O

    Returns O[]

Generated using TypeDoc