oldMember and newMember timeout issue

const oldTimeout = oldMember.communicationDisabledUntilTimestamp
const newTimeout = newMember.communicationDisabledUntilTimestamp
console.log("oldTimeout:", oldTimeout)
console.log("newTimeout:", newTimeout)

// timeout added
if (!oldTimeout && newTimeout) {...}
const oldTimeout = oldMember.communicationDisabledUntilTimestamp
const newTimeout = newMember.communicationDisabledUntilTimestamp
console.log("oldTimeout:", oldTimeout)
console.log("newTimeout:", newTimeout)

// timeout added
if (!oldTimeout && newTimeout) {...}
why isn't oldTimeout null when the oldMember wasn't timed out previously? I'm trying to make timeout logs but sometimes the oldTimeout isn't null but the oldMember wan't on timeout I see that if I don't manually remove the timeout (i.e. timeout is removed automatically by discord), the oldTimeout is available, what should I do to properly check the timeout is added to a member?
4 Replies
d.js toolkit
d.js toolkit12mo ago
• What's your exact discord.js npm list discord.js and node node -v version? • Post the full error stack trace, not just the top part! • Show your code! • Explain what exactly your issue is. • Not a discord.js issue? Check out #useful-servers.
Shaurya
Shaurya12mo ago
13.16.0, v18.16.0
Syjalo
Syjalo12mo ago
It would be null if the member never was timed out or someone did .timeout(null). If you want to check whether the member was timed out use .isCommunicationDisabled()
Shaurya
Shaurya12mo ago
oh, yea, thanks that works