const { Events, EmbedBuilder } = require('discord.js');

module.exports = {
  name: Events.GuildMemberAdd,
  async execute({ client, log }, member) {
    log.Info(`${member.user.username} has joined`);

    const newMemberEmbed = new EmbedBuilder()
      .setTitle(`${member.user.username} has joined!`)
      .setDescription(`Welcome ${member} to the **Polarcraft** Discord server!`)
      .setColor(process.env.EMBED_COLOR)
      .setThumbnail(member.user.avatarURL());

    const channel = await client.channels.cache.get(process.env.LOG_CHANNEL_ID);
    channel.send({ embeds: [newMemberEmbed] });
  },
};
