Home > Software engineering >  Get interaction.reply() latency
Get interaction.reply() latency

Time:10-16

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?

CodePudding user response:

Use Math.abs() to get the absolute value of a number

const delay = Math.abs(Date.now() - interaction.createdTimestamp);
  • Related