25 lines
975 B
JavaScript
25 lines
975 B
JavaScript
const { SlashCommandBuilder } = require('@discordjs/builders');
|
|
const { EmbedBuilder } = require('discord.js'); // Import EmbedBuilder
|
|
|
|
module.exports = {
|
|
data: new SlashCommandBuilder()
|
|
.setName('ping')
|
|
.setDescription('Replies with Pong!'),
|
|
async execute(interaction) {
|
|
// Calculate the latency
|
|
const apiLatency = Math.round(interaction.client.ws.ping);
|
|
const hostLatency = Date.now() - interaction.createdTimestamp;
|
|
|
|
// Create an embed message
|
|
const embed = new EmbedBuilder()
|
|
.setTitle("Pong! Here's the stats!")
|
|
.setColor(0x00AE86) // You can choose any color you like
|
|
.addFields(
|
|
{ name: 'API Latency', value: `${apiLatency}ms`, inline: true },
|
|
{ name: 'Host Latency', value: `${hostLatency}ms`, inline: true }
|
|
);
|
|
|
|
// Send the embed message as a reply
|
|
await interaction.reply({ embeds: [embed] });
|
|
},
|
|
};
|