33 6/24/2021
44
55 Now open-source!
6-
76 Can you believe it took Matt 4 years (as of 2022)
87 to open-source his bot projects?
98 Yeah, I know crazy. wait.. why am I talking third-person again?
@@ -18,9 +17,8 @@ async function bot(debug, lastMessageID = null) {
1817
1918
2019 // ========== PRE-BOOT
21- var startTime = new Date ( ) . getTime ( ) ;
2220 if ( debug ) console . log ( "- PRE-BOOT" ) ;
23- if ( debug ) console . log ( ` -- App is starting as of ${ new Date ( startTime ) . toString ( ) } -- ` ) ;
21+ if ( debug ) console . log ( ` -- App is starting as of ${ new Date ( ) . toString ( ) } -- ` ) ;
2422
2523 // Change directory
2624 try {
@@ -41,14 +39,12 @@ async function bot(debug, lastMessageID = null) {
4139 logger = new Log ( ) ;
4240 logger . info ( "SYS" , `Logging is now enabled!` ) ;
4341
44- await logger . warnAboutDebug ( debug ) ; // warn about debugging (if it applies)
4542
4643 if ( debug ) console . log ( "-> Init: App" ) ;
4744 const app = require ( "./app/cfg/app.js" ) ;
4845 app . debugMode = debug ;
4946 app . logger = logger ;
5047 app . bootloader = bootloader ;
51- app . startTime = startTime ;
5248 app . botStart = ( lastMessage ) => bot ( debug , lastMessage ) ;
5349 if ( lastMessageID != null ) app . lastMessageID = lastMessageID ;
5450 logger . info ( "SYS" , `App core successfully loaded!` ) ;
@@ -84,13 +80,12 @@ async function bot(debug, lastMessageID = null) {
8480 log ( 'X' , 'SYS' , err ) ;
8581 } ;
8682
87- if ( app . client . _events ) {
88- var events = Object . keys ( app . client . _events )
83+ var events = Object . keys ( app . client . _events )
84+ if ( events )
8985 for ( var i = 0 ; i < events . length ; i ++ ) {
9086 log ( "i" , "SYS" , "Unloading event " + events [ i ] ) ;
9187 await app . client . removeListener ( events [ i ] , ( ) => { } ) ;
9288 } ;
93- } ;
9489
9590 app . client = null ;
9691 } ;
@@ -137,8 +132,7 @@ async function bot(debug, lastMessageID = null) {
137132 } , 500 ) ;
138133
139134
140- } ;
141-
135+ }
142136 process . exitHandler = ( options , exitCode ) => exitHandler ( options , exitCode ) ;
143137
144138 // Kinda dumb how I had to shove it into the bot function but it's whatever.
0 commit comments