Holana/commands/ping.js

39 lines
1.3 KiB
JavaScript
Raw Permalink Normal View History

2021-12-10 05:24:04 +00:00
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] });
},
};