From 513244f203e5de360a8756bab6706f507fe37e5e Mon Sep 17 00:00:00 2001 From: Mylloon Date: Sun, 3 Jul 2022 20:37:28 +0200 Subject: [PATCH] Add ping command --- src/commands/misc/ping.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 src/commands/misc/ping.js diff --git a/src/commands/misc/ping.js b/src/commands/misc/ping.js new file mode 100644 index 0000000..1186a39 --- /dev/null +++ b/src/commands/misc/ping.js @@ -0,0 +1,17 @@ +import { SlashCommandBuilder } from '@discordjs/builders'; + +export default { + data: new SlashCommandBuilder() + .setName('ping') + .setDescription('Pong!'), + + interaction: async (interaction, client) => { + + const sent = await interaction.reply({ content: 'Pinging...', fetchReply: true }); + + interaction.editReply( + `Roundtrip latency: + ${sent.createdTimestamp - interaction.createdTimestamp}ms + Websocket heartbeat: ${client.ws.ping}ms.`); + }, +};