diff --git a/commands/misc/ping.js b/commands/misc/ping.js new file mode 100644 index 0000000..5a7d87b --- /dev/null +++ b/commands/misc/ping.js @@ -0,0 +1,22 @@ +const Discord = require('discord.js'); + +module.exports = { + name: "ping", + aliases: [], + meta: { + category: 'Misc', + description: "Find out Natsuki's latency", + syntax: '`ping`', + extra: null + }, + help: "Definitely not much to see here...", + async execute(message, msg, args, cmd, prefix, mention, client) { + return message.channel.send({embeds: [new Discord.MessageEmbed() + .setTitle("Client Latency") + .setDescription(`Response Latency: \`${new Date().getTime() - message.createdTimestamp}ms\`\nAPI Latency: \`${client.ws.ping}ms\``) + .setFooter({text: "Natsuki", iconURL: client.user.avatarURL()}) + .setTimestamp() + .setColor('c375f0') + ]}); + } +}; \ No newline at end of file diff --git a/events/messageCreate.js b/events/messageCreate.js index fb1e8c2..3a9ec1a 100644 --- a/events/messageCreate.js +++ b/events/messageCreate.js @@ -117,9 +117,8 @@ module.exports = async (client, message) => { if (!command) {let trigger; for (trigger of client.responses.triggers) {if (await trigger[1](message, msg, args, cmd, prefix, mention, client)) {await client.responses.commands.get(trigger[0]).execute(message, msg, args, cmd, prefix, mention, client); break;}} return;} if (message.guild && !message.channel.permissionsFor(client.user.id).has('SEND_MESSAGES')) {return message.author.send(`You tried to run the \`${command.name}\` command, but I don't seem to be able to send messages in <#${message.channel.id}>, so I can't do that!`).catch(() => {});}; - message.channel.sendTyping().catch(() => {}); + await message.channel.sendTyping().catch(() => {}); if (!require('../util/cooldownhandler')(client, message, command)) {return;} - await wait(500); if (command.meta && command.meta.guildOnly && !message.guild) {return message.channel.send("You must be in a server to use this command!").catch(() => {});} require('../util/oncommand')(message, msg, args, cmd, prefix, mention, client); if (client.misc.loggers.cmds) {client.misc.loggers.cmds.send(`${chalk.gray("[CMDL]")} >> ${chalk.white("Command")} ${chalk.blue(command.name)} ${message.guild ? `|| ${chalk.blue("Guild ID: ")} ${chalk.blueBright(message.guild.id)}` : ''} || ${chalk.blue("User ID: ")} ${chalk.blueBright(message.author.id)}`);}