Skip to content

Commit

Permalink
Better ping command
Browse files Browse the repository at this point in the history
  • Loading branch information
maamokun committed Jun 23, 2024
1 parent c906138 commit 4500156
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/commands/ping.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ export default {
enabled: true,
options: [],
},
interactionRun: (interaction: CommandInteraction) => {
interaction.reply("Pong!");
interactionRun: async (interaction: CommandInteraction) => {
const ping = Math.abs(Math.round(interaction.client.ws.ping));
await interaction.reply("Loading...");
const roundtrip = Math.abs(Date.now() - interaction.createdTimestamp);
interaction.editReply(`API Latency: ${ping}ms\nRoundtrip: ${roundtrip}ms`);
},
};

0 comments on commit 4500156

Please sign in to comment.