discordjs / discord.js

A powerful JavaScript library for interacting with the Discord API
https://discord.js.org
Apache License 2.0
25.5k stars 3.97k forks source link

Unsupported avatar sizes #9902

Closed ewanhowell5195 closed 1 year ago

ewanhowell5195 commented 1 year ago

Which package is this bug report for?

discord.js

Issue description

When using user.displayAvatarURL({ size: 48 }), it reports 48 being an invalid size, and that the sizes must be one of 16, 32, 64, 128, 256, 512, 1024, 2048, 4096

After testing, I have found that these are the supported sizes for user avatars:

16, 20, 22, 24, 28, 32, 40, 44, 48, 56, 60, 64, 80, 96, 100, 128, 160, 240, 256, 300, 320, 480, 512, 600, 640, 1024, 1280, 1536, 2048, 3072, 4096

Code sample

No response

Versions

discord.js 14.13.0

Issue priority

Low (slightly annoying)

Which partials do you have configured?

Not applicable

Which gateway intents are you subscribing to?

Not applicable

I have tested this issue on a development release

No response

Jiralite commented 1 year ago

What reports that being an invalid size?

ewanhowell5195 commented 1 year ago
user.displayAvatarURL({ size: 48 })
RangeError: Invalid size provided: 48
Must be one of: 16, 32, 64, 128, 256, 512, 1024, 2048, 4096
    at CDN.makeURL (/home/ubuntu/Javascript/Wynem/node_modules/@discordjs/rest/dist/index.js:383:13)
    at CDN.dynamicMakeURL (/home/ubuntu/Javascript/Wynem/node_modules/@discordjs/rest/dist/index.js:368:17)
    at CDN.avatar (/home/ubuntu/Javascript/Wynem/node_modules/@discordjs/rest/dist/index.js:206:17)
    at User.avatarURL (/home/ubuntu/Javascript/Wynem/node_modules/discord.js/src/structures/User.js:170:48)
    at User.displayAvatarURL (/home/ubuntu/Javascript/Wynem/node_modules/discord.js/src/structures/User.js:199:17)
    at eval (eval at execute (/home/ubuntu/Javascript/Wynem/commands/prefix/bot/restricted/eval.js:62:26), <anonymous>:1:59)
    at eval (eval at execute (/home/ubuntu/Javascript/Wynem/commands/prefix/bot/restricted/eval.js:62:26), <anonymous>:1:91)
    at eval (eval at execute (/home/ubuntu/Javascript/Wynem/commands/prefix/bot/restricted/eval.js:62:26), <anonymous>:1:120)
    at Object.execute (/home/ubuntu/Javascript/Wynem/commands/prefix/bot/restricted/eval.js:56:26)
    at /home/ubuntu/Javascript/Wynem/functions/commands/runPrefixCommand.js:74:19
Jiralite commented 1 year ago

This is not a bug:^1

Image size can be any power of two between 16 and 4096.