add choices to CommandsAPI Options (#94)

This commit is contained in:
Mai 2022-10-14 11:21:44 +00:00 committed by GitHub
parent 87b6d6ab12
commit 2cb6c23347
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 0 deletions

View file

@ -68,6 +68,8 @@ function modifyOpt(opt: Option | Command) {
// See comment above Placeholders // See comment above Placeholders
if (opt === OptPlaceholder) opts[i] = OptionalMessageOption; if (opt === OptPlaceholder) opts[i] = OptionalMessageOption;
else if (opt === ReqPlaceholder) opts[i] = RequiredMessageOption; else if (opt === ReqPlaceholder) opts[i] = RequiredMessageOption;
opt.choices?.forEach(x => x.displayName ||= x.name);
modifyOpt(opts[i]); modifyOpt(opts[i]);
}); });
} }

View file

@ -36,6 +36,14 @@ export interface Option {
displayDescription?: string; displayDescription?: string;
required?: boolean; required?: boolean;
options?: Option[]; options?: Option[];
choices?: Array<ChoicesOption>;
}
export interface ChoicesOption {
label: string;
value: string;
name: string;
displayName?: string;
} }
export enum ApplicationCommandType { export enum ApplicationCommandType {

View file

@ -42,5 +42,9 @@ export const Devs = Object.freeze({
Animal: { Animal: {
name: "Animal", name: "Animal",
id: 118437263754395652n id: 118437263754395652n
},
MaiKokain: {
name: "Mai",
id: 722647978577363026n
} }
}); });