1message.guild.members.cache.forEach(member => { // Looping through each member of the guild.
2 // Trying to send a message to the member.
3 // This method might fail because of the member's privacy settings, so we're using .catch
4 member.send("Hello, this is my message!").catch(e => console.error(`Couldn't DM member ${member.user.tag}`));
5});
6