We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 0b0fe14 commit f2f23aeCopy full SHA for f2f23ae
1 file changed
src/commands/ping.ts
@@ -6,7 +6,14 @@ export const pingCommand = createCommand({
6
description: 'Replies with Pong!',
7
},
8
execute: async (interaction) => {
9
- const user = interaction.user;
10
- await interaction.reply(`<@${user.id}> Pong!`);
+ const sent = await interaction.reply({ content: 'pinging...', withResponse: true });
+ const message = sent.resource?.message;
11
+ if (!message) {
12
+ await interaction.editReply('Failed to send ping message.');
13
+ return;
14
+ }
15
+ const roundTrip = message.createdTimestamp - interaction.createdTimestamp;
16
+ const apiLatency = interaction.client.ws.ping;
17
+ await interaction.editReply(`latency: ${apiLatency}ms | Roundtrip: ${roundTrip}ms`);
18
19
});
0 commit comments