first commit
This commit is contained in:
17
commands/utility/ping.js
Normal file
17
commands/utility/ping.js
Normal file
@ -0,0 +1,17 @@
|
||||
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`);
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user