Skip to content
This repository has been archived by the owner on Aug 22, 2024. It is now read-only.

Update discord.js dependency to npmjs version #65

Open
wants to merge 2 commits into
base: slash
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
7 changes: 5 additions & 2 deletions src/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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
});

Expand Down
12 changes: 5 additions & 7 deletions src/decorators/classes/DSlash.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,18 +130,16 @@ export class DSlash extends Method {
}));
}

getLastNestedOption(options: Map<string, CommandInteractionOption>): CommandInteractionOption[] {
const arrOptions = Array.from(options?.values());

if (!arrOptions?.[0]?.options) {
return arrOptions;
getLastNestedOption(options: ReadonlyArray<CommandInteractionOption>): ReadonlyArray<CommandInteractionOption> {
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;
Expand Down