askQuestion
codebolt.chat.askQuestion(question: string, buttons: string[], withFeedback: boolean): Promise<string>
Asks a question to the user.
Parameters
Name | Type | Description |
---|---|---|
question | string | The question text to present to the user. |
buttons | string[] | An array of button labels. Defaults to an empty array if not specified. |
withFeedback | boolean | Whether to allow additional feedback input. Default is false. |
Returns:
Promise<string>
A promise that resolves with the user's response.Example
// Simple question with default options
const response1 = await codebolt.chat.askQuestion("What would you like to do next?");
// Question with custom buttons and feedback option
const response2 = await codebolt.chat.askQuestion(
"How would you like to proceed?",
["Continue", "Skip", "Cancel"],
true
);
Explanation
The askQuestion
function presents a question to the user and waits for their response. It allows you to customize the available response options through buttons and optionally collect additional feedback.