I am using the botbuilder DialogTestClient 's sendActivity method to send prompts to my bot while testing but the method only accepts string types and in my bot i use number promts to prompt the user for numbers . Do you have any idea on how i can overturn this problem ?
Thanks in advance
I'm a bit unclear if you are having this issue only for DialogTestClient or all Clients, but in nodejs you can just convert the string to number using Number(promptInput). If the promptInput is already a number, it will still work fine. I assume there is a similar function in C#.
Edit: Some additional context. You can take a look at userProfileDialog.js in multi-turn-prompt sample for an example. Essentially, NumberPrompt has a "succeeded" property in the recognizer that ensures you entered a number. You can use that plus whatever validations you want in the validator function. If it succeeds and is validated, a number, not a string, is passed to the next step in your dialog.
If the error is coming when you are trying to repeat back the prompt value to the user, you need to convert it to a string. I favor using the backtick for this (template string/literal), e.g.
await step.context.sendActivity(`You entered ${step.result}`);
where step.result is the numberPrompt result.
Related
Currently I have my Cypress code writing out an email verification code to the log.
I need to take the six numbers from this value, to be inserted into a text field as a string.
The code I have in Cypress looks like this.
And the line of code related in the feature file looks like this.
I cannot pass the object into 'type' because it can only be a string or number.
Is there a way to take out the number element from the log to be used in the placeholderText part of the code I currently have?
It looks like email.text.codes[0] yields an object with one key (of value). So I think we'll just need to access that value field.
cy.get('foo')
.type(email.text.codes[0].value);
I am trying to get some data parsed out of a subject line in Office 365 Flows. I have an email that has a consistent format:
Help Desk [Ticket #12345]
I want to get the number '12345' for use in later steps in the flow. So far, I've attempted to use the substring expression in a compose connector:
substring(triggerBody()?['Subject'], 20, 5)
But I get an error about the string being null.
Besides the index being incorrect (to retrieve '12345' from Help Desk [Ticket #12345] you need to use substring(value, 0, 5) as the index is 0-based), the expression looks correct. But you can take a step-by-step approach to see what is wrong.
To start, take a look at the flow run to see exactly what the trigger outputs are:
If you see the Subject field (as I do in my case), create a variable containing that value only to make sure that you don't have any typo:
If it works correctly, then you should see in the flow run the subject:
If everything is still good at that point, create a new variable with the substring that you want:
And again, check the value.
If you got to this point, then you should be able to retrieve the ticket id.
We're building a system to validate mobile phone numbers.
To achieve this, when a user adds his number, we are sending him a text message with a 6 digit code.
We don't want this code to go in our database as we don't like to clutter our database with fields that have no business meaning.
So we came up with the idea to reuse pragmarx/google2falibrary, have it generate an OTP code, dispatch it to the user by a text message, and then the circle would be round.
So basically we wanted to use the phone number, prefixed by somehting secret as the "secret" for the pragmarx/google2fa library:
$secret = '1263' . $mobile->country_code . $mobile->subscriber;
$google2fa = new Google2FA();
$google2fa->setEnforceGoogleAuthenticatorCompatibility(false);
$google2fa->getCurrentOtp($secret);
The above results in a secretsimilar to 12633232970987. However, the call to getCurrentOtp throws an exception Invalid characters in the base32 string. which is obviously not what I was hoping for.
So, I tried adding
$secret = base_convert($secret, 10, 32)
and pass that to the getCurrentOtpmethod, but that returned the same error. Checking into the library code, I see the following constant:
const VALID_FOR_B32 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567';
My base_convert returns a string that has other characters in there though. Are these really the only valid characters?
My alternative would be to just have the library generate a random secret, but we don't really want to do that, as that would require us to keep that secret somewhere in the database (or at least in cache), which we would like to avoid. The idea is that we could generate the code for a mobile number using the number as the secret, and let the OTP mechanism deal with expiring codes.
Anyone has any suggestion how I can resolve this?
I'm stuck on an error in my App Inventor 2 application. I' m using three checkboxes, so the user to pass values to a timer interval in a clock component.
The values are stored in a variable as a list of three values of miliseconds (e.g. 1600, 1800, 2000). I check in code when and which checkbox is checked and then pass it over to a TinyDB database as a tag.
Problem is that, in Do it and on the device running the app, I get the following error as title suggests.
Here is the coding blocks I've used so far:
Does anyone be kind enough to direct me to how solving this error? Is it possible to pass values to a clock component through this logic. I've used a listPicker with success sometime ago, but I need it done with a checkBoxes layout. Thank you all in advance for your answers.
[Edit1]
To overcome this error and before #Taifun's remarks and suggestions, I followed the variable path, to pass values in the timer interval field. Do not now if it is very efficient but it is working for now. Here is the coding blocks:
Bracket pairs like this () represent a list.
The operation TimerInterval cannot accept the arguments: [(1800)]
This is, what the error message is trying to tell you: You are trying to assign a list, which has the item 1800 inside, to the TimerInterval property of a clock component.
You should assign the value directly instead.
Also you should think about the default value: which value should be used, if the user did not store anything in TinyDB... You are currently using an empty string in the valueIfTagNotThere socket... This does not really make sense... A better value would be for example 1000 ... same for the else part in your if-then-else statement...
I want to use jquery validation to validate an user input. He has to insert his Steam Id (a thing of a online game) in a form and I want to validate it but I have no ideia how to do that.
The Steam id expression has to like this: STEAM_0:1:2131341411
The thing that is required is this: STEAM_0:
Then it is just numbers
STEAM:0:(number 1 or 0):(numbers)
Maximum of characters of 20.
I've tried to do a regex thing to put in the add.method function but I couldnt,
Thank you, I hope you've understood what I meant
Try this regular expression: /^STEAM_0:(0|1):[1-9]{1}[0-9]{0,19}$/