-
-
Notifications
You must be signed in to change notification settings - Fork 165
Open
Description
I'm trying to merge an image from a dir and a user's avatar the dir is right but i get error
(node:6028) UnhandledPromiseRejectionWarning: Error: Couldn't load image
at img.onerror (C:\Users\aoshe\OneDrive\Desktop\amogus\node_modules\merge-images\dist\index.umd.js:39:46)
at setSource (C:\Users\aoshe\OneDrive\Desktop\amogus\node_modules\canvas\lib\image.js:91:13)
at Image.set (C:\Users\aoshe\OneDrive\Desktop\amogus\node_modules\canvas\lib\image.js:62:9)
at C:\Users\aoshe\OneDrive\Desktop\amogus\node_modules\merge-images\dist\index.umd.js:41:12
at new Promise (<anonymous>)
at C:\Users\aoshe\OneDrive\Desktop\amogus\node_modules\merge-images\dist\index.umd.js:30:55
at Array.map (<anonymous>)
at C:\Users\aoshe\OneDrive\Desktop\amogus\node_modules\merge-images\dist\index.umd.js:30:24
at new Promise (<anonymous>)
at mergeImages (C:\Users\aoshe\OneDrive\Desktop\amogus\node_modules\merge-images\dist\index.umd.js:22:10)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:6028) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:6028) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
the code:
const mergeImages = require('merge-images')
const { Canvas, Image } = require('canvas');
module.exports = {
name: 'avatar',
description: 'avatar',
async execute(message, args) {
var url;
mergeImages(['../../assets/colors/yellow.png', message.author.displayAvatarURL()], {
Canvas: Canvas,
Image: Image
}).then(b64 => url = b64);
message.reply(url);
}
}
Metadata
Metadata
Assignees
Labels
No labels