File tree Expand file tree Collapse file tree 1 file changed +7
-12
lines changed
packages/commandkit/src/handlers/command-handler Expand file tree Collapse file tree 1 file changed +7
-12
lines changed Original file line number Diff line number Diff line change @@ -9,7 +9,6 @@ import registerCommands from './functions/registerCommands';
99import builtInValidations from './validations' ;
1010import colors from '../../utils/colors' ;
1111import rdfc from 'rfdc' ;
12- import { SlashCommandBuilder } from 'discord.js' ;
1312
1413const clone = rdfc ( ) ;
1514
@@ -81,17 +80,6 @@ export class CommandHandler {
8180 let importedObj = await import ( `${ modulePath } ?t=${ Date . now ( ) } ` ) ;
8281 let commandObj : CommandFileObject = clone ( importedObj ) ; // Make commandObj extensible
8382
84- // Ensure builder properties
85- if ( importedObj . default ) {
86- commandObj . data = importedObj . default . data ;
87- } else {
88- commandObj . data = importedObj . data ;
89- }
90-
91- try {
92- commandObj . data = ( commandObj . data as any ) . toJSON ( ) ;
93- } catch ( error ) { }
94-
9583 // If it's CommonJS, invalidate the import cache
9684 if ( typeof module !== 'undefined' && typeof require !== 'undefined' ) {
9785 delete require . cache [ require . resolve ( commandFilePath ) ] ;
@@ -101,6 +89,13 @@ export class CommandHandler {
10189
10290 if ( commandObj . default ) commandObj = commandObj . default as CommandFileObject ;
10391
92+ // Ensure builder properties
93+ if ( importedObj . default ) {
94+ commandObj . data = importedObj . default . data ;
95+ } else {
96+ commandObj . data = importedObj . data ;
97+ }
98+
10499 if ( ! commandObj . data ) {
105100 console . log (
106101 colors . yellow (
You can’t perform that action at this time.
0 commit comments