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