-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlatencyCommand.js
32 lines (28 loc) · 927 Bytes
/
latencyCommand.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
const {MessageEmbed} = require("discord.js");
/**
* @type {{name: string, description: string, execute: ((function(*, *, *, *): Promise<void>)|*)}}
*/
module.exports = {
name: "latency",
description: "Replies with the bots latency.",
/**
* @param client
* @param message
* @param _
* @param __
* @returns {Promise<void>}
*/
execute: async (client, message, _, __) => {
message.reply("Calculating latency...").then((msg) => {
const ping = msg.createdTimestamp - message.createdTimestamp;
const embed = new MessageEmbed()
.setColor("GREEN")
.setTitle("JP | Latency Command")
.setDescription(`Bot-Latency: ${ping}ms\nAPI-Latency: ${Math.round(client.ws.ping)}ms`)
.setTimestamp(Date.now());
msg.edit({
embeds: [embed]
});
});
}
};