| 175 | } |
| 176 | |
| 177 | async function restartProcess(sock, chatId, message) { |
| 178 | try { |
| 179 | await sock.sendMessage(chatId, { text: '✅ Update complete! Restarting…' }, { quoted: message }); |
| 180 | } catch {} |
| 181 | try { |
| 182 | // Preferred: PM2 |
| 183 | await run('pm2 restart all'); |
| 184 | return; |
| 185 | } catch {} |
| 186 | // Panels usually auto-restart when the process exits. |
| 187 | // Exit after a short delay to allow the above message to flush. |
| 188 | setTimeout(() => { |
| 189 | process.exit(0); |
| 190 | }, 500); |
| 191 | } |
| 192 | |
| 193 | async function updateCommand(sock, chatId, message, zipOverride) { |
| 194 | const senderId = message.key.participant || message.key.remoteJid; |