Holana/commands/ping.js
2021-12-10 18:24:04 +13:00

39 lines
No EOL
1.3 KiB
JavaScript

const messages = require('../utils/messages');
const { MessageEmbed } = require("discord.js");
module.exports = {
name: "ping",
description: "Tells the bot's latency,",
run: async (client, interaction) => {
// If the member doesn't have enough permissions
if (!interaction.member.permissions.has("SEND_MESSAGES")) {
return interaction.reply({
content:
":x: You need to have the manage messages permissions to start giveaways.",
ephemeral: true,
});
}
let circles = {
green: "<:online:885049752297824276>",
yellow: "<:idle:885049726460899339>",
red: "<:offline:885049312877346817>",
};
let botping = new MessageEmbed()
.setTitle(`${client.user.name} Ping`)
.setColor("2f3136")
.addFields({
name: "<:link:911514727375577088> Bot Ping:",
value: `${
client.ws?.ping <= 200
? circles.green
: client.ws?.ping <= 400
? circles.yellow
: circles.red
} ${client.ws?.ping}ms`,
})
.setTimestamp();
await interaction.reply({ embeds: [botping] });
},
};