fix(AllowedImageSizes): add new image sizes (#6754)

This commit is contained in:
ObscuritySRL
2021-10-04 18:10:54 -04:00
committed by GitHub
parent c5421af68e
commit d0025beb7b
2 changed files with 3 additions and 3 deletions

View File

@@ -16,7 +16,7 @@ exports.WSCodes = {
const AllowedImageFormats = ['webp', 'png', 'jpg', 'jpeg', 'gif'];
const AllowedImageSizes = Array.from({ length: 9 }, (e, i) => 2 ** (i + 4));
const AllowedImageSizes = [16, 32, 64, 128, 256, 300, 512, 600, 1024, 2048, 4096];
function makeImageUrl(root, { format = 'webp', size } = {}) {
if (!['undefined', 'number'].includes(typeof size)) throw new TypeError('INVALID_TYPE', 'size', 'number');
@@ -35,7 +35,7 @@ function makeImageUrl(root, { format = 'webp', size } = {}) {
* Options for static Image URLs.
* @typedef {Object} StaticImageURLOptions
* @property {string} [format='webp'] One of `webp`, `png`, `jpg`, `jpeg`.
* @property {number} [size] One of `16`, `32`, `64`, `128`, `256`, `512`, `1024`, `2048`, `4096`
* @property {number} [size] One of `16`, `32`, `64`, `128`, `256`, `300`, `512`, `600`, `1024`, `2048`, `4096`
*/
// https://discord.com/developers/docs/reference#image-formatting-cdn-endpoints

2
typings/index.d.ts vendored
View File

@@ -2980,7 +2980,7 @@ export interface AddGuildMemberOptions {
export type AllowedImageFormat = 'webp' | 'png' | 'jpg' | 'jpeg';
export type AllowedImageSize = 16 | 32 | 64 | 128 | 256 | 512 | 1024 | 2048 | 4096;
export type AllowedImageSize = 16 | 32 | 64 | 128 | 256 | 300 | 512 | 600 | 1024 | 2048 | 4096;
export type AllowedPartial = User | Channel | GuildMember | Message | MessageReaction;