Skip to content
This repository has been archived by the owner on Jan 20, 2019. It is now read-only.

Commit

Permalink
Update bot.js
Browse files Browse the repository at this point in the history
  • Loading branch information
DonovanDMC committed May 13, 2018
1 parent f2edb8e commit 69c7197
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions bot.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,16 +141,16 @@ client.on("message", async message => {
// e.g. if we have the message "!say Is this the real life?" , we'll get the following:
// command = say
// args = ["Is", "this", "the", "real", "life?"]
const args = message.content.slice(prefix.length).trim().split(/\s+/g);
const command = args.shift().toLowerCase();
var args = message.content.slice(prefix.length).trim().split(/\s+/g);
var command = args.shift().toLowerCase();

switch(command) {
case "ping":
// Calculates ping between sending a message and editing it, giving a nice round-trip latency.
// The second ping is an average latency between the bot and the websocket server (one-way, not round-trip)
// Message Class: https://discord.js.org/#/docs/main/stable/class/Message
// Channel Class: https://discord.js.org/#/docs/main/stable/class/Channel
const m = await message.channel.send("Ping?");
var m = await message.channel.send("Ping?");
m.edit(`Pong! Latency is ${m.createdTimestamp - message.createdTimestamp}ms. API Latency is ${Math.round(client.ping)}ms`);
break;

Expand Down

0 comments on commit 69c7197

Please sign in to comment.