I'm doing a testing bot in discord.js that sends profile cards when the $profile command is called. But i have zero experience with Canvas so I googled some tutorials and followed them
But the problem is that the bot doesn't send the attachment, I've tried to research other ways to do that but they don't work either
This is the code of the canvas
const Canvas = require('canvas')
const Discord = require("discord.js");
module.exports =
{
name: 'profile',
description: '',
run: async (client, message) =>
{
const profilecanvas = Canvas.createCanvas(660,315)
const ctx = profilecanvas.getContext('2d')
const bg = await Canvas.loadImage('https://i.imgur.com/______.png')
ctx.drawImage(bg, 0, 0, profilecanvas.width, profilecanvas.height);
ctx.strokeStyle = '#fdfd34';
ctx.strokeRect(0, 0, profilecanvas.width, profilecanvas.height);
const attachment = new Discord.MessageAttachment(profilecanvas.toBuffer(), bg);
message.channel.send('testing', attachment)
}
}
And it sends the "testing" normally, only the Canvas is not sent and no syntax error appears in the terminal