GuildMemberAdd Problem

Hello, I did a event GuildMemberAdd and this one works very well but event not works for defaultAvatarDiscord.
4 Replies
d.js docs
d.js docs3y ago
• What's your exact discord.js npm list discord.js and node node -v version? • Post the full error stack trace, not just the top part! • Show your code! • Explain what exactly your issue is. • Not a discord.js issue? Check out #useful-servers.
Killer Jumper
Killer JumperOP3y ago
const bot = require("../../index");
const {createCanvas, loadImage} = require("canvas");
const {AttachmentBuilder } = require('discord.js');

bot.on("guildMemberAdd", async member => {
if(member.user.bot) return;

const canvas = createCanvas(1920, 1080);
const ctx = canvas.getContext('2d');

const background = await loadImage("./workpng.png");
ctx.drawImage(background, 0, 0, canvas.width, canvas.height);

ctx.font = `110px Impact`;
ctx.fillStyle = `#fff`;
ctx.fillText(member.user.username.length > 19 ? `${member.user.username.substring(0, 16)}...` : member.user.username, 500, 350);

ctx.beginPath();
ctx.arc(258, 300, 180, 0, Math.PI * 2, true);
ctx.clip();
ctx.rotate(-0.001)
const avatar = await loadImage(member.user.avatarURL({extension: "png"}));
ctx.drawImage(avatar, 108, 150, 325, 325);

const attachment = new AttachmentBuilder(canvas.toBuffer(), {name: "welcome.png"});

const channel = bot.channels.cache.get("691262562523807795");
channel.send(
{
content: `
${member} a rejoint ${member.guild.name}. Assurez-vous de leur souhaiter la bienvenue :foxy: !
N'hésites pas à aller checker les rôles du serveur ici : <#831111459022045245>

\`\`\`
Level 1 : Membre Gold
Level 5 : Membre Super Gold
Level 10 : Membre Diamonds
Level 30 : Membre Platine
\`\`\`


**Notre site : https://workyt.fr/**
**Besoin d'aide sur un exercice : https://workyt.fr/forum** ou bien ouvrir via le formulaire dans <#794303108025024522>.

❗ **L'utilisation du site est primordial pour l'avancement et le financement du projet** :pensivehearts:.

`,
files: [attachment]
}
);
});
const bot = require("../../index");
const {createCanvas, loadImage} = require("canvas");
const {AttachmentBuilder } = require('discord.js');

bot.on("guildMemberAdd", async member => {
if(member.user.bot) return;

const canvas = createCanvas(1920, 1080);
const ctx = canvas.getContext('2d');

const background = await loadImage("./workpng.png");
ctx.drawImage(background, 0, 0, canvas.width, canvas.height);

ctx.font = `110px Impact`;
ctx.fillStyle = `#fff`;
ctx.fillText(member.user.username.length > 19 ? `${member.user.username.substring(0, 16)}...` : member.user.username, 500, 350);

ctx.beginPath();
ctx.arc(258, 300, 180, 0, Math.PI * 2, true);
ctx.clip();
ctx.rotate(-0.001)
const avatar = await loadImage(member.user.avatarURL({extension: "png"}));
ctx.drawImage(avatar, 108, 150, 325, 325);

const attachment = new AttachmentBuilder(canvas.toBuffer(), {name: "welcome.png"});

const channel = bot.channels.cache.get("691262562523807795");
channel.send(
{
content: `
${member} a rejoint ${member.guild.name}. Assurez-vous de leur souhaiter la bienvenue :foxy: !
N'hésites pas à aller checker les rôles du serveur ici : <#831111459022045245>

\`\`\`
Level 1 : Membre Gold
Level 5 : Membre Super Gold
Level 10 : Membre Diamonds
Level 30 : Membre Platine
\`\`\`


**Notre site : https://workyt.fr/**
**Besoin d'aide sur un exercice : https://workyt.fr/forum** ou bien ouvrir via le formulaire dans <#794303108025024522>.

❗ **L'utilisation du site est primordial pour l'avancement et le financement du projet** :pensivehearts:.

`,
files: [attachment]
}
);
});
My code.
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
Killer Jumper
Killer JumperOP3y ago
Ok thanks.
Want results from more Discord servers?
Add your server