Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

310
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda