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?