Skip to main content

Function: isMediaAttachment()

isMediaAttachment(attachment: Attachment): boolean

Checks whether an attachment is a media attachment, this is done so by checking the content type of the attachment, if the content type starts with image/, video/ or audio/ it is considered a media attachment.

If the content type is image/ or video/, it will also check if the attachment has dimensions defined to ensure it is a valid media attachment.

Parameters

ParameterTypeDescription
attachmentAttachmentThe attachment to check

Returns

boolean

Whether the attachment is a media attachment

Since

7.3.0

Source

projects/utilities/packages/discord.js-utilities/src/lib/type-guards.ts:316