Skip to content
This repository has been archived by the owner on Apr 27, 2023. It is now read-only.

Commit

Permalink
Merge pull request #1 from tguichaoua/update-discord.js
Browse files Browse the repository at this point in the history
Update djs to 13.0.0-dev.2675b08.1627646567
  • Loading branch information
tguichaoua authored Jul 30, 2021
2 parents e5f8932 + 03a78b4 commit 401225e
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 17 deletions.
12 changes: 6 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -51,7 +51,7 @@
"typescript": "^4.3.5"
},
"peerDependencies": {
"discord.js": "13.x"
"discord.js": "^13.0.0-dev"
},
"engines": {
"node": ">=14.0.0"
Expand Down
12 changes: 6 additions & 6 deletions src/SlashCommandManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ export class SlashCommandManager {
}

async execute(interaction: CommandInteraction): Promise<void> {
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 {
Expand Down Expand Up @@ -56,10 +56,10 @@ export class SlashCommandManager {
}
};

const commandHandlers = new Map<string, SlashCommand>();
const commands = new Map<string, SlashCommand>();

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);

Expand Down Expand Up @@ -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);
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/command/GroupSlashCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ export class GroupSlashCommand extends SlashCommand {

/** @internal */
async execute(interaction: CommandInteraction): Promise<void> {
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
Expand Down

0 comments on commit 401225e

Please sign in to comment.