diff --git a/package-lock.json b/package-lock.json index 903ccf7..1ef4952 100644 --- a/package-lock.json +++ b/package-lock.json @@ -207,9 +207,9 @@ "dev": true }, "@types/node": { - "version": "16.4.6", - "resolved": "https://registry.npmjs.org/@types/node/-/node-16.4.6.tgz", - "integrity": "sha512-FKyawK3o5KL16AwbeFajen8G4K3mmqUrQsehn5wNKs8IzlKHE8TfnSmILXVMVziAEcnB23u1RCFU1NT6hSyr7Q==", + "version": "16.4.7", + "resolved": "https://registry.npmjs.org/@types/node/-/node-16.4.7.tgz", + "integrity": "sha512-aDDY54sst8sx47CWT6QQqIZp45yURq4dic0+HCYfYNcY5Ejlb/CLmFnRLfy3wQuYafOeh3lB/DAKaqRKBtcZmA==", "dev": true }, "@types/parse-json": { @@ -796,9 +796,9 @@ "dev": true }, "discord.js": { - "version": "13.0.0-dev.4f1f32f.1627517033", - "resolved": "https://registry.npmjs.org/discord.js/-/discord.js-13.0.0-dev.4f1f32f.1627517033.tgz", - "integrity": "sha512-gjsE4ENDf1OItxFqaB8YjZMc8pP5TpTMntwE9jOSlw8BXxsqxpb8+U8xfg+0Ew69p1y7TlAlfLmM85r4+lGKww==", + "version": "13.0.0-dev.2675b08.1627646567", + "resolved": "https://registry.npmjs.org/discord.js/-/discord.js-13.0.0-dev.2675b08.1627646567.tgz", + "integrity": "sha512-om6QhCwYwaW04Px5LZR9mRD7PEY/wPYrpGhMJFUFwPo8KwLKN2o66CGPb8PZ0uY1XZquEvUjFzVjzBZ//3WRPA==", "dev": true, "requires": { "@discordjs/builders": "^0.2.0", diff --git a/package.json b/package.json index 7de5420..19c915c 100644 --- a/package.json +++ b/package.json @@ -34,11 +34,11 @@ "devDependencies": { "@types/chai": "^4.2.21", "@types/mocha": "^9.0.0", - "@types/node": "^16.4.2", + "@types/node": "^16.4.7", "@typescript-eslint/eslint-plugin": "^4.28.4", "@typescript-eslint/parser": "^4.28.4", "chai": "^4.3.4", - "discord.js": "^13.0.0-dev.4f1f32f.1627517033", + "discord.js": "^13.0.0-dev.2675b08.1627646567", "eslint": "^7.31.0", "eslint-config-prettier": "^8.3.0", "eslint-plugin-prettier": "^3.4.0", @@ -51,7 +51,7 @@ "typescript": "^4.3.5" }, "peerDependencies": { - "discord.js": "13.x" + "discord.js": "^13.0.0-dev" }, "engines": { "node": ">=14.0.0" diff --git a/src/SlashCommandManager.ts b/src/SlashCommandManager.ts index dc0a66a..bf823f8 100644 --- a/src/SlashCommandManager.ts +++ b/src/SlashCommandManager.ts @@ -15,8 +15,8 @@ export class SlashCommandManager { } async execute(interaction: CommandInteraction): Promise { - const handler = this.commands.get(interaction.commandName); - if (handler) handler.execute(interaction); + const command = this.commands.get(interaction.commandName); + if (command) command.execute(interaction); } static create(options?: SlashCommandManagerOptions): SlashCommandManager { @@ -56,10 +56,10 @@ export class SlashCommandManager { } }; - const commandHandlers = new Map(); + const commands = new Map(); for (const l1 of fs.readdirSync(commandFolder, { withFileTypes: true })) { - if (l1.isFile()) loadFile(commandFolder, l1.name, commandHandlers); + if (l1.isFile()) loadFile(commandFolder, l1.name, commands); else if (l1.isDirectory()) { const folder1 = path.join(commandFolder, l1.name); @@ -95,14 +95,14 @@ export class SlashCommandManager { } } - commandHandlers.set( + commands.set( l1.name, new GroupSlashCommand(l1.name, description, defaultPermission, subCommands, groups), ); } } - return new SlashCommandManager(commandHandlers); + return new SlashCommandManager(commands); } } diff --git a/src/command/GroupSlashCommand.ts b/src/command/GroupSlashCommand.ts index f3ed49c..f201005 100644 --- a/src/command/GroupSlashCommand.ts +++ b/src/command/GroupSlashCommand.ts @@ -22,8 +22,8 @@ export class GroupSlashCommand extends SlashCommand { /** @internal */ async execute(interaction: CommandInteraction): Promise { - const subCommandName = interaction.options.getSubCommand(); - const groupName = interaction.options.getSubCommandGroup(false); + const subCommandName = interaction.options.getSubcommand(); + const groupName = interaction.options.getSubcommandGroup(false); const executable = groupName !== null