Add extra logging to !ping

This commit is contained in:
Dragory 2019-01-13 23:34:54 +02:00
parent 6d1a9845b6
commit 10e21d1120

View file

@ -432,12 +432,17 @@ export class UtilityPlugin extends ZeppelinPlugin {
async pingCmd(msg: Message) {
const times = [];
const messages: Message[] = [];
let msgToMsgDelay = null;
for (let i = 0; i < 4; i++) {
const start = performance.now();
const message = await msg.channel.createMessage(`Calculating ping... ${i + 1}`);
times.push(performance.now() - start);
messages.push(message);
if (msgToMsgDelay === null) {
msgToMsgDelay = message.timestamp - msg.timestamp;
}
}
const highest = Math.round(Math.max(...times));
@ -450,6 +455,7 @@ export class UtilityPlugin extends ZeppelinPlugin {
Lowest: **${lowest}ms**
Highest: **${highest}ms**
Mean: **${mean}ms**
Time between ping command and first reply: **${msgToMsgDelay}ms**
`)
);