From a3efb1335d55c0393592970e374ac9c2c1fa962f Mon Sep 17 00:00:00 2001 From: Starman <30315137+Starman3787@users.noreply.github.com> Date: Tue, 26 Nov 2024 12:29:51 +0000 Subject: [PATCH] Update Attachment.js --- src/structures/Attachment.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/structures/Attachment.js b/src/structures/Attachment.js index 930b3b21..d3a9bf6e 100644 --- a/src/structures/Attachment.js +++ b/src/structures/Attachment.js @@ -1,3 +1,4 @@ +import fetch from "node-fetch"; import Client from "../Client.js"; import { CDN_BASE_URL, TO_JSON_TYPES_ENUM } from "../constants.js"; import util from "util"; @@ -138,6 +139,16 @@ class Attachment { return this.#_channel_id ? String(this.#_channel_id) : undefined; } + /** + * Fetches the data of the attachment. + * @returns {Promise} + * @public + */ + async fetchData() { + const res = await fetch(this.url); + return res.arrayBuffer(); + } + /** * @method * @public