can't receive event (no console message)
i am trying to receive a user joining but i don't seem to receive it, don't know why...
18 Replies
- What's your exact discord.js
npm list discord.js
and node node -v
version?
- Not a discord.js issue? Check out #other-js-ts.
- Consider reading #how-to-get-help to improve your question!
- Explain what exactly your issue is.
- Post the full error stack trace, not just the top part!
- Show your code!
- Issue solved? Press the button!Unknown User•13mo ago
Message Not Public
Sign In & Join Server To View
yes and no
it does not show the console message, but everything else is fine
Unknown User•13mo ago
Message Not Public
Sign In & Join Server To View
no errors
yeah
Unknown User•13mo ago
Message Not Public
Sign In & Join Server To View
userjoin.js
const { Client, GatewayIntentBits } = require('discord.js');
const client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.MessageContent,
GatewayIntentBits.GuildMembers,
],
});
client.on("guildMemberAdd", (member) => {
console.log(member)
})
Unknown User•13mo ago
Message Not Public
Sign In & Join Server To View
no, just that one file
ohh
Unknown User•13mo ago
Message Not Public
Sign In & Join Server To View
i have an event handler in index.js (i think)
const eventsPath = path.join(__dirname, 'events');
const eventFiles = fs.readdirSync(eventsPath).filter(file => file.endsWith('.js'));
for (const file of eventFiles) {
const filePath = path.join(eventsPath, file);
const event = require(filePath);
if (event.once) {
client.once(event.name, (...args) => event.execute(...args));
} else {
client.on(event.name, (...args) => event.execute(...args));
}
}
Unknown User•13mo ago
Message Not Public
Sign In & Join Server To View
Unknown User•13mo ago
Message Not Public
Sign In & Join Server To View
k
looks fine to me
Unknown User•13mo ago
Message Not Public
Sign In & Join Server To View
that looks like that
Unknown User•13mo ago
Message Not Public
Sign In & Join Server To View