From 304b23523ce105cecac0bd48968b4bdde04ecdb5 Mon Sep 17 00:00:00 2001 From: KieranRobson Date: Mon, 27 Jun 2022 11:00:24 +0100 Subject: [PATCH] Added Slash Command - Ping --- SlashCommands/general/ping.js | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 SlashCommands/general/ping.js diff --git a/SlashCommands/general/ping.js b/SlashCommands/general/ping.js new file mode 100644 index 0000000..ca0819c --- /dev/null +++ b/SlashCommands/general/ping.js @@ -0,0 +1,28 @@ +const { Client, CommandInteraction, MessageEmbed } = require("discord.js"); + +module.exports = { + name: "ping", + description: "returns ping of the Hullcss bot", + type: 'CHAT_INPUT', + /** + * + * @param {Client} client + * @param {CommandInteraction} interaction + * @param {String[]} args + */ + run: async (client, interaction, args) => { + let days = Math.floor(client.uptime / 86400000); + let hours = Math.floor(client.uptime / 3600000) % 24; + let minutes = Math.floor(client.uptime / 60000) % 60; + let seconds = Math.floor(client.uptime / 1000) % 60; + + const embed = new MessageEmbed() + .setColor('GREEN') + .setFooter(`Called By: ${interaction.user.tag}`) + .setTimestamp() + .setTitle("Pong!") + .setDescription(`${client.ws.ping} ping to host`) + .addField('Uptime', ` ${days}days ${hours}hrs ${minutes}min ${seconds}sec`, true) + interaction.followUp({ embeds: [embed]}); + }, +}; \ No newline at end of file