Class: MessageAttachment

MessageAttachment

Represents an attachment in a message.

Constructor

new MessageAttachment(attachment, nameopt, dataopt)

Parameters:
Name Type Attributes Default Description
attachment BufferResolvable | Stream The file
name string <optional>
null The name of the file, if any
data Object <optional>
Extra data
Source:

Members

(nullable) height :number

The height of this attachment (if an image or video)
Type:
  • number
Source:

id :Snowflake

The ID of this attachment
Type:
Source:

(nullable) name :string

The name of this attachment
Type:
  • string
Source:

proxyURL :string

The Proxy URL to this attachment
Type:
  • string
Source:

size :number

The size of this attachment in bytes
Type:
  • number
Source:

(readonly) spoiler :boolean

Whether or not this attachment has been marked as a spoiler
Type:
  • boolean
Source:

url :string

The URL to this attachment
Type:
  • string
Source:

(nullable) width :number

The width of this attachment (if an image or video)
Type:
  • number
Source:

Methods

setFile(attachment, nameopt) → {MessageAttachment}

Sets the file of this attachment.
Parameters:
Name Type Attributes Default Description
attachment BufferResolvable | Stream The file
name string <optional>
null The name of the file, if any
Source:
Returns:
This attachment
Type
MessageAttachment

setName(name) → {MessageAttachment}

Sets the name of this attachment.
Parameters:
Name Type Description
name string The name of the file
Source:
Returns:
This attachment
Type
MessageAttachment