obama-bot/commands/ping.js
2020-11-28 17:38:23 +01:00

29 lines
939 B
JavaScript

const Discord = require('discord.js');
const { client } = require('..');
module.exports.meta = {
name: 'ping',
aliases: [],
staffOnly: false
}
module.exports.run = async (message, args) => {
try {
let embed = new Discord.MessageEmbed()
.setTitle('Pong?')
.setDescription('Measuring...')
.setColor('#2F62CA');
message.channel.send(embed).then(msg => {
embed.setTitle('Pong!');
embed.description = undefined;
embed.addField(':robot: Bot Ping', `\`${Date.now() - message.createdTimestamp}ms\``, true);
embed.addField(':robot: API Ping', `\`${client.ws.ping}ms\``, true);
embed.addField(':speech_balloon: Message delay', `\`${msg.createdTimestamp - message.createdTimestamp}ms\``, true);
msg.edit(embed);
});
} catch(e) {
console.error(e);
message.channel.send(e);
}
}