This function its not working. I tried a lot of things and nothing,i think its the "guildMemberAdd".
client.on("guildMemberAdd", async member => {
let canal = client.channels.get(config.welcome)
let fonte = await jimp.loadFont(jimp.FONT_SANS_32_BLACK)
let mask = await jimp.read('mascara.png')
let fundo = await jimp.read('fundo.png')
jimp.read(member.user.displayAvatarURL).then(avatar => {
avatar.resize(130, 130)
mask.resize(130, 130)
avatar.mask(mask)
fundo.print(fonte, 170, 175, member.user.username)
fundo.composite(avatar, 40, 90).write('bemvindo.png')
canal.send(`Welcome !`, { files: ["bemvindo.png"] })
console.log('Imagem enviada para o Discord')
})
.catch(err => {
console.log('error avatar')
})
});
Detail, the bot works, just the jimp part dont work
If someone know why dont work, pls tell me.
I think the issue is because you have Discord.js v11 code but you're running the bot with Discord.js v12.
client.channels.get(config.welcome) should now be client.channels.cache.get(config.welcome).
Fixed code below:
client.on("guildMemberAdd", async member => {
let canal = await client.channels.fetch(config.welcome)
let fonte = await jimp.loadFont(jimp.FONT_SANS_32_BLACK)
let mask = await jimp.read('mascara.png')
let fundo = await jimp.read('fundo.png')
jimp.read(member.user.displayAvatarURL({format: 'png'})).then(avatar => {
avatar.resize(130, 130)
mask.resize(130, 130)
avatar.mask(mask)
fundo.print(fonte, 170, 175, member.user.username)
fundo.composite(avatar, 40, 90).write('bemvindo.png')
await canal.send(`Welcome !`, { files: ["bemvindo.png"] })
console.log('Imagem enviada para o Discord')
})
.catch(err => {
console.log('error avatar')
})
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With