feat: refresh discord attachment api
This commit is contained in:
@@ -517,6 +517,28 @@ class Client extends BaseClient {
|
|||||||
return new Widget(this, data);
|
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}.
|
* Options for {@link Client#generateInvite}.
|
||||||
* @typedef {Object} InviteGenerationOptions
|
* @typedef {Object} InviteGenerationOptions
|
||||||
|
|||||||
1
typings/index.d.ts
vendored
1
typings/index.d.ts
vendored
@@ -778,6 +778,7 @@ export class Client<Ready extends boolean = boolean> extends BaseClient {
|
|||||||
public fetchPremiumStickerPacks(): Promise<Collection<Snowflake, StickerPack>>;
|
public fetchPremiumStickerPacks(): Promise<Collection<Snowflake, StickerPack>>;
|
||||||
public fetchWebhook(id: Snowflake, token?: string): Promise<Webhook>;
|
public fetchWebhook(id: Snowflake, token?: string): Promise<Webhook>;
|
||||||
public fetchGuildWidget(guild: GuildResolvable): Promise<Widget>;
|
public fetchGuildWidget(guild: GuildResolvable): Promise<Widget>;
|
||||||
|
public refreshAttachmentURL(urls: string[]): Promise<{ original: string, refreshed: string }[]>
|
||||||
public sleep(timeout: number): Promise<void>;
|
public sleep(timeout: number): Promise<void>;
|
||||||
public login(token?: string): Promise<string>;
|
public login(token?: string): Promise<string>;
|
||||||
/** @deprecated This method will not be updated until I find the most convenient way to implement MFA. */
|
/** @deprecated This method will not be updated until I find the most convenient way to implement MFA. */
|
||||||
|
|||||||
Reference in New Issue
Block a user