add choices to CommandsAPI Options (#94)
This commit is contained in:
		
							parent
							
								
									87b6d6ab12
								
							
						
					
					
						commit
						2cb6c23347
					
				
					 3 changed files with 14 additions and 0 deletions
				
			
		| 
						 | 
					@ -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]);
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -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 {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -42,5 +42,9 @@ export const Devs = Object.freeze({
 | 
				
			||||||
    Animal: {
 | 
					    Animal: {
 | 
				
			||||||
        name: "Animal",
 | 
					        name: "Animal",
 | 
				
			||||||
        id: 118437263754395652n
 | 
					        id: 118437263754395652n
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
 | 
					    MaiKokain: {
 | 
				
			||||||
 | 
					        name: "Mai",
 | 
				
			||||||
 | 
					        id: 722647978577363026n
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue