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