uptime command
Hello i try to get a uptime command working but it gives error that uptime is undefinided
10 Replies
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
this is my code
o i run discord.js 14.5.0 instead of 14.6
node versionv16.17.1
i try to make a /uptime command
discord js doesn't export anything called 'client', you need to get the client from either
interaction
or have it as an argument in your execute functionUnknown User•3y ago
Message Not Public
Sign In & Join Server To View
Huh? I am new to discord bot coding in JS. Any examples somewhere?
this
let uptime = client.uptime()
should be
let uptime = interaction.client.uptime
thx
I tried that but its still not working
or do i need to put it somewhere else then after execute?
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
o oops
thx. How would i decode this to human readable time?
Documentation suggestion for @basgamer999: Date.prototype.toLocaleString()
The toLocaleString() method returns a string with a language-sensitive representation of this date. In implementations with Intl.DateTimeFormat API support, this method simply calls Intl.DateTimeFormat.