Added ping command

This commit is contained in:
2023-11-30 12:43:59 +01:00
parent 4ddc5d3860
commit 010aa2964d

37
src/commands/ping.js Normal file
View File

@@ -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()
}]
})
}
}