11console . log ( '🐾 Starting...' )
22
3- import { join , dirname } from 'path '
4- import { createRequire } from "module" ;
3+ import yargs from 'yargs '
4+ import cfonts from 'cfonts'
55import { fileURLToPath } from 'url'
6+ import { join , dirname } from 'path'
7+ import { createRequire } from 'module'
8+ import { createInterface } from 'readline'
69import { setupMaster , fork } from 'cluster'
710import { watchFile , unwatchFile } from 'fs'
8- import cfonts from 'cfonts' ;
9- import { createInterface } from 'readline'
10- import yargs from 'yargs'
1111
1212// https://stackoverflow.com/a/50052194
13+ const { say } = cfonts
14+ const rl = createInterface ( process . stdin , process . stdout )
1315const __dirname = dirname ( fileURLToPath ( import . meta. url ) )
1416const require = createRequire ( __dirname ) // Bring in the ability to create the 'require' method
1517const { name, author } = require ( join ( __dirname , './package.json' ) ) // https://www.stefanjudis.com/snippets/how-to-import-json-files-in-es-modules-node-js/
16- const { say } = cfonts
17- const rl = createInterface ( process . stdin , process . stdout )
1818
19- say ( 'KannaBotz\nMulti-Device' , {
20- font : 'block' ,
21- align : 'center' ,
22- colors : [ 'blue' ]
23- } )
24- say ( `🐾 RPG BOT Multi-Device Whatsapp By ImYanXiao` , {
25- font : 'console' ,
26- align : 'center' ,
27- colors : [ 'green' ]
28- } )
19+ say ( '🐾RPG BOT Multi-Device\nWhatsApp' , { font : 'chrome' , align : 'center' , gradient : [ 'blue' , 'green' ] } )
20+ say ( `'${ name } ' By @${ author . name || author } ` , { font : 'console' , align : 'center' , gradient : [ 'blue' , 'green' ] } )
2921
3022var isRunning = false
3123/**
@@ -36,33 +28,11 @@ function start(file) {
3628 if ( isRunning ) return
3729 isRunning = true
3830 let args = [ join ( __dirname , file ) , ...process . argv . slice ( 2 ) ]
39- say ( [ process . argv [ 0 ] , ...args ] . join ( ' ' ) , {
40- font : 'console' ,
41- align : 'center' ,
42- colors : [ 'magenta' ]
43- } )
44- say ( '🌎 MEMUAT SOURCE...' , {
45- font : 'console' ,
46- align : 'center' ,
47- colors : [ 'green' ]
48- } )
49- say ( '📑 MEMUAT PLUGINS...' , {
50- font : 'console' ,
51- align : 'center' ,
52- colors : [ 'green' ]
53- } )
54- say ( '✅ DONE !' , {
55- font : 'console' ,
56- align : 'center' ,
57- colors : [ 'green' ]
58- } )
59- setupMaster ( {
60- exec : args [ 0 ] ,
61- args : args . slice ( 1 ) ,
62- } )
31+ say ( [ process . argv [ 0 ] , ...args ] . join ( ' ' ) , { font : 'console' , align : 'center' , gradient : [ 'red' , 'magenta' ] } )
32+ setupMaster ( { exec : args [ 0 ] , args : args . slice ( 1 ) } )
6333 let p = fork ( )
6434 p . on ( 'message' , data => {
65- console . log ( '[RECEIVED]' , data )
35+ console . log ( '[✅ RECEIVED]' , data )
6636 switch ( data ) {
6737 case 'reset' :
6838 p . process . kill ( )
@@ -76,8 +46,8 @@ function start(file) {
7646 } )
7747 p . on ( 'exit' , ( _ , code ) => {
7848 isRunning = false
79- console . error ( '[❗] Exited with code:' , code )
80- if ( code === 0 ) return
49+ console . error ( '[❗]Exited with code:' , code )
50+ if ( code !== 0 ) return start ( file )
8151 watchFile ( args [ 0 ] , ( ) => {
8252 unwatchFile ( args [ 0 ] )
8353 start ( file )
0 commit comments