17 lines
556 B
TypeScript
17 lines
556 B
TypeScript
import { SlashCommandBuilder } from '@discordjs/builders';
|
|
import { Client, CommandInteraction, Message } from 'discord.js';
|
|
|
|
export default {
|
|
data: new SlashCommandBuilder()
|
|
.setName('ping')
|
|
.setDescription('Pong!'),
|
|
|
|
interaction: async (interaction: CommandInteraction, client: Client) => {
|
|
const sent = await interaction.reply({ content: 'Pinging...', fetchReply: true }) as Message;
|
|
|
|
interaction.editReply(
|
|
`Roundtrip latency: \
|
|
${sent.createdTimestamp - interaction.createdTimestamp}ms
|
|
Websocket heartbeat: ${client.ws.ping}ms.`);
|
|
},
|
|
};
|