'discord bot isn't moving people when they deafen
Basically, I'm trying to get my bot to move people to afk as soon as they deafen but nothing happens when I test it. I have used console.log when someone deafens but still nothing.
code:
const Discord = require("discord.js");
const client = new Discord.Client({ intents: ["GUILDS", "GUILD_MESSAGES", "GUILD_VOICE_STATES", "GUILD_MEMBERS", "GUILD_PRESENCES"] });
client.on("voiceStateUpdate", (oldState, newState) =>
{
let memchange = newState.member;
if (memchange.selfDeaf)
{
console.log('User has deafened');
memchange.setChannel(afkchannelid);
}
});
client.once('ready', () => {
console.log('Discord bot is now online')
});
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
