MCPcopy Create free account
hub / github.com/Xchristech2/Zenitsu-Bot / formatTime

Function formatTime

commands/ping.js:4–19  ·  view source on GitHub ↗
(seconds)

Source from the content-addressed store, hash-verified

2const settings = require('../settings.js');
3
4function formatTime(seconds) {
5 const days = Math.floor(seconds / (24 * 60 * 60));
6 seconds %= 24 * 60 * 60;
7 const hours = Math.floor(seconds / (60 * 60));
8 seconds %= 60 * 60;
9 const minutes = Math.floor(seconds / 60);
10 seconds = Math.floor(seconds % 60);
11
12 let time = '';
13 if (days) time += `${days}d `;
14 if (hours) time += `${hours}h `;
15 if (minutes) time += `${minutes}m `;
16 if (seconds || !time) time += `${seconds}s`;
17
18 return time.trim();
19}
20
21async function pingCommand(sock, chatId, message) {
22 try {

Callers 1

pingCommandFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected