#new member join message won't work and sends no messages
46 messages · Page 1 of 1 (latest)
here's the code:
const {GuildMember, Embed} = require("discord.js");
module.exports = {
name: "guildMemberAdd",
async execute(member) {
const {user, guild} = member;
const welcomeChannel = member.guild.channels.cache.get('976405368659902535');
const welcomeMessage = `Welcome <@${member.id}> to the server!`;
const welcomeEmbed = new EmbedBuilder()
.setTitle("**New member!**")
.setDescription(welcomeMessage)
.setTimestamp();
await welcomeChannel.send({embeds: [welcomeEmbed]});
}
}```
it won't send any error message but it doesn't send the message either
@wheat flower What intents do you have?
Specifically, do you have GuildMembers intent?
what does "all" mean
i have a number that's supposedly all the intents
We highly recommend only specifying the intents you actually need.
• Note, that 98303, 32767 or whatever other magic number you read that represents "all intents", gets outdated as soon as new intents are introduced.
• The number will always represent the same set of intents, and will not include new ones. There is no magic "all intents" bit.
well, to be fair, we don't know if that's even the issue here
Remember to enable in the portal too
True
since you didn't really show your client definition
And where this event is called
Or how
It need to be attached to the event on the client
you can tell i'm a newbie
no, the functions you write don't run themselves
you need to run them on your own. given the format, probably in some client.on(event) or similar
i don't have the pc ready even
thank you @neat stratus and @cold lion
i'll do more research and get it right
Well, follow the guide, when you can test what you learned from it and have any doubts, feel free to come here again
I appreciate it, kind person
If you want to learn more abou events and how they work, check the docs below
Class: EventEmitter
The EventEmitter class is defined and exposed by the node:events module:
• Node event API: learn more
• Node event loop: learn more

Creating Your Bot: Event handling