mirror of
https://github.com/tiramisulabs/seyfert.git
synced 2025-07-03 21:46:08 +00:00
* Update User.ts method: avatarUrl -> avatarURL * Url -> URL * Fix endpoint for BaseGuild->iconURL * formatting
15 lines
525 B
TypeScript
15 lines
525 B
TypeScript
/**
|
|
* @link https://discord.com/developers/docs/reference#image-formatting
|
|
*/
|
|
export type ImageFormat = "jpg" | "jpeg" | "png" | "webp" | "gif" | "json";
|
|
|
|
/**
|
|
* @link https://discord.com/developers/docs/reference#image-formatting
|
|
*/
|
|
export type ImageSize = 16 | 32 | 64 | 128 | 256 | 512 | 1024 | 2048 | 4096;
|
|
|
|
/** Help format an image url */
|
|
export function formatImageURL(url: string, size: ImageSize = 128, format?: ImageFormat) {
|
|
return `${url}.${format || (url.includes("/a_") ? "gif" : "jpg")}?size=${size}`;
|
|
}
|