Skip to content

Commit

Permalink
add choices to CommandsAPI Options (Vendicated#94)
Browse files Browse the repository at this point in the history
  • Loading branch information
MaiKokain authored Oct 14, 2022
1 parent 87b6d6a commit 2cb6c23
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/api/Commands/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
});
}
Expand Down
8 changes: 8 additions & 0 deletions src/api/Commands/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 4 additions & 0 deletions src/utils/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,9 @@ export const Devs = Object.freeze({
Animal: {
name: "Animal",
id: 118437263754395652n
},
MaiKokain: {
name: "Mai",
id: 722647978577363026n
}
});

0 comments on commit 2cb6c23

Please sign in to comment.