Error: Unsupported image type #1

Open
opened 2022-07-18 15:07:09 -05:00 by lamp · 0 comments
Owner

colors.js Lines 156 to 160 in b18c90996e
async function user2color(user) {
var avatarURL = user.avatarURL({format:'png', size: 16}) || user.defaultAvatarURL;
var image = await (await fetch(avatarURL)).buffer();
return (await getAverageColor(image)).value;
}

Error: Unsupported image type
   at setSource (/srv/ldb/node_modules/canvas/lib/image.js:91:13)
   at Image.set (/srv/ldb/node_modules/canvas/lib/image.js:65:7)
   at /srv/ldb/node_modules/canvas/index.js:34:15
   at new Promise (<anonymous>)
   at Object.loadImage (/srv/ldb/node_modules/canvas/index.js:23:10)
   at getAverageColor (/srv/ldb/node_modules/fast-average-color-node/dist/index.js:12:34)
   at user2color (/srv/ldb/colors.js:159:16)
   at runMicrotasks (<anonymous>)
   at processTicksAndRejections (node:internal/process/task_queues:96:5)
   at async Client.<anonymous> (/srv/ldb/colors.js:40:11)

idk should be png

https://gitea.moe/lamp/lampdiscordbot/src/commit/b18c90996e9b87f56d05c0d66958102c4067988b/colors.js#L156-L160 ``` Error: Unsupported image type at setSource (/srv/ldb/node_modules/canvas/lib/image.js:91:13) at Image.set (/srv/ldb/node_modules/canvas/lib/image.js:65:7) at /srv/ldb/node_modules/canvas/index.js:34:15 at new Promise (<anonymous>) at Object.loadImage (/srv/ldb/node_modules/canvas/index.js:23:10) at getAverageColor (/srv/ldb/node_modules/fast-average-color-node/dist/index.js:12:34) at user2color (/srv/ldb/colors.js:159:16) at runMicrotasks (<anonymous>) at processTicksAndRejections (node:internal/process/task_queues:96:5) at async Client.<anonymous> (/srv/ldb/colors.js:40:11) ``` idk should be png
Sign in to join this conversation.
No Label
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: lamp/lampdiscordbot#1
No description provided.