ping embed

This commit is contained in:
kdh8219 2023-04-28 22:30:03 +09:00
parent 9285063cf9
commit 0c255417cc

View file

@ -1,4 +1,8 @@
import { SlashCommandBuilder, ChatInputCommandInteraction } from "discord.js";
import {
SlashCommandBuilder,
ChatInputCommandInteraction,
EmbedBuilder,
} from "discord.js";
export default {
data: new SlashCommandBuilder()
@ -11,12 +15,21 @@ export default {
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\`\`\``,
});
const embed = new EmbedBuilder()
.setColor(0x0099ff)
.setTitle("***PONG🏓***")
.addFields(
{
name: "Websocket heartbeat",
value: `${interaction.client.ws.ping}ms`,
},
{
name: "Roundtrip latency",
value: `${defer.createdTimestamp - interaction.createdTimestamp}ms`,
}
)
.setFooter({ text: `Bot runner: ${process.env.RUNNER_NAME}` });
interaction.editReply({ embeds: [embed] });
},
};