From 0c255417ccb6e9d3d6b64edeb03e2e55c0843f33 Mon Sep 17 00:00:00 2001 From: kdh8219 <65698239+kdh8219@users.noreply.github.com> Date: Fri, 28 Apr 2023 22:30:03 +0900 Subject: [PATCH] ping embed --- src/command/commands/ping.ts | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/src/command/commands/ping.ts b/src/command/commands/ping.ts index 26bad53..e269ffd 100755 --- a/src/command/commands/ping.ts +++ b/src/command/commands/ping.ts @@ -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] }); }, };