Holana/commands/ping.js

39 lines
1.1 KiB
JavaScript
Raw Normal View History

2022-12-02 08:54:36 +00:00
const messages = require("../utils/messages");
const { EmbedBuilder } = require("discord.js");
2021-12-10 05:24:04 +00:00
module.exports = {
2022-12-02 08:54:36 +00:00
name: "ping",
description: "Tells a bot 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 right permissions to use this command.",
ephemeral: true,
});
}
2021-12-10 05:24:04 +00:00
2022-12-02 08:54:36 +00:00
let circles = {
green: "<:online:903711513183940669>",
yellow: "<:idle:903711513490112512> ",
red: "<:dnd:903711513066487851>",
};
2021-12-10 05:24:04 +00:00
2022-12-02 08:54:36 +00:00
let botping = new EmbedBuilder()
.setTitle(`${client.user.username} Ping`)
.setColor("2f3136")
.addFields({
name: "<:connection2:896715171454677013> 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-10 05:24:04 +00:00
};