From 15055edca2c599659b168c331ce566b2a34ef0bc Mon Sep 17 00:00:00 2001 From: Eric Heyden <34678575+zcpua@users.noreply.github.com> Date: Sat, 1 Jul 2023 19:04:47 +0800 Subject: [PATCH] up --- src/command.ts | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/src/command.ts b/src/command.ts index 65bf51b..2526f4e 100644 --- a/src/command.ts +++ b/src/command.ts @@ -41,18 +41,9 @@ export class Command { }); const data = await response.json(); - - if ("application_commands" in data) { - const application_commands = data.application_commands; - if (application_commands[0]) { - // console.log( - // `got ${name} application_commands`, - // application_commands[0] - // ); - return application_commands[0]; - } + if (data?.application_commands?.[0]) { + return data.application_commands[0]; } - throw new Error(`Failed to get application_commands for command ${name}`); } async imaginePayload(prompt: string, nonce?: string) {