obama-bot/commands/ping.js

34 lines
1,020 B
JavaScript
Raw Normal View History

2020-11-28 16:38:23 +00:00
const Discord = require('discord.js');
const { client } = require('..');
module.exports.meta = {
name: 'ping',
aliases: [],
staffOnly: false
}
/**
*
* @param {Discord.Message} message
* @param {Array<string>} args
*/
2020-11-28 16:38:23 +00:00
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);
}
}