feat(bot): add NodeJS implementation and deploy script
This commit is contained in:
15
src/commands/ping.js
Normal file
15
src/commands/ping.js
Normal file
@@ -0,0 +1,15 @@
|
||||
const { SlashCommandBuilder } = require('discord.js');
|
||||
|
||||
module.exports = {
|
||||
data: new SlashCommandBuilder()
|
||||
.setName('ping')
|
||||
.setDescription('Replies with Pong!'),
|
||||
async execute(interaction) {
|
||||
// Calculate latency (optional but common for ping commands)
|
||||
const sent = await interaction.reply({ content: 'Pinging...', fetchReply: true, ephemeral: true });
|
||||
const latency = sent.createdTimestamp - interaction.createdTimestamp;
|
||||
const wsPing = interaction.client.ws.ping; // WebSocket heartbeat ping
|
||||
|
||||
await interaction.editReply(`Pong! 🏓\nRoundtrip latency: ${latency}ms\nWebSocket Ping: ${wsPing}ms`);
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user