Polarcraft/discordbot/commands/ping.js

15 lines
707 B
JavaScript
Raw Normal View History

2023-08-02 14:16:30 +02:00
const { SlashCommandBuilder } = require('discord.js');
const { simpleEmbed } = require('../functions/embeds.js');
const { client } = require('../index.js');
module.exports = {
2023-08-03 12:06:31 +02:00
data: new SlashCommandBuilder()
.setName('ping')
.setDescription('Replies with Pong!'),
async execute(interaction) {
2023-08-12 11:34:34 +02:00
const reply = await interaction.reply({ embeds: [simpleEmbed(`Websocket heartbeat: **${client.ws.ping}ms**\n Roundtrip latency: **Pinging...**`)], fetchReply: true, ephemeral: true });
2023-08-02 14:16:30 +02:00
2023-08-12 11:34:34 +02:00
interaction.editReply({ embeds: [simpleEmbed(`Websocket heartbeat: **${client.ws.ping}ms**\n Roundtrip latency: **${reply.createdTimestamp - interaction.createdTimestamp}ms**`)], ephemeral: true });
2023-08-03 12:06:31 +02:00
},
2023-08-02 14:16:30 +02:00
};