Holana/commands/ping.js

39 lines
1.3 KiB
JavaScript
Raw Normal View History

2023-03-19 02:46:57 -07:00
const messages = require('../utils/messages');
const { MessageEmbed } = require("discord.js");
2021-12-09 21:24:04 -08:00
module.exports = {
2023-03-19 02:46:57 -07:00
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,
});
}
2021-12-09 21:24:04 -08:00
2023-03-19 02:46:57 -07:00
let circles = {
green: "<:online:885049752297824276>",
yellow: "<:idle:885049726460899339>",
red: "<:offline:885049312877346817>",
};
2021-12-09 21:24:04 -08:00
2023-03-19 02:46:57 -07:00
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] });
},
2021-12-09 21:24:04 -08:00
};