From 2cb6c23347e3305ee04367c2bf2d6e6603a09839 Mon Sep 17 00:00:00 2001 From: Mai Date: Fri, 14 Oct 2022 11:21:44 +0000 Subject: [PATCH] add choices to CommandsAPI Options (#94) --- src/api/Commands/index.ts | 2 ++ src/api/Commands/types.ts | 8 ++++++++ src/utils/constants.ts | 4 ++++ 3 files changed, 14 insertions(+) diff --git a/src/api/Commands/index.ts b/src/api/Commands/index.ts index be65646..6f18f10 100644 --- a/src/api/Commands/index.ts +++ b/src/api/Commands/index.ts @@ -68,6 +68,8 @@ function modifyOpt(opt: Option | Command) { // See comment above Placeholders if (opt === OptPlaceholder) opts[i] = OptionalMessageOption; else if (opt === ReqPlaceholder) opts[i] = RequiredMessageOption; + opt.choices?.forEach(x => x.displayName ||= x.name); + modifyOpt(opts[i]); }); } diff --git a/src/api/Commands/types.ts b/src/api/Commands/types.ts index d50db3c..d78241a 100644 --- a/src/api/Commands/types.ts +++ b/src/api/Commands/types.ts @@ -36,6 +36,14 @@ export interface Option { displayDescription?: string; required?: boolean; options?: Option[]; + choices?: Array; +} + +export interface ChoicesOption { + label: string; + value: string; + name: string; + displayName?: string; } export enum ApplicationCommandType { diff --git a/src/utils/constants.ts b/src/utils/constants.ts index 6cb6cfe..84f0335 100644 --- a/src/utils/constants.ts +++ b/src/utils/constants.ts @@ -42,5 +42,9 @@ export const Devs = Object.freeze({ Animal: { name: "Animal", id: 118437263754395652n + }, + MaiKokain: { + name: "Mai", + id: 722647978577363026n } });