Milky4Skin
Milky4Skin

Reputation: 23

Discord bot not detecting when I deafen

Basically, I want my discord bot to move me to AFK as soon as I deafen but it does nothing with the code I have. I have tried using console.log on the if statement but still nothing.

Code:

client.on("voiceStateUpdate", (oldState, newState) => {
    let memchange = newState.member;
    if (memchange.selfDeaf) {
        memchange.setChannel(afkchannelid);
    }
});

Upvotes: 0

Views: 35

Answers (1)

mvetois
mvetois

Reputation: 109

Did you add the GUILD_VOICE_STATES intent ?

const client = new Client({ intents: ['GUILD_VOICE_STATES'] });

Upvotes: 1

Related Questions