From b870b51c117389e185f73a185e81693bc7dc86b8 Mon Sep 17 00:00:00 2001 From: March 7th <71698422+aiko-chan-ai@users.noreply.github.com> Date: Thu, 18 Aug 2022 12:11:49 +0700 Subject: [PATCH] chore(release): v2.6.2 --- package.json | 2 +- src/structures/ApplicationCommand.js | 4 ++-- typings/index.d.ts | 6 +++++- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index b7fea2d..b6e08ba 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "discord.js-selfbot-v13", - "version": "2.6.1", + "version": "2.6.2", "description": "A unofficial discord.js fork for creating selfbots [Based on discord.js v13]", "main": "./src/index.js", "types": "./typings/index.d.ts", diff --git a/src/structures/ApplicationCommand.js b/src/structures/ApplicationCommand.js index 3ad3212..412d616 100644 --- a/src/structures/ApplicationCommand.js +++ b/src/structures/ApplicationCommand.js @@ -738,7 +738,7 @@ class ApplicationCommand extends Base { 'is not a valid sub command', ); } - const valueRequired = subCommand.options?.filter(o => o.required).length; + const valueRequired = subCommand.options?.filter(o => o.required).length || 0; for (let i = 0; i < options.length; i++) { const optionInput = subCommand.options[i]; const value = options[i]; @@ -905,7 +905,7 @@ class ApplicationCommand extends Base { // length = 2 => sub command group + sub command switch (subCommandArray.length) { case 0: { - const valueRequired = this.options.filter(o => o.required).length; + const valueRequired = this.options?.filter(o => o.required).length || 0; for (let i = 0; i < options.length; i++) { const optionInput = this.options[i]; const value = options[i]; diff --git a/typings/index.d.ts b/typings/index.d.ts index e7a9837..429006d 100644 --- a/typings/index.d.ts +++ b/typings/index.d.ts @@ -474,7 +474,11 @@ export class ApplicationCommand extends Base { private static transformCommand(command: ApplicationCommandData): RESTPostAPIApplicationCommandsJSONBody; private static isAPICommandData(command: object): command is RESTPostAPIApplicationCommandsJSONBody; // Add - public static sendSlashCommand(message: Message, subCommandArray?: string[], options?: string[]): Promise; + public static sendSlashCommand( + message: Message, + subCommandArray?: string[], + options?: string[], + ): Promise; public static sendContextMenu(message: Message): Promise; }