ping command
This commit is contained in:
parent
90b4da470d
commit
612a9a1668
|
@ -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\`\`\``,
|
|
||||||
});
|
|
||||||
},
|
|
||||||
};
|
|
22
src/command/commands/ping.ts
Executable file
22
src/command/commands/ping.ts
Executable file
|
@ -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\`\`\``,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
};
|
Loading…
Reference in a new issue