Class ServerCollection

Collection of Servers

Hierarchy (View Summary)

Constructors

Properties

client: Client
getUnderlyingObject: (id: string) => 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

    • Optionaldata: unknown

      Data

    Returns void

  • Create a server

    Parameters

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

      Server options

      • Optionaldescription?: null | string

        Server description

      • name: string

        Server name

      • Optionalnsfw?: null | boolean

        Whether this server is age-restricted

    Returns Promise<Server>

    The newly-created server

  • 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]: {
                  colour?: null
                  | string;
                  hoist?: boolean;
                  name: string;
                  permissions: { a: number; d: number };
                  rank?: number;
              };
          };
          system_messages?: | null
          | {
              user_banned?: null
              | string;
              user_joined?: null | string;
              user_kicked?: null | string;
              user_left?: null | string;
          };
      }

      Data

      • _id: string

        Unique Id

      • Optionalanalytics?: boolean

        Whether to enable analytics

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

        Banner attachment

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

        Categories for this server

      • channels: string[]

        Channels within this server

      • default_permissions: number

        Format: int64

        Default set of server and channel permissions

      • Optionaldescription?: null | string

        Description for the server

      • Optionaldiscoverable?: boolean

        Whether this server should be publicly discoverable

      • Optionalflags?: number

        Format: uint32

        Bitfield of server flags

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

        Icon attachment

      • name: string

        Name of the server

      • Optionalnsfw?: boolean

        Whether this server is flagged as not safe for work

      • owner: string

        User id of the owner

      • Optionalroles?: {
            [key: string]: {
                colour?: null | string;
                hoist?: boolean;
                name: string;
                permissions: { a: number; d: number };
                rank?: number;
            };
        }

        Roles for this server

      • Optionalsystem_messages?:
            | null
            | {
                user_banned?: null
                | string;
                user_joined?: null | string;
                user_kicked?: null | string;
                user_left?: null | string;
            }

        Configuration for sending system event messages

    • isNew: boolean = false

      Whether this object is new

    Returns Server