forked from tas33n/Goat-WhatsApp-Bot
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathindex.js
More file actions
36 lines (31 loc) · 794 Bytes
/
index.js
File metadata and controls
36 lines (31 loc) · 794 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/*
Name: Goat-WhatsApp-Bot
Description: A WhatsApp bot built with Node.js, designed to automate tasks and provide various functionalities
Author: tas33n & alamin
Version: 1.0.5
License: MIT
Repository: https://github.com/tas33n/Goat-WhatsApp-Bot
*/
const { spawn } = require("child_process")
const path = require("path")
const { logger } = require("./libs/logger")
function startBot() {
console.clear()
const child = spawn("node", ["Goat.js"], {
cwd: __dirname,
stdio: "inherit",
shell: true,
})
child.on("close", (code) => {
if (code === 2) {
logger.info("🔄 Restarting bot...")
setTimeout(() => {
startBot()
}, 1000)
}
})
child.on("error", (err) => {
logger.error("❌ Failed to start bot process:", err)
})
}
startBot()