#How can i make in canvas the pfp of the user be centred on the middle
15 messages · Page 1 of 1 (latest)
But it doesn't display the username of the new member
const Canvas = require("@napi-rs/canvas");
const { request } = require("undici");
module.exports = {
name: Events.GuildMemberAdd,
async execute(member) {
const canvas = Canvas.createCanvas(965, 487);
const context = canvas.getContext("2d");
const background = await Canvas.loadImage("./wallpaper.jpg");
context.drawImage(background, 0, 0, canvas.width, canvas.height);
context.strokeStyle = "#000000";
context.strokeRect(0, 0, canvas.width, canvas.height);
context.font = "60px Aeshtetic-Normal";
context.fillStyle = "#6d7578";
context.fillText(member.displayName, canvas.width / 2.5, canvas.height / 1.8);
context.beginPath();
context.arc(125, 125, 100, 0, Math.PI * 2, true);
context.closePath();
context.clip();
const { body } = await request(member.user.displayAvatarURL({ extension: "jpg" }));
const avatar = await Canvas.loadImage(await body.arrayBuffer());
context.drawImage(avatar, 25, 25, 200, 200);
const attachment = new AttachmentBuilder(await canvas.encode("png"), { name: "image.png"});
const wlcChannnel = member.guild.channels.cache.get("1117900229459591278");
wlcChannnel.send({ files: [attachment] });
},
};
That font probably isn’t loaded
see
Try with something easy like serif first
Nah that doesn't works continues without send the username
Just because the file exists on your drive doesn’t mean it’s loaded into canvas
i understand
and with that? it continues without sending the text
?
Hello
Code: https://sourceb.in/o50IkjukI3
Error: In the image the username does not display
New Error And Code