#timeout() isn't timing out memebrs for the correct amount of time

9 messages · Page 1 of 1 (latest)

rain glade
#

I have been trying to make a simple timeout command for my discord but using the GuildMmber#timeout() method. here is the following code that I wrote to do that:

const seconds = interaction.options.getInteger('seconds');
const minutes = interaction.options.getInteger('minutes');
const hours = interaction.options.getInteger('hours');
const days = interaction.options.getInteger('days');
const weeks = interaction.options.getInteger('weeks');
var totalTime = seconds + (minutes * 60) + (hours * 3600) + (days * 86400) + (weeks * 604800);
if (seconds && minutes && hours && days && weeks === null || 0) {                      totalTime = 900;                                              member.timeout(totalTime, reason)
.then(() => {                                            console.log('Timed user out for ' + totalTime + ' seconds.')
})

A timeout is issued for the user, but the user is given a much shorter timeout in the actual app. For example, if I timeout the user for a week, the actual timeout given is only 8 minutes, even though the debug message near the end of the code prints the right amount of seconds stored in the totalTime variable used to set the timeout length:

Timed user out for 604800 seconds.
dull yew
#

• 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.

brittle garnet
rain glade
#

yep that was the problem anyway - didn't read the docs properly and the timeout length is indeed in ms!

brittle garnet
#

all good

rain glade
#

do i have to edit "solved" in the title or anything?

brittle garnet
#

nah

rain glade
#

ok, thanks for the help! wouldve taken me ages to find that small detail on my own