Check if a member is already on timeout

if(member.isCommunicationDisabled() === true) return interaction.reply ('User already muted')
if(member.isCommunicationDisabled() === true) return interaction.reply ('User already muted')
Why is it returning even though they aren’t timed out?
10 Replies
d.js toolkit
d.js toolkitβ€’13mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - 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
SpecialSauce
SpecialSauceβ€’13mo ago
Were they timed out previously?
πŸ‡Ώ πŸ‡½ πŸ‡§ πŸ‡ͺ πŸ‡¦ πŸ‡²
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')
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
SpecialSauce
SpecialSauceβ€’13mo ago
So you time them out. And then you check to see if they’re timed out.?
πŸ‡Ώ πŸ‡½ πŸ‡§ πŸ‡ͺ πŸ‡¦ πŸ‡²
yes it times them out, and if they're already muted it sends 'User already muted'
Unknown User
Unknown Userβ€’13mo ago
Message Not Public
Sign In & Join Server To View
Unknown User
Unknown Userβ€’13mo ago
Message Not Public
Sign In & Join Server To View
SpecialSauce
SpecialSauceβ€’13mo ago
You may want to check before timing them out
πŸ‡Ώ πŸ‡½ πŸ‡§ πŸ‡ͺ πŸ‡¦ πŸ‡²
i'm gonna be amazed if i'm actually that dumb.. thank you so much 😭 i'm actually insanely dumb for not figuring that out
Want results from more Discord servers?
Add your server