#welcome canvas v14.5

12 messages · Page 1 of 1 (latest)

tall vapor

i don' t have problems whit the code but the bot don't write when a member join

covert wrenBOT
  • Consider reading #how-to-get-help to improve your question!
  • Explain what exactly your issue is.
  • Post the full error stack trace, not just the top part!
  • Show your code!
  • Issue solved? Press the button!
  • Marked as resolved by staff
tall vapor

const Canvas = require('canvas')

const { createCanvas, loadImage } = require('canvas');

client.on('guildMemberAdd', async (member) => {
const welcomeChannel = client.channels.cache.get('1188962541842485353');
const rulesChannel = client.channels.cache.get('1192109584777760868');
const verifyChannel = client.channels.cache.get('1193611427450200078');
const infoChannel = client.channels.cache.get('1192102711718596688');

if (welcomeChannel && rulesChannel && verifyChannel && infoChannel) {
const canvas = createCanvas(1024, 500);
const ctx = canvas.getContext('2d');

const background = await loadImage("C:/Users/Utente/Downloads/static.png");

ctx.drawImage(background, 0, 0, canvas.width, canvas.height);

ctx.font = '72px sans-serif';
ctx.fillStyle = '#ffffff';
ctx.fillText('Welcome', 360, 360);

ctx.beginPath();
ctx.arc(512, 166, 128, 0, Math.PI * 2, true);
ctx.stroke();
ctx.fill();

ctx.font = '42px sans-serif';
ctx.textAlign = 'center';
ctx.fillText(member.user.tag.toUpperCase(), 512, 410);
ctx.font = '32px sans-serif';
ctx.fillText(`You are the ${member.guild.memberCount}th`, 512, 455);

ctx.beginPath();
ctx.arc(512, 166, 119, 0, Math.PI * 2, true);
ctx.closePath();
ctx.clip();

const avatar = await loadImage(member.user.displayAvatarURL({ format: 'png', size: 1024 }));
ctx.drawImage(avatar, 393, 47, 238, 238);

const attachment = new MessageAttachment(canvas.toBuffer(), `welcome-${member.id}.png`);

try {
  welcomeChannel.send(`:wave: Hello ${member}, welcome to ${member.guild.name}!`, { files: [attachment] });
  welcomeChannel.send(`Don't forget to read the rules in ${rulesChannel} and verify yourself in ${verifyChannel}. For more information, check out ${infoChannel}.`);
} catch (error) {
  console.error("Errore nell invio del messaggio di benvenuto", error);
}

}
});

welcome canvas v14.5

wise ridge
tall vapor
lapis forgeBOT

Tag suggestion for @tall vapor:
We highly recommend only specifying the intents you actually need.

  • Note, that 98303, 32767 or whatever other magic number you read that represents "all intents", gets outdated as soon as new intents are introduced.
  • The number will always represent the same set of intents, and will not include new ones. There is no magic "all intents" bit.
wind sentinel
wind sentinel

Then you should:

  • update your code to use EmbedBuilder
  • update to 14.14.1
  • only pass the intents you use, not what you currently do
tall vapor
wind sentinel