@@ -12,8 +12,12 @@ const formatColor = function (string) {
1212 const processNestedColors = ( input ) => {
1313 const regex = / ( \w + | # [ 0 - 9 A - F a - f ] { 3 , 6 } ) \{ ( [ ^ { } ] * ) \} / g;
1414 let hasNestedMatch = false ;
15+ if ( input === null || input === undefined ) {
16+ return "Invalid input: " + input ;
17+ }
1518 if ( typeof input !== "string" ) {
16- throw new Error ( `Expected a string, but received: ${ typeof input } ` ) ;
19+ if ( typeof input === "object" ) input = JSON . stringify ( input , "" , 2 ) ;
20+ else return `Invalid input type: expected string, received ${ typeof input } ` ;
1721 }
1822 const formattedString = input . replace ( regex , ( match , color , text ) => {
1923 hasNestedMatch = true ;
@@ -45,7 +49,7 @@ function isHexColor(color) {
4549}
4650
4751export default {
48- logger : {
52+ logger : {
4953 debug : ( ...text ) => process . argv . includes ( "--debug" ) && console . log ( chalk . magentaBright . bold ( "[DEBUG]" ) , ...text . map ( x => formatColor ( x ) ) ) ,
5054 info : ( ...text ) => console . log ( chalk . greenBright . bold ( "[INFO]" ) , ...text . map ( x => formatColor ( x ) ) ) ,
5155 warn : ( ...text ) => console . log ( chalk . yellowBright . bold ( "[WARN]" ) , ...text . map ( x => formatColor ( x ) ) ) ,
@@ -61,7 +65,7 @@ export default {
6165 setupMessage : setupMessage ,
6266 setupSlashCommand : setupSlashCommand ,
6367 setupModal : setupModal ,
64-
68+
6569 createVariable : createVariable ,
6670 botVariables : botVariables ,
6771 userVariables : userVariables ,
0 commit comments