diff --git a/package.json b/package.json index 356cc40e..6ac707f6 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,7 @@ ], "dependencies": { "discord-api-types": "^0.18.1", - "discord.js": "github:discordjs/discord.js", + "discord.js": "^13.0.1", "glob": "^7.1.7" }, "devDependencies": { diff --git a/src/Client.ts b/src/Client.ts index 3aeafdd5..4c379048 100644 --- a/src/Client.ts +++ b/src/Client.ts @@ -209,7 +209,10 @@ export class Client extends ClientJS { if (slash.permissions.length <= 0) return; - await commands.setPermissions(command, slash.getPermissions()); + await commands.permissions.set({ + command: command, + permissions: slash.getPermissions() + }); }) ); } else { @@ -299,7 +302,7 @@ export class Client extends ClientJS { getOptionsTree({ name: interaction.commandName, - options: interaction.options, + options: interaction.options.data.map(p => p), type: undefined }); diff --git a/src/decorators/classes/DSlash.ts b/src/decorators/classes/DSlash.ts index f9663185..65d9cbb5 100644 --- a/src/decorators/classes/DSlash.ts +++ b/src/decorators/classes/DSlash.ts @@ -130,18 +130,16 @@ export class DSlash extends Method { })); } - getLastNestedOption(options: Map): CommandInteractionOption[] { - const arrOptions = Array.from(options?.values()); - - if (!arrOptions?.[0]?.options) { - return arrOptions; + getLastNestedOption(options: ReadonlyArray): ReadonlyArray { + if (!options?.[0]?.options) { + return options; } - return this.getLastNestedOption(arrOptions?.[0].options); + return this.getLastNestedOption(options?.[0].options); } parseParams(interaction: CommandInteraction) { - const options = this.getLastNestedOption(interaction.options); + const options = this.getLastNestedOption(interaction.options.data); const values = this.options.map((opt, index) => { return options[index]?.value;