diff --git a/src/command/commands/ping.js b/src/command/commands/ping.js deleted file mode 100755 index 22eee18..0000000 --- a/src/command/commands/ping.js +++ /dev/null @@ -1,15 +0,0 @@ -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\`\`\``, - }); - }, -}; diff --git a/src/command/commands/ping.ts b/src/command/commands/ping.ts new file mode 100755 index 0000000..26bad53 --- /dev/null +++ b/src/command/commands/ping.ts @@ -0,0 +1,22 @@ +import { SlashCommandBuilder, ChatInputCommandInteraction } from "discord.js"; + +export default { + data: new SlashCommandBuilder() + .setName("ping") + .setDescription("check ping") + .setDMPermission(false), + async execute(interaction: ChatInputCommandInteraction) { + const defer = await interaction.reply({ + content: "Pinging...", + fetchReply: true, + ephemeral: true, + }); + interaction.editReply({ + content: `**PONG🏓**\n\`\`\`\n + Websocket heartbeat: ${interaction.client.ws.ping}ms. + \nRoundtrip latency: ${ + defer.createdTimestamp - interaction.createdTimestamp + }ms\nRunner: ${process.env.RUNNER_NAME}\n\`\`\``, + }); + }, +};