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 toolkit14mo 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
SpecialSauce14mo 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
SpecialSauce14mo 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 User14mo ago
Message Not Public
Sign In & Join Server To View
🇿 🇽 🇧 🇪 🇦 🇲
how so?
Unknown User
Unknown User14mo ago
Message Not Public
Sign In & Join Server To View
SpecialSauce
SpecialSauce14mo 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