Files
mafuyu-kirisu/commands/utils/ping.ts
konchin 2d7361e937
Some checks failed
release-tag / release-image (push) Failing after 1m14s
initial commit
2024-10-11 19:49:58 +08:00

21 lines
663 B
TypeScript

import {CommandInteraction} from 'discord.js';
import {Command} from '../../classes/command';
import {logger} from '../../logger';
class Ping extends Command{
get name(){return "ping";}
get description(){return "Reply with the RTT of this bot.";}
async execute(interaction: CommandInteraction): Promise<void>{
const sent = await interaction.reply({
content: "Pinging...",
ephemeral: true,
fetchReply: true,
});
const rtt = sent.createdTimestamp - interaction.createdTimestamp;
await interaction.editReply(`Roundtrip latency: ${rtt}ms`);
logger.log(`ping with rtt: ${rtt}`);
}
};
export const command = new Ping();