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 { export default {
data: new SlashCommandBuilder() data: new SlashCommandBuilder()
@ -11,12 +15,21 @@ export default {
fetchReply: true, fetchReply: true,
ephemeral: true, ephemeral: true,
}); });
interaction.editReply({ const embed = new EmbedBuilder()
content: `**PONG🏓**\n\`\`\`\n .setColor(0x0099ff)
Websocket heartbeat: ${interaction.client.ws.ping}ms. .setTitle("***PONG🏓***")
\nRoundtrip latency: ${ .addFields(
defer.createdTimestamp - interaction.createdTimestamp {
}ms\nRunner: ${process.env.RUNNER_NAME}\n\`\`\``, 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] });
}, },
}; };