mirror of
https://github.com/404BennettNOTFound/Acid-Yunzai.git
synced 2025-10-26 03:02:39 +00:00
28 lines
864 B
JavaScript
28 lines
864 B
JavaScript
global.Bot = new (await import('./lib/bot.js')).default()
|
|
switch (process.env.app_type || process.argv[2]) {
|
|
case 'pm2':
|
|
case 'start': {
|
|
// eslint-disable-next-line new-cap
|
|
|
|
Bot.run()
|
|
break
|
|
} case 'stop': {
|
|
const cfg = (await import('./lib/config/config.js')).default
|
|
const fetch = (await import('node-fetch')).default
|
|
try {
|
|
await fetch(`http://localhost:${cfg.server.port}/exit`, { headers: cfg.server.auth || undefined })
|
|
} catch {}
|
|
process.exit()
|
|
// eslint-disable-next-line no-fallthrough
|
|
} default: {
|
|
const { spawnSync } = await import('node:child_process')
|
|
while (!spawnSync(process.argv[0],
|
|
[process.argv[1], 'start', ...process.argv.slice(2)],
|
|
{ stdio: 'inherit' }
|
|
).status) { /* empty */ }
|
|
process.exit()
|
|
}
|
|
}
|
|
//Aike:LoveJinan
|
|
//Bennett:红豆吃多了🤓👆在代码表白
|