Skip to content

Commit

Permalink
refactor: simplify ping command
Browse files Browse the repository at this point in the history
  • Loading branch information
mastondzn committed May 29, 2024
1 parent e5b0d4d commit c664cdb
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions bot/src/commands/ping.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ import ms from 'pretty-ms';
import { createCommand } from '~/helpers/command';
import { chat } from '~/services';

const startedAt = new Date();

export default createCommand({
name: 'ping',
description: 'Replies with pong! To ensure the bot is alive.',
Expand All @@ -18,18 +16,14 @@ export default createCommand({
lines.push('MrDestructoid Pong!');
}

const latency = await chat.getLatency();

lines.push(
`Latency is ${latency}ms.`,
`Uptime is ${ms(Date.now() - startedAt.getTime(), {
`Uptime is ${ms(process.uptime() * 1000, {
unitCount: 2,
secondsDecimalDigits: 0,
})}.`,
`Latency is ${await chat.getLatency()}ms.`,
);

return {
reply: lines.join(' '),
};
return { reply: lines.join(' ') };
},
});

0 comments on commit c664cdb

Please sign in to comment.