feat: refresh discord attachment api

This commit is contained in:
Elysia
2024-11-08 14:31:37 +07:00
parent fb48a0dc7f
commit 44d7700296
2 changed files with 23 additions and 0 deletions

View File

@@ -517,6 +517,28 @@ class Client extends BaseClient {
return new Widget(this, data);
}
/**
* Refresh the Discord CDN links with hashes so they can be usable.
* @param {string[]} urls Discord CDN URLs
* @returns {Promise<Array<{ original: string, refreshed: string }>>}
*/
async refreshAttachmentURL(urls) {
const data = await this.api.attachments('refresh-urls').post({
data: { attachment_urls: urls },
});
/**
{
"refreshed_urls": [
{
"original": "url",
"refreshed": "url with hash"
}
]
}
*/
return data.refreshed_urls;
}
/**
* Options for {@link Client#generateInvite}.
* @typedef {Object} InviteGenerationOptions