Class ServerCollection

Collection of Servers

Hierarchy

Constructors

Properties

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

Type declaration

    • (id: string): HydratedServer
    • Parameters

      • id: string

      Returns HydratedServer

updateUnderlyingObject: SetStoreFunction<Record<string, HydratedServer>>

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

      Instance

    • context: unknown

      Context

    • Optional data: unknown

      Data

    Returns void

  • Create a server

    Returns

    The newly-created server

    Parameters

    • data: {
          description?: null | string;
          name: string;
          nsfw?: null | boolean;
      }

      Server options

      • Optional description?: null | string

        Description

        Server description

      • name: string

        Description

        Server name

      • Optional nsfw?: null | boolean

        Description

        Whether this server is age-restricted

    Returns Promise<Server>

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

    Returns

    Iterable

    Parameters

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

      Callback for each pair

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

          Returns void

    Returns void

  • Get or create

    Parameters

    • id: string

      Id

    • data: {
          _id: string;
          analytics?: boolean;
          banner?: 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;
          };
          categories?: null | {
              channels: string[];
              id: string;
              title: string;
          }[];
          channels: string[];
          default_permissions: number;
          description?: null | string;
          discoverable?: boolean;
          flags?: number;
          icon?: 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;
          };
          name: string;
          nsfw?: boolean;
          owner: string;
          roles?: {
              [key: string]: components["schemas"]["Role"];
          };
          system_messages?: null | {
              user_banned?: null | string;
              user_joined?: null | string;
              user_kicked?: null | string;
              user_left?: null | string;
          };
      }

      Data

      • _id: string

        Description

        Unique Id

      • Optional analytics?: boolean

        Description

        Whether to enable analytics

      • Optional banner?: 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

        Banner attachment

      • Optional categories?: null | {
            channels: string[];
            id: string;
            title: string;
        }[]

        Description

        Categories for this server

      • channels: string[]

        Description

        Channels within this server

      • default_permissions: number

        Format: int64

        Description

        Default set of server and channel permissions

      • Optional description?: null | string

        Description

        Description for the server

      • Optional discoverable?: boolean

        Description

        Whether this server should be publicly discoverable

      • Optional flags?: number

        Format: uint32

        Description

        Bitfield of server flags

      • Optional icon?: 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

        Icon attachment

      • name: string

        Description

        Name of the server

      • Optional nsfw?: boolean

        Description

        Whether this server is flagged as not safe for work

      • owner: string

        Description

        User id of the owner

      • Optional roles?: {
            [key: string]: components["schemas"]["Role"];
        }

        Description

        Roles for this server

        • [key: string]: components["schemas"]["Role"]
      • Optional system_messages?: null | {
            user_banned?: null | string;
            user_joined?: null | string;
            user_kicked?: null | string;
            user_left?: null | string;
        }

        Description

        Configuration for sending system event messages

    • isNew: boolean = false

      Whether this object is new

    Returns Server

Generated using TypeDoc