#Check if a member is already on timeout

15 messages · Page 1 of 1 (latest)

hollow oxide
#

if(member.isCommunicationDisabled() === true) return interaction.reply ('User already muted')
Why is it returning even though they aren’t timed out?

barren carbonBOT
#
  • What's your exact discord.js npm list discord.js and node node -v version?
  • Not a discord.js issue? Check out #1081585952654360687.
  • Consider reading #how-to-get-help to improve your question!
  • Explain what exactly your issue is.
  • Post the full error stack trace, not just the top part!
  • Show your code!
  • Issue solved? Press the button!
  • Marked as resolved by OP
karmic island
hollow oxide
#

No, they've only just been muted

#

and it says 'User already muted' while they are not

#
    const member = await interaction.options.getMember('user');

    const time = await interaction.options.getString('time');
    const muteTime = ms(time);
    if(muteTime === undefined) return interaction.reply({ content: 'Invalid Time' })

    await member.timeout(muteTime);
    if(member.isCommunicationDisabled() === true) return interaction.reply ('User already muted')

this is the full ish part

karmic island
hollow oxide
#

yes

#

it times them out, and if they're already muted it sends 'User already muted'

wintry spoke
#

?? that doesn't make sense

hollow oxide
#

how so?

wintry spoke
#

if you put them on timeout, then check if they're on timeout, that if statement will always be true

karmic island
#

You may want to check before timing them out

hollow oxide
#

i'm gonna be amazed if i'm actually that dumb..

wintry spoke
#

Check if a member is already on timeout