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

Function pingCommand

commands/ping.js:21–47  ·  view source on GitHub ↗
(sock, chatId, message)

Source from the content-addressed store, hash-verified

19}
20
21async function pingCommand(sock, chatId, message) {
22 try {
23 // Measure ping
24 const start = Date.now();
25 await sock.sendMessage(chatId, { text: '⚡ Pinging...' }, { quoted: message });
26 const end = Date.now();
27 const ping = Math.round(end - start);
28
29 const uptimeInSeconds = process.uptime();
30 const uptimeFormatted = formatTime(uptimeInSeconds);
31
32 // Minimal output
33 const botInfo = `
34𝐙𝐄𝐍𝐈𝐓𝐒𝐔 𝐁𝐎𝐓 🤖
35
36⚡ Ping : ${ping} ms
37⏱️ Uptime : ${uptimeFormatted}
38🆚 Version : v${settings.version}
39`;
40
41 await sock.sendMessage(chatId, { text: botInfo }, { quoted: message });
42
43 } catch (error) {
44 console.error('Error in ping command:', error);
45 await sock.sendMessage(chatId, { text: '❌ Could not get ping status.' }, { quoted: message });
46 }
47}
48
49module.exports = pingCommand;

Callers

nothing calls this directly

Calls 1

formatTimeFunction · 0.85

Tested by

no test coverage detected