@@ -17,6 +17,38 @@ client.config = require('./config');
1717const player = new Player ( client , client . config . opt . discordPlayer ) ;
1818player . extractors . loadDefault ( ) ;
1919
20+ console . clear ( )
2021require ( './loader' ) ;
2122
22- client . login ( client . config . app . token ) ;
23+ client . login ( client . config . app . token )
24+ . catch ( async ( e ) => {
25+ console . clear ( )
26+ if ( e . message == 'An invalid token was provided.' ) {
27+ try {
28+ const module = await import ( "chalk" ) ;
29+ chalk = module . default || module ;
30+ console . error (
31+ chalk . red ( `\n
32+ ❌ Invalid Token Provided! ❌
33+ change the token in the config file\n\n` )
34+
35+ + chalk . white ( `app: ` ) + chalk . magenta ( `{\n` ) +
36+ chalk . green ( `token: ` ) + chalk . yellow ( `> > >` ) + chalk . red ( `'xxx'` ) + chalk . yellow ( `< < <\n` ) +
37+ chalk . green ( `playing: ` ) + chalk . blue ( `'by the Community ❤️',\n` ) +
38+ chalk . green ( `global: ` ) + chalk . blue ( `${ client . config . app ?. global } ,\n` ) +
39+ chalk . green ( `guild: ` ) + chalk . blue ( `'${ client . config . app ?. guild } ',\n` ) +
40+ chalk . green ( `extraMessages: ` ) + chalk . blue ( `${ client . config . app ?. extraMessages } ,\n` ) +
41+ chalk . green ( `loopMessage: ` ) + chalk . blue ( `${ client . config . app ?. loopMessage } ,\n` ) +
42+ chalk . green ( `lang: ` ) + chalk . blue ( `'${ client . config . app ?. lang } ',\n` ) +
43+ chalk . green ( `Translate_Timeout: ` ) + chalk . blue ( `${ client . config . app ?. Translate_Timeout } ,\n` ) +
44+ chalk . green ( `enableEmojis: ` ) + chalk . blue ( `${ client . config . app ?. enableEmojis } ,\n` ) +
45+ chalk . magenta ( `},\n` ) ) ;
46+
47+ process . exit ( 1 ) ;
48+ } catch ( e ) {
49+ throw new Error ( '❌ Could not load the Chalk module properly, the error will be printed without highlighting ❌' )
50+ }
51+
52+
53+ }
54+ } ) ;
0 commit comments