Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

308
Views
guildMemberRemove not working Discord.js v13.7.0

New to Discord.js, the guildMemberAdd event seems to be working perfectly fine, but it does not detect when a member leaves the guild. How can I fix this?

const { token, guildID, memberChannelID } = require('./config.json');

const { Client, Intents } = require('discord.js');
const client = new Client({ intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES, Intents.FLAGS.GUILD_MEMBERS, Intents.FLAGS.GUILD_PRESENCES] });

const guild = client.guilds.cache.get(guildID)
const prefix = '?';

client.on('messageCreate', message => {
    if (!message.content.startsWith(prefix) || message.author.bot) return;

    const args = message.content.slice(prefix.length).split(/ +/);
    const command = args.shift().toLowerCase();

    if (command === 'ping') {
        message.reply('pong!');
    } else if (command === 'help') {
        message.reply('**Commands: ** ?ping, ?membercount');
    } else if (command === 'membercount') {
        message.reply(`There are ${message.guild.memberCount} members in this server!`);
    }
});

client.on('guildMemberAdd', async (member) => {
    client.channels.cache.get(memberChannelID).setName(`Total Members: ${member.guild.memberCount.toLocaleString()}`)
    console.log('Updating Member Count')
})

client.on('guildMemberRemove', async (member) => {
    client.channels.cache.get(memberChannelID).setName(`Total Members: ${member.guild.memberCount.toLocaleString()}`)
    console.log('Updating Member Count')
})

client.once('ready', () => {
    console.log("EGLX BOT IS ONLINE")
})

client.login(token);
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

If the guild member was not cached when the guildMemberRemove event is supposed to be emitted, then the issue is probably because you lack the necessary partials, an opt-in feature allowing events to emit on uncached structures. Most likely, you would need the 'GUILD_MEMBER' partial for the event to emit although you may also need the 'USER' one if the first doesn't work alone.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!