forked from engineering/crv2
23 lines
989 B
TypeScript
23 lines
989 B
TypeScript
import DiscordInteractionCommand from "../../util/DiscordInteractionCommand";
|
|
import { ChatInputCommandInteraction } from "discord.js";
|
|
|
|
export default class Ping extends DiscordInteractionCommand {
|
|
constructor() {
|
|
super("ping", "Pings the bot");
|
|
}
|
|
|
|
public async execute(interaction: ChatInputCommandInteraction): Promise<void> {
|
|
const startTimestamp = Date.now(); // Mark the start of processing
|
|
|
|
// Assuming `interaction.reply` sends the initial response and records the timestamp right after
|
|
await interaction.reply({ content: "Pong!", ephemeral: false });
|
|
const repliedTimestamp = Date.now(); // Mark the timestamp after replying
|
|
|
|
const endTimestamp = Date.now(); // Mark the end of all processing (after editReply)
|
|
|
|
await interaction.editReply({
|
|
content: `🏓 Pong!\nClient: \`${repliedTimestamp - interaction.createdTimestamp}ms\`\nResponse: \`${endTimestamp - startTimestamp}ms\``
|
|
});
|
|
}
|
|
}
|