#new member join message won't work and sends no messages

46 messages · Page 1 of 1 (latest)

tired garnetBOT
#

• What's your exact discord.js npm list discord.js and node node -v version?
• Post the full error stack trace, not just the top part!
• Show your code!
• Explain what exactly your issue is.
• Not a discord.js issue? Check out #useful-servers.

wheat flower
#

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

neat stratus
#

@wheat flower What intents do you have?

#

Specifically, do you have GuildMembers intent?

wheat flower
#

All of 'em

#

yes

cold lion
#

what does "all" mean

wheat flower
#

i have a number that's supposedly all the intents

cold lion
#

supposedly

#

so you have no clue?

tired garnetBOT
#

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.

wheat flower
#

hmmm

#

i'll add guildmembers

#

thanks

cold lion
#

well, to be fair, we don't know if that's even the issue here

neat stratus
#

Remember to enable in the portal too

cold lion
#

since you didn't really show your client definition

wheat flower
#

in the portal, everything is enabled

#

i know i generalize too much

neat stratus
#

Or how

wheat flower
#

doesn't it call itself on member join?

#

if not what do i do to call it?

neat stratus
#

It need to be attached to the event on the client

wheat flower
#

you can tell i'm a newbie

cold lion
#

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

wheat flower
#

so, in this context: client.on(member.join)...

#

idk i'm sorry

#

wasting your time

tired garnetBOT
#

Suggestion for @wheat flower:
guide Creating Your Bot: Event handling
read more

wheat flower
#

i don't have the pc ready even

#

thank you @neat stratus and @cold lion

#

i'll do more research and get it right

neat stratus
#

Well, follow the guide, when you can test what you learned from it and have any doubts, feel free to come here again

wheat flower
#

I appreciate it, kind person

neat stratus
#

If you want to learn more abou events and how they work, check the docs below

tired garnetBOT
wheat flower
wheat flower
#

hey fellows

#

I just found out that:

  1. I have the GuildMembers intent
  2. the function executes since I have it set up in the event handler
#

it's name is the event

#

"guildMemberAdd"