Class Server

Server Class

Hierarchy

  • Server

Constructors

Properties

#collection: ServerCollection
#synced: undefined | "partial" | "full"
id: string

Accessors

  • get animatedIconURL(): undefined | string
  • URL to the server's animated icon

    Returns undefined | string

  • get bannerURL(): undefined | string
  • URL to the server's banner

    Returns undefined | string

  • get categories(): undefined | {
        channels: string[];
        id: string;
        title: string;
    }[]
  • Categories

    Returns undefined | {
        channels: string[];
        id: string;
        title: string;
    }[]

  • get discoverable(): boolean
  • Whether this server is publicly discoverable

    Returns boolean

  • get mentions(): string[]
  • Find all message IDs of unread messages

    Returns string[]

    Array of message IDs which are unread

  • get orderedChannels(): (Omit<{
        channels: string[];
        id: string;
        title: string;
    }, "channels"> & {
        channels: Channel[];
    })[]
  • Get an array of ordered categories with their respective channels. Uncategorised channels are returned in id="default" category.

    Returns (Omit<{
        channels: string[];
        id: string;
        title: string;
    }, "channels"> & {
        channels: Channel[];
    })[]

  • get orderedRoles(): {
        colour?: null | string;
        hoist?: boolean;
        id: string;
        name: string;
        permissions: {
            a: number;
            d: number;
        };
        rank?: number;
    }[]
  • Get an ordered array of roles with their IDs attached. The highest ranking roles will be first followed by lower ranking roles. This is dictated by the "rank" property which is smaller for higher priority roles.

    Returns {
        colour?: null | string;
        hoist?: boolean;
        id: string;
        name: string;
        permissions: {
            a: number;
            d: number;
        };
        rank?: number;
    }[]

  • get permission(): number
  • Permission the currently authenticated user has against this server

    Returns number

  • get roles(): ReactiveMap<string, {
        colour?: null | string;
        hoist?: boolean;
        name: string;
        permissions: {
            a: number;
            d: number;
        };
        rank?: number;
    }>
  • Roles

    Returns ReactiveMap<string, {
        colour?: null | string;
        hoist?: boolean;
        name: string;
        permissions: {
            a: number;
            d: number;
        };
        rank?: number;
    }>

  • get systemMessages(): undefined | {
        user_banned?: null | string;
        user_joined?: null | string;
        user_kicked?: null | string;
        user_left?: null | string;
    }
  • System message channels

    Returns undefined | {
        user_banned?: null | string;
        user_joined?: null | string;
        user_kicked?: null | string;
        user_left?: null | string;
    }

Methods

  • Delete the underlying server

    Parameters

    • Optional leaveEvent: boolean

      Whether we are leaving

    Returns void

  • Ban user from this server

    Parameters

    • user: string | User | ServerMember

      User

    • options: {
          reason?: null | string;
      } = {}

      Ban options

      • Optional reason?: null | string

        Description

        Ban reason

    Returns Promise<ServerBan>

  • Create a channel

    Parameters

    • data: {
          description?: null | string;
          name: string;
          nsfw?: null | boolean;
          type?: "Text" | "Voice";
      }

      Channel create route data

      • Optional description?: null | string

        Description

        Channel description

      • name: string

        Description

        Channel name

      • Optional nsfw?: null | boolean

        Description

        Whether this channel is age restricted

      • Optional type?: "Text" | "Voice"

        Description

        Channel type

        Default

        Text
        

    Returns Promise<Channel>

    The newly-created channel

  • Create an emoji on the server

    Parameters

    • autumnId: string

      Autumn Id

    • options: Omit<{
          name: string;
          nsfw?: boolean;
          parent: {
              id: string;
              type: "Server";
          } | {
              type: "Detached";
          };
      }, "parent">

      Options

    Returns Promise<Emoji>

  • Create role

    Parameters

    • name: string

      Role name

    Returns Promise<{
        id: string;
        role: {
            colour?: null | string;
            hoist?: boolean;
            name: string;
            permissions: {
                a: number;
                d: number;
            };
            rank?: number;
        };
    }>

  • Delete or leave a server

    Parameters

    • Optional leaveSilently: boolean

      Whether to not send a message on leave

    Returns Promise<void>

  • Delete emoji

    Parameters

    • emojiId: string

      Emoji ID

    Returns Promise<undefined | {
        _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;
    }>

  • Delete role

    Parameters

    • roleId: string

      Role ID

    Returns Promise<undefined>

  • Edit a server

    Parameters

    • data: {
          analytics?: null | boolean;
          banner?: null | string;
          categories?: null | {
              channels: string[];
              id: string;
              title: string;
          }[];
          description?: null | string;
          discoverable?: null | boolean;
          flags?: null | number;
          icon?: null | string;
          name?: null | string;
          remove?: null | ("Description" | "Icon" | "Categories" | "SystemMessages" | "Banner")[];
          system_messages?: null | {
              user_banned?: null | string;
              user_joined?: null | string;
              user_kicked?: null | string;
              user_left?: null | string;
          };
      }

      Changes

      • Optional analytics?: null | boolean

        Description

        Whether analytics should be collected for this server

        Must be enabled in order to show up on Revolt Discover.

      • Optional banner?: null | string

        Description

        Attachment Id for banner

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

        Description

        Category structure for server

      • Optional description?: null | string

        Description

        Server description

      • Optional discoverable?: null | boolean

        Description

        Whether this server is public and should show up on Revolt Discover

      • Optional flags?: null | number

        Format: int32

        Description

        Bitfield of server flags

      • Optional icon?: null | string

        Description

        Attachment Id for icon

      • Optional name?: null | string

        Description

        Server name

      • Optional remove?: null | ("Description" | "Icon" | "Categories" | "SystemMessages" | "Banner")[]

        Description

        Fields to remove from server object

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

        Description

        System message configuration

    Returns Promise<void>

  • Edit a role

    Parameters

    • roleId: string

      Role ID

    • data: {
          colour?: null | string;
          hoist?: null | boolean;
          name?: null | string;
          rank?: null | number;
          remove?: null | "Colour"[];
      }

      Role editing route data

      • Optional colour?: null | string

        Description

        Role colour

      • Optional hoist?: null | boolean

        Description

        Whether this role should be displayed separately

      • Optional name?: null | string

        Description

        Role name

      • Optional rank?: null | number

        Format: int64

        Description

        Ranking position

        Smaller values take priority.

      • Optional remove?: null | "Colour"[]

        Description

        Fields to remove from role object

    Returns Promise<{
        colour?: null | string;
        hoist?: boolean;
        name: string;
        permissions: {
            a: number;
            d: number;
        };
        rank?: number;
    }>

  • Helper function to retrieve cached server member by their ID in this server

    Parameters

    • userId: string

      User's ID

    Returns undefined | ServerMember

    Server Member (if cached)

  • Check whether we have a given permission in a server

    Parameters

    • Rest ...permission: ("Video" | "Masquerade" | "ManageChannel" | "ManageServer" | "ManagePermissions" | "ManageRole" | "ManageCustomisation" | "KickMembers" | "BanMembers" | "TimeoutMembers" | "AssignRoles" | "ChangeNickname" | "ManageNicknames" | "ChangeAvatar" | "RemoveAvatars" | "ViewChannel" | "ReadMessageHistory" | "SendMessage" | "ManageMessages" | "ManageWebhooks" | "InviteOthers" | "SendEmbeds" | "UploadFiles" | "React" | "Connect" | "Speak" | "MuteMembers" | "DeafenMembers" | "MoveMembers" | "GrantAllSafe")[]

      Permission Names

    Returns boolean

    Whether we have this permission

  • Check whether we have at least one of the given permissions in a server

    Parameters

    • Rest ...permission: ("Video" | "Masquerade" | "ManageChannel" | "ManageServer" | "ManagePermissions" | "ManageRole" | "ManageCustomisation" | "KickMembers" | "BanMembers" | "TimeoutMembers" | "AssignRoles" | "ChangeNickname" | "ManageNicknames" | "ChangeAvatar" | "RemoveAvatars" | "ViewChannel" | "ReadMessageHistory" | "SendMessage" | "ManageMessages" | "ManageWebhooks" | "InviteOthers" | "SendEmbeds" | "UploadFiles" | "React" | "Connect" | "Speak" | "MuteMembers" | "DeafenMembers" | "MoveMembers" | "GrantAllSafe")[]

      Permission Names

    Returns boolean

    Whether we have one of the permissions

  • Query members from a server by name

    Parameters

    • query: string

      Name

    Returns Promise<{
        members: ServerMember[];
        users: User[];
    }>

    List of the server's members and their user objects

  • Set role permissions

    Parameters

    • roleId: string = "default"

      Role Id, set to 'default' to affect all users

    • permissions: number | {
          allow: number;
          deny: number;
      }

      Permission value

    Returns Promise<{
        _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;
        };
    }>

  • Optimised member fetch route

    Parameters

    • Optional excludeOffline: boolean

    Returns Promise<void>

  • Pardon user's ban

    Parameters

    • user: string | User

      User

    Returns Promise<undefined>

Generated using TypeDoc