I'm currently attempting to program the mute functionality onto a discord bot. It has the server permission "mute members" enabled.
This is the code that is getting run whenever I call the mute command:
if(!receiverG.mute) {
message.channel.send(`${receiver} muted by ${sender}.`)
receiverG.setMute(true, remaining);
}
else {
message.channel.send(`${receiver} unmuted by ${sender}.`)
receiverG.setMute(false, remaining);
}
message.channel.send(receiverG.mute);
So, consecutive calls of this code should toggle mute, but message.channel.send.(receiverG.mute) sends "false" everytime, indicating that the member never got muted. I'm unclear how the mute functionality works with discord. I read somewhere that it's based on roles- if so, then what would be the point of a setMute() command?
Documentation: https://discord.js.org/#/docs/main/stable/class/GuildMember?scrollTo=setMute