I know there already were a lot of questions about how to make a ping
command for your discord.js bot, but my question is kinda different because I want to make this command for interaction
and not message
. I tried using
Date.now() - interaction.createdTimestamp
to get interaction ping but as result I get: -1007ms
. Any ideas how to fix it?
Use Math.abs() to get the absolute value of a number
const delay = Math.abs(Date.now() - interaction.createdTimestamp);