* Display progress bar in chat
(sock, message, taskName, steps, chatId)
| 46 | * Display progress bar in chat |
| 47 | */ |
| 48 | async 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 | } |