revbot.js
    Preparing search index...

    Class ServerMember

    Represents a member of a server.

    Hierarchy (View Summary)

    Index

    Constructors

    • Creates a new ServerMember instance.

      Parameters

      • client: client

        The client instance.

      • 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" }
                        | { 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;
                };
            joined_at: string;
            nickname?: null
            | string;
            roles?: string[];
            timeout?: null | string;
        }

        The raw data for the server member from the API.

        • _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" }
                      | { 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;
              }

          Avatar attachment

        • joined_at: string

          Time at which this user joined the server

        • Optionalnickname?: null | string

          Member's nickname

        • Optionalroles?: string[]

          Member's roles

        • Optionaltimeout?: null | string

          Timestamp this member is timed out until

      Returns ServerMember

    Properties

    avatar: null | Attachment = null

    The avatar of the member, or null if none is set.

    client: client

    The client instance.

    id: string

    The unique identifier for the object.

    nickname: null | string = null

    The nickname of the member, or null if none is set.

    roles: Role[] = []

    roles assigned to the member

    serverId: string

    The ID of the server this member belongs to.

    Accessors

    Methods

    • Checks if this server member has a specific permission.

      Parameters

      Returns boolean

      Whether the member has the permission

      if (member.hasPermission('MANAGE_MESSAGES')) {
      // Member can manage messages
      }

      note this works on the same basis as stoats permissions checking

    • Gets the effective permissions for this server member based on their roles.

      The permissions are calculated by:

      1. Starting with a base FullPermissions with no permissions
      2. For each role the member has, applying the role's allow permissions
      3. For each role the member has, removing the role's deny permissions

      Returns FullPermissions

      The effective permissions for this member

      const permissions = member.getPermissions();
      console.log(permissions.has('MANAGE_MESSAGES')); // true or false