diff --git a/src/commands/ping.js b/src/commands/ping.js new file mode 100644 index 0000000..faca60c --- /dev/null +++ b/src/commands/ping.js @@ -0,0 +1,37 @@ +const { SlashCommandBuilder } = require("discord.js") +const { color, devMessage } = require("../../config/options.json") + +module.exports = { + name: "ping", + description: "Get the bot's ping.", + type: "slash", + + data: new SlashCommandBuilder() + .setName("ping") + .setDescription("Get the bot's ping."), + + /** + * @param { import("discord.js").ChatInputCommandInteraction } interaction + * @param { import("discord.js").Client } client} + */ + + async execute(interaction, client) { + await interaction.deferReply() + + const embedColor = Number(color.replace("#", "0x")) + + console.log(client.ws.ping) + + await interaction.editReply({ + embeds: [{ + description: "Ping of the bot is " + client.ws.ping + "ms.", + color: embedColor, + footer: { + text: interaction.guild.name + " | " + devMessage, + icon_url: interaction.user.displayAvatarURL({ dynamic: true }) + }, + timestamp: new Date() + }] + }) + } +}