Files
BluBot/commands/utility/ping.js
2025-06-21 15:13:58 -05:00

18 lines
632 B
JavaScript

const { SlashCommandBuilder } = require("discord.js");
module.exports = {
data: new SlashCommandBuilder()
.setName("ping")
.setDescription("Replies with Pong! and websocket ping"),
async execute(interaction) {
// Send the initial reply and wait for it to be sent
const reply = await interaction.reply({
content: "Pong!",
fetchReply: true // This ensures we can get the reply object
});
const ping = reply.createdTimestamp - interaction.createdTimestamp; // Calculate the ping
await interaction.editReply(`Pong! client ${ping}ms | websocket: ${interaction.client.ws.ping}ms`);
},
};