16 lines
674 B
JavaScript
16 lines
674 B
JavaScript
const { SlashCommandBuilder } = require('discord.js');
|
|
|
|
module.exports = {
|
|
data: new SlashCommandBuilder()
|
|
.setName('ping')
|
|
.setDescription('Replies with Pong!'),
|
|
async execute(interaction) {
|
|
// Calculate latency (optional but common for ping commands)
|
|
const sent = await interaction.reply({ content: 'Pinging...', fetchReply: true, ephemeral: true });
|
|
const latency = sent.createdTimestamp - interaction.createdTimestamp;
|
|
const wsPing = interaction.client.ws.ping; // WebSocket heartbeat ping
|
|
|
|
await interaction.editReply(`Pong! 🏓\nRoundtrip latency: ${latency}ms\nWebSocket Ping: ${wsPing}ms`);
|
|
},
|
|
};
|