In TELEGRAM bot, there is a way to programmatically “build” a kind of “Ask a Question” with given choices from (for example) a code’s results?
NOTE: The problem is that results from code can change in quantity, so we do not know how many results are. Sometime options are “option1”,“option2” and “option3”; other times are “option1” and “option2”; sometimes is just “option1”; etc.
If possible, can anyone please give me an example? Thanks in advance.
UPDATED:
A not so good solution is the following:
-
This time we have this result from code:
var obj = {
q: 2,
options:[
{option:“option#1”, value:“val#1”},
{option:“option#2”, value:“val#2”}
]
}; -
We can expect (or just limit options to this amount) a maximum of 10 options in the code’s result. So:
-
Add to the bot an “Ask a Question” interact; and ADD ten choices to it.
The first one with the value:
{{execute_code.result__options__0__option}}
The second one with the value
{{execute_code.result__options__1__option}}
The third one with the value
{{execute_code.result__options__2__option}}
and so on…
This way, although in this case the values are empty from options #3 to the last one (#10), it shows only the #1 and #2 options, without error.
I think is not a good solution; because it is based on the limitation we impose (maximum of ten options). But yes, it’s a kind of solution