member.js (499B)
1 2 const newmember = async(client)=>{ 3 client.on('guildMemberAdd', member => { 4 // Send the message to a designated channel on a server: 5 const channel = member.guild.channels.find(ch => ch.name === 'member-log'); 6 // Do nothing if the channel wasn't found on this server 7 if (!channel) return; 8 // Send the message, mentioning the member 9 channel.send(`Welcome to the server, ${member}`); 10 }); 11 } 12 13 module.exports={newmember}