revbot.js
    Preparing search index...

    Class Attachment

    Represents an attachment, such as a file or image, in a message or channel.

    Hierarchy (View Summary)

    Index

    Constructors

    • Creates a new Attachment instance.

      Parameters

      • client: client

        The client instance.

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

        The raw data for the attachment from the API.

        • _id: string

          Unique Id

        • content_type: string

          Raw content type of this file

        • Optionaldeleted?: null | boolean

          Whether this file was deleted

        • filename: string

          Original filename

        • Optionalmessage_id?: null | string
        • metadata:
              | { type: "File" }
              | { type: "Text" }
              | { height: number; type: "Image"; width: number }
              | { height: number; type: "Video"; width: number }
              | { type: "Audio" }

          Parsed metadata of this file

        • Optionalobject_id?: null | string

          Id of the object this file is associated with

        • Optionalreported?: null | boolean

          Whether this file was reported

        • Optionalserver_id?: null | string
        • size: number

          Format: int

          Size of this file (in bytes)

        • tag: string

          Tag / bucket this file was uploaded to

        • Optionaluser_id?: null | string

      Returns Attachment

    Properties

    client: client

    The client instance.

    filename: string

    The filename of the attachment.

    id: string

    The unique identifier for the object.

    metadata:
        | { type: "File" }
        | { type: "Text" }
        | { height: number; type: "Image"; width: number }
        | { height: number; type: "Video"; width: number }
        | { type: "Audio" }

    Metadata associated with the attachment (e.g., dimensions for images).

    Type declaration

    • { type: "File" }
    • { type: "Text" }
    • { height: number; type: "Image"; width: number }
      • height: number

        Format: uint

      • type: "Image"
      • width: number

        Format: uint

    • { height: number; type: "Video"; width: number }
      • height: number

        Format: uint

      • type: "Video"
      • width: number

        Format: uint

    • { type: "Audio" }
    size: number

    The size of the attachment in bytes.

    type: string

    The MIME type of the attachment (e.g., image/png, application/pdf).

    Methods

    • Updates the object with new data and returns a clone of the object.

      Parameters

      • data: PartialObject

        The data to update the object with.

      • Optionalclear: string[]

        Fields to clear in the object.

      Returns this

      A clone of the updated object.