const { Events, EmbedBuilder } = require('discord.js'); const { client } = require('../index.js'); const { Users } = require('../functions/models'); module.exports = { name: Events.GuildMemberAdd, async execute(member) { const addMemberEmbed = new EmbedBuilder() .setTitle(`${member.user.globalName} has joined!`) .setDescription(`Welcome ${member} to the **Polarcraft** Discord server!`) .setColor(process.env.EMBED_COLOR) .setThumbnail(member.user.avatarURL()); const channel = client.channels.cache.get(process.env.LOG_CHANNEL_ID); channel.send({ embeds: [addMemberEmbed] }); try { await Users.create({ id: member.user.id, }); } catch (error) { console.error(error); } }, };