#GuildMemberRemove/Add event not triggering

14 messages · Page 1 of 1 (latest)

rancid drum
#

I have added the GatewayIntentBits in my main file:

const client = new Client({ intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages, GatewayIntentBits.GuildMembers] })

This part activates my events:

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))
    }
}

And last but not least, here is my guildMemberRemove code:

const { Events } = require("discord.js")
// const DataManager = require("../helpers/dataManager.js")

module.exports = {
    name: Events.GuildMemberRemove,
    once: false,

    /**
     * 
     * @param {object} client Bot client
     */
    async execute(client) {
        console.log("left")
        console.log(client)
        // const memberData = await DataManager.getMember()
    },
}

Does anyone here spot the problem?

violet tendon
#

• 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.

jovial wing
rancid drum
#

Console stays empty

#

I also have a ready event file, which does work. It connects to my db and logs a message.

#

It is weird because that one does work

calm cedar
#

try replacing Events.GuildMemberRemove with guildMemberRemove

#

"guildMemberRemove"*

rancid drum
jovial wing
#

It's the same thing

jaunty lynx
#

where is last script located

rancid drum
#

Thanks all for the help, but it's fixed

#

I kicked the bot and added it to my server from dc developer website

#

That fixed the issue