Polarcraft/discordbot/commands/ping.js
Xeovalyte 9e4a91dd46
Some checks reported warnings
Build and Publish / Build and Publish Discord Bot (push) Successful in 25s
Build and Publish / Build and Publish Minecraft Mod (push) Has been cancelled
fixed ephemeral mistake
2023-08-12 11:34:34 +02:00

15 lines
707 B
JavaScript

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