feat(bot): add NodeJS implementation and deploy script

This commit is contained in:
2025-04-23 21:40:02 +08:00
parent 5c632556b7
commit 74dfdbf667
12 changed files with 704 additions and 0 deletions

15
src/commands/ping.js Normal file
View 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`);
},
};