Add extra logging to !ping
This commit is contained in:
parent
6d1a9845b6
commit
10e21d1120
1 changed files with 6 additions and 0 deletions
|
@ -432,12 +432,17 @@ export class UtilityPlugin extends ZeppelinPlugin {
|
||||||
async pingCmd(msg: Message) {
|
async pingCmd(msg: Message) {
|
||||||
const times = [];
|
const times = [];
|
||||||
const messages: Message[] = [];
|
const messages: Message[] = [];
|
||||||
|
let msgToMsgDelay = null;
|
||||||
|
|
||||||
for (let i = 0; i < 4; i++) {
|
for (let i = 0; i < 4; i++) {
|
||||||
const start = performance.now();
|
const start = performance.now();
|
||||||
const message = await msg.channel.createMessage(`Calculating ping... ${i + 1}`);
|
const message = await msg.channel.createMessage(`Calculating ping... ${i + 1}`);
|
||||||
times.push(performance.now() - start);
|
times.push(performance.now() - start);
|
||||||
messages.push(message);
|
messages.push(message);
|
||||||
|
|
||||||
|
if (msgToMsgDelay === null) {
|
||||||
|
msgToMsgDelay = message.timestamp - msg.timestamp;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const highest = Math.round(Math.max(...times));
|
const highest = Math.round(Math.max(...times));
|
||||||
|
@ -450,6 +455,7 @@ export class UtilityPlugin extends ZeppelinPlugin {
|
||||||
Lowest: **${lowest}ms**
|
Lowest: **${lowest}ms**
|
||||||
Highest: **${highest}ms**
|
Highest: **${highest}ms**
|
||||||
Mean: **${mean}ms**
|
Mean: **${mean}ms**
|
||||||
|
Time between ping command and first reply: **${msgToMsgDelay}ms**
|
||||||
`)
|
`)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue