Canvas help (discord.js)

i need help with the assets area
i want my bot to use canvas but it cant load the image i have in assets
Picture 2:
(node:4749) UnhandledPromiseRejectionWarning: Error: error while reading from input stream

at Image.src (/rbd/pnpm-volume/bfc224d2-0f81-4f4f-aa60-bb35a754e1e3/node_modules/

at Promise (/rbd/pnpm-volume/bfc224d2-0f81-4f4f-aa60-bb35a754e1e3/node_modules/

at new Promise (<anonymous>)

at Object.loadImage (/rbd/pnpm-volume/bfc224d2-0f81-4f4f-aa60-bb35a754e1e3/node_modules/

at Client.client.on (/app/server.js:41:37)

tconst Discord = require(‘discord.js’);
const client = new Discord.Client();
const Canvas = require(‘canvas’);
client.on(‘guildMemberAdd’, async member => {
const channel = member.guild.channels.find(ch => === ‘member-log’);
if (!channel) return;

const canvas = Canvas.createCanvas(700, 250);
const ctx = canvas.getContext('2d');

// Since the image takes time to load, you should await it
const background = await Canvas.loadImage('./wallpaper.jpg');
// This uses the canvas dimensions to stretch the image onto the entire canvas
ctx.drawImage(background, 0, 0, canvas.width, canvas.height);
// Use helpful Attachment class structure to process the file for you
const attachment = new Discord.Attachment(canvas.toBuffer(), 'welcome-image.png');

channel.send(`Welcome to the server, ${member}!`, attachment);


If you are loading the file from the assets folder in the editor, that folder isn’t really a folder, it just lists all the your project files which are in the Glitch CDN, you need to get the link for the file which you want to use, and then use it in your project.

this is the link
so do i just replace wallpaper.jpg with that?

No, you will need to change the loadImage to something like this
the img.src thing

oh ok ill try that out

got it to work!!!
IM so happy

Hello Zachify,
I want to talk with you about something not really weird, about copyright. I think that you’ve Discord so please add me as friend and we can talk privately. (my discord tag : PsyKo (Daniel S.)#6666)

Have a good day,
Cordially Daniel Spencer.