Files
dd-multitool/bot/commands/ping.js
koneko 3bfd995e3a
All checks were successful
Deploy bot / build-and-deploy (push) Successful in 24s
kursadzija
2025-08-27 16:53:17 +02:00

29 lines
930 B
JavaScript

function format(seconds) {
function pad(s) {
return (s < 10 ? "0" : "") + s;
}
var hours = Math.floor(seconds / (60 * 60));
var minutes = Math.floor((seconds % (60 * 60)) / 60);
var seconds = Math.floor(seconds % 60);
return pad(hours) + "h " + pad(minutes) + "m " + pad(seconds) + "s.";
}
exports.name = "ping";
exports.description = ":ping_pong: View service statistics.";
exports.usage = "CLIENT_PREFIX:ping";
exports.example = "CLIENT_PREFIX:ping";
exports.hidden = true;
exports.isAlias = false;
exports.run = async (client, message, args) => {
message.channel.send("Fetching data...").then((m) => {
m.edit(
`🏓 Latency is **${
m.createdTimestamp - message.createdTimestamp
}ms**.\nAPI Latency is **${Math.round(
client.ws.ping
)}ms**.\nClient uptime is **${format(process.uptime())}**`
);
});
};