How can I create a discord welcome message with the newer version for nodejs?
This is what I have and it is not sending anything:
client.on("guildMemberAdd", (member) => {
const welcomeMessage = "Please welcome <@${member.id}> <a:pepesimp:881812231208181790> welcome to our ~~cult~~ club!";
member.guild.channels.cache.get((i) => i.name === "welcome").send(welcomeMessage);
});
You need to request the GUILD_MEMBERS
when initiating your client otherwise this event will not be triggered.
const client = new Discord.Client({
intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MEMBERS]
});
You also need to make sure that you have enabled it in the Discord Developer Portal.