require("../index"); const Discord = require("discord.js"); const client = require("../index"); const {createCanvas, loadImage} = require('@napi-rs/canvas'); client.on("guildMemberAdd", async (member) => { let canvas = createCanvas(1200, 400); let ctx = canvas.getContext("2d"); ctx.fillStyle = "#FFFFFF"; ctx.fillRect(0, 0, canvas.width, canvas.height); let img = await loadImage("https://media.discordapp.net/attachments/1080927206198485013/1158845989130621018/welcome.discord.png"); ctx.drawImage( img, canvas.width / 2 - img.width / 2, canvas.height / 2 - img.height / 2 ); ctx.font = "bold 65px Arial"; ctx.lineWidth = 12; ctx.strokeText(member.user.username.slice(0, 25), 650, 310); ctx.fillStyle = "#FFFFFF"; ctx.fillText(member.user.username.slice(0, 25), 650, 310); ctx.fillStyle = "#FFFFFF"; ctx.font = "bold 30px Arial"; ctx.fillText(`#${member.guild.memberCount}`, 270, 346); ctx.beginPath(); ctx.lineWidth = 10; ctx.arc(180, 225, 135, 0, Math.PI * 2, true); ctx.closePath(); ctx.clip(); img = await loadImage(member.displayAvatarURL({ format: "png"})); ctx.drawImage(img, 180, 225, 278, 278); ctx.restore(); member.guild.channels.cache.get("1157002481570680903").send({ files: [ new Discord.AttachmentBuilder(await canvas.encode("png"), { name: "welcome.png" }) ] }) });