From 010aa2964dda2a2663d2b976c844e496440e9845 Mon Sep 17 00:00:00 2001 From: Taken Date: Thu, 30 Nov 2023 12:43:59 +0100 Subject: [PATCH] Added ping command --- src/commands/ping.js | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 src/commands/ping.js 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() + }] + }) + } +}