0

I'm having a problem in a Discord.js bot I'm making, once a member enters the server, the bot generates the image successfully and saves it without any problem, but then it only sends the message with text and no image attached.

I use discord.js v13.16.0

Here's my code:

client.on('guildMemberAdd', async (member) => {
    try {
        const memberCount = member.guild.memberCount;

        const profilePic = await Jimp.read(member.user.displayAvatarURL({ format: 'png' }));
        profilePic.resize(348, 348);
    
        const mask = await Jimp.read('mascara.png');
        mask.resize(profilePic.bitmap.width, profilePic.bitmap.height);
        profilePic.mask(mask);
    
        const background = await Jimp.read('Group.png');
        const image = background.clone();
        image.composite(profilePic, 32, 77);
    
        const font = await Jimp.loadFont(Jimp.FONT_SANS_64_WHITE);
        image.print(font, 400, 150, `Bem vindo ${member.user.username}`);
        image.print(font, 400, 250, `Membro#${memberCount}`);

        await image.writeAsync('outimage.png');
    
        const channel = member.guild.channels.cache.get('1040023057265348671');
        channel.send(`Bem vindo à **Comunidade Extra Life**, ${member}! Espero que gostes da nossa companhia!`, 'outimage.png');
    } catch (error) {
      console.error('Error:', error);
    }
  });

Thanks in advance!

I've already some things but they all give me the same result

Some of them were:

channel.send(`Text`, { files: ["outimage.png"] })
const attachment = new MessageAttachment(await image.getBufferAsync(Jimp.MIME_PNG));

    const channel = member.guild.channels.cache.get('1040023057265348671');
    channel.send(`Text`, attachment);

0 Answers0