Skip to content

Commit f08800c

Browse files
committed
patch
1 parent 8fc01cb commit f08800c

File tree

1 file changed

+7
-12
lines changed

1 file changed

+7
-12
lines changed

packages/commandkit/src/handlers/command-handler/CommandHandler.ts

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import registerCommands from './functions/registerCommands';
99
import builtInValidations from './validations';
1010
import colors from '../../utils/colors';
1111
import rdfc from 'rfdc';
12-
import { SlashCommandBuilder } from 'discord.js';
1312

1413
const 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(

0 commit comments

Comments
 (0)