2024-03-19 17:41:20 -04:00
|
|
|
import DiscordInteractionCommand from "../../util/DiscordInteractionCommand";
|
|
|
|
import { ChatInputCommandInteraction } from "discord.js";
|
|
|
|
|
|
|
|
export default class Ping extends DiscordInteractionCommand {
|
2024-10-25 16:57:33 -04:00
|
|
|
constructor() {
|
|
|
|
super("ping", "Pings the bot");
|
|
|
|
}
|
2024-03-19 17:41:20 -04:00
|
|
|
|
2024-10-25 16:57:33 -04:00
|
|
|
public async execute(interaction: ChatInputCommandInteraction): Promise<void> {
|
|
|
|
const startTimestamp = Date.now(); // Mark the start of processing
|
2024-03-19 17:41:20 -04:00
|
|
|
|
2024-10-25 16:57:33 -04:00
|
|
|
await interaction.reply({ content: "Pong!", ephemeral: false });
|
|
|
|
const repliedTimestamp = Date.now(); // Mark the timestamp after replying
|
2024-03-19 17:41:20 -04:00
|
|
|
|
2024-10-25 16:57:33 -04:00
|
|
|
const endTimestamp = Date.now(); // Mark the end of all processing (after editReply)
|
2024-03-19 17:41:20 -04:00
|
|
|
|
2024-10-25 16:57:33 -04:00
|
|
|
await interaction.editReply({
|
|
|
|
content: `🏓 Pong!\nClient: \`${repliedTimestamp - interaction.createdTimestamp}ms\`\nResponse: \`${endTimestamp - startTimestamp}ms\``,
|
|
|
|
});
|
|
|
|
}
|
2024-03-19 17:41:20 -04:00
|
|
|
}
|