-
Notifications
You must be signed in to change notification settings - Fork 0
/
ping.js
42 lines (32 loc) · 1.14 KB
/
ping.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
33
34
35
36
37
38
39
40
41
42
const { ApplicationCommandType, ApplicationCommandOptionType } = require('discord.js');
const discord = require("discord.js");
let e = require(`../../database/AuthDB`)
module.exports = {
name: "ping",
description: "Bot's connection to everything.",
options: null,
type: ApplicationCommandType.ChatInput,
run: async (client, interaction, args) => {
let start = Date.now();
let embed1 = new discord.EmbedBuilder()
.setDescription("Looks like the bot is slow.")
await interaction.reply({
embeds: [embed1]
})
let end = Date.now();
const getDatabasePing = async () => {
const Now = Date.now();
await e.find().then(entrys => { })
return `${~~(Date.now() - Now)}`;
};
const DbPing = await getDatabasePing();
let embed = new discord.EmbedBuilder()
.setTitle("Ping!")
.addFields([
{ name: 'API Latency', value: `${Math.round(client.ws.ping)}ms` },
{ name: 'Message Latency', value: `${end - start}ms` },
{ name: 'Database Ping', value: `${DbPing}ms` },
])
interaction.editReply({ embeds: [embed] }).catch((e) => interaction.channel.send(e));
},
};