MCPcopy Create free account
hub / github.com/GlobalTechInfo/MEGA-MD / displayProgressBar

Function displayProgressBar

plugins/hack.js:48–56  ·  view source on GitHub ↗

* Display progress bar in chat

(sock, message, taskName, steps, chatId)

Source from the content-addressed store, hash-verified

46 * Display progress bar in chat
47 */
48async function displayProgressBar(sock, message, taskName, steps, chatId) {
49 const progressBarLength = 20;
50 for (let i = 1; i <= steps; i++) {
51 const progress = Math.round((i / steps) * progressBarLength);
52 const bar = '█'.repeat(progress) + '░'.repeat(progressBarLength - progress);
53 await sock.sendMessage(chatId, { text: `*${taskName}:* [${bar}]` }, { quoted: message });
54 await delay(1000);
55 }
56}

Callers 1

handlerFunction · 0.85

Calls 1

delayFunction · 0.70

Tested by

no test coverage detected