From deb09bf5bfa2304613660c1fd3d1d6743b4bf6a1 Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Fri, 17 May 2024 17:47:40 +0300 Subject: [PATCH] Fix console errors on not found command autocomplete --- .../slash-commands/SlashCommandAutoCompleteNameResult.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/public/scripts/slash-commands/SlashCommandAutoCompleteNameResult.js b/public/scripts/slash-commands/SlashCommandAutoCompleteNameResult.js index ba163fcd5..8a9c08653 100644 --- a/public/scripts/slash-commands/SlashCommandAutoCompleteNameResult.js +++ b/public/scripts/slash-commands/SlashCommandAutoCompleteNameResult.js @@ -58,6 +58,9 @@ export class SlashCommandAutoCompleteNameResult extends AutoCompleteNameResult { return new RegExp('=(.*)'); } } + if (!Array.isArray(this.executor.command?.namedArgumentList)) { + return null; + } const notProvidedNamedArguments = this.executor.command.namedArgumentList.filter(arg=>!this.executor.namedArgumentList.find(it=>it.name == arg.name)); let name; let value; @@ -130,6 +133,9 @@ export class SlashCommandAutoCompleteNameResult extends AutoCompleteNameResult { } getUnnamedArgumentAt(text, index, isSelect) { + if (!Array.isArray(this.executor.command?.unnamedArgumentList)) { + return null; + } const lastArgIsBlank = this.executor.unnamedArgumentList.slice(-1)[0]?.value == ''; const notProvidedArguments = this.executor.command.unnamedArgumentList.slice(this.executor.unnamedArgumentList.length - (lastArgIsBlank ? 1 : 0)); let value;