Class ServerMemberCollection

Collection of Server Members

Hierarchy (View Summary)

Constructors

Properties

client: Client
getUnderlyingObject: (id: string) => HydratedServerMember
updateUnderlyingObject: SetStoreFunction<Record<string, HydratedServerMember>>

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: ServerMember

      Instance

    • context: unknown

      Context

    • Optionaldata: unknown

      Data

    Returns void

  • Get or create

    Parameters

    • id: { server: string; user: string }

      Id

      • server: string

        Server Id

      • user: string

        User Id

    • data: {
          _id: { server: string; user: string };
          avatar?:
              | null
              | {
                  _id: string;
                  content_type: string;
                  deleted?: null
                  | boolean;
                  filename: string;
                  message_id?: null | string;
                  metadata:
                      | { type: "File" }
                      | { type: "Text" }
                      | {
                          animated?: null | boolean;
                          height: number;
                          thumbhash?: null | 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;
              };
          can_publish?: boolean;
          can_receive?: boolean;
          joined_at: string;
          nickname?: null
          | string;
          pronouns?: null | string;
          roles?: string[];
          timeout?: null | string;
      }

      Data

      • _id: { server: string; user: string }

        Unique member id

        • server: string

          Server Id

        • user: string

          User Id

      • Optionalavatar?:
            | null
            | {
                _id: string;
                content_type: string;
                deleted?: null
                | boolean;
                filename: string;
                message_id?: null | string;
                metadata:
                    | { type: "File" }
                    | { type: "Text" }
                    | {
                        animated?: null | boolean;
                        height: number;
                        thumbhash?: null | 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;
            }

        Avatar attachment

      • Optionalcan_publish?: boolean

        Whether the member is server-wide voice muted

      • Optionalcan_receive?: boolean

        Whether the member is server-wide voice deafened

      • joined_at: string

        Time at which this user joined the server

      • Optionalnickname?: null | string

        Member's nickname

      • Optionalpronouns?: null | string

        Member's pronouns

      • Optionalroles?: string[]

        Member's roles

      • Optionaltimeout?: null | string

        Timestamp this member is timed out until

    Returns ServerMember

  • Check if member exists by composite key

    Parameters

    • id: { server: string; user: string }

      Id

      • server: string

        Server Id

      • user: string

        User Id

    Returns boolean

    Whether it exists

  • Hydrate a new instance of an object. This function does not add the object to the collection.

    Parameters

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

      Type

    • context: unknown

      Context

    • data: object

      Data

    Returns HydratedServerMember

  • Hydrate a new server member if it is not in the collection yet. This function does not add the server member to the store, make sure you call addHydratedServerMember afterwards. This function is particularly useful when adding many server members asynchronously. See Server.syncMembers for an example of this in use.

    Parameters

    • id: { server: string; user: string }

      The ID of the server member

      • server: string

        Server Id

      • user: string

        User Id

    • data: {
          _id: { server: string; user: string };
          avatar?:
              | null
              | {
                  _id: string;
                  content_type: string;
                  deleted?: null
                  | boolean;
                  filename: string;
                  message_id?: null | string;
                  metadata:
                      | { type: "File" }
                      | { type: "Text" }
                      | {
                          animated?: null | boolean;
                          height: number;
                          thumbhash?: null | 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;
              };
          can_publish?: boolean;
          can_receive?: boolean;
          joined_at: string;
          nickname?: null
          | string;
          pronouns?: null | string;
          roles?: string[];
          timeout?: null | string;
      }

      The API object for a server member

      • _id: { server: string; user: string }

        Unique member id

        • server: string

          Server Id

        • user: string

          User Id

      • Optionalavatar?:
            | null
            | {
                _id: string;
                content_type: string;
                deleted?: null
                | boolean;
                filename: string;
                message_id?: null | string;
                metadata:
                    | { type: "File" }
                    | { type: "Text" }
                    | {
                        animated?: null | boolean;
                        height: number;
                        thumbhash?: null | 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;
            }

        Avatar attachment

      • Optionalcan_publish?: boolean

        Whether the member is server-wide voice muted

      • Optionalcan_receive?: boolean

        Whether the member is server-wide voice deafened

      • joined_at: string

        Time at which this user joined the server

      • Optionalnickname?: null | string

        Member's nickname

      • Optionalpronouns?: null | string

        Member's pronouns

      • Optionalroles?: string[]

        Member's roles

      • Optionaltimeout?: null | string

        Timestamp this member is timed out until

    Returns undefined | HydratedServerMember

    The HydratedServerMember, or undefined if the user is in the collection

  • check partial status by composite key

    Parameters

    • id: { server: string; user: string }

      Id

      • server: string

        Server Id

      • user: string

        User Id

    Returns boolean

    Member