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
if (opt === OptPlaceholder) opts[i] = OptionalMessageOption;
else if (opt === ReqPlaceholder) opts[i] = RequiredMessageOption;
opt.choices?.forEach(x => x.displayName ||= x.name);
modifyOpt(opts[i]);
});
}

View file

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

View file

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