two-k-two-r-name-bot/commands/ping.js

16 lines
740 B
JavaScript
Raw Normal View History

2023-04-25 18:56:41 +09:00
const { SlashCommandBuilder, Client, GatewayIntentBits } = require("discord.js");
const client = new Client({ intents: [GatewayIntentBits.Guilds] });
client.login(process.env.DISCORD_TOKEN);
module.exports = {
data: new SlashCommandBuilder().setName("ping").setDescription("check ping").setDMPermission(false),
async execute(interaction) {
const defer = await interaction.reply({ content: "Pinging...", fetchReply: true, ephemeral: true });
interaction.editReply({
content: `**PONG🏓**\n\`\`\`\n${/*Websocket heartbeat: ${client.ws.ping}ms.*/ ""}\nRoundtrip latency: ${defer.createdTimestamp - interaction.createdTimestamp}ms\nRunner: ${
process.env.RUNNER_NAME
}\n\`\`\``,
});
},
};