Skip to content

Commit 82aa0f9

Browse files
vishwacsenasgellock
authored andcommitted
13. basic bot - typescript (microsoft#387)
* Updates to readme, deployment scripts and bot file * consistency issues - module.exports changes to be consistent - commented out a stub of adapter.onTurnError - add placeholder bot config settings for AppInsights * Throws on missing luis configuration, fix for local .vs. prod * updates to lu files. * updates * Updates to lu files, removed custom prompts, cleanup bot * 13.echo bot typescript * fixing bot file * fixing up .lu, .luis and msbot clone recipes * removing keys from ts bot file. * bug fix.
1 parent 445f8fc commit 82aa0f9

File tree

30 files changed

+7512
-830
lines changed

30 files changed

+7512
-830
lines changed

javascript_nodejs/13.basic-bot/bot.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -187,14 +187,16 @@ class Bot {
187187
// see if we have any user name entities
188188
USER_NAME_ENTITIES.forEach(name => {
189189
if (luisResult.entities[name] !== undefined) {
190+
let lowerCaseName = luisResult.entities[name][0];
190191
// capitalize and set user name
191-
greetingState.name = luisResult.entities[name][0].replace(/^\w/, c => c.toUpperCase());
192+
greetingState.name = lowerCaseName.charAt(0).toUpperCase() + lowerCaseName.substr(1);
192193
}
193194
});
194195
USER_LOCATION_ENTITIES.forEach(city => {
195196
if (luisResult.entities[city] !== undefined) {
196-
// capitalize and set city
197-
greetingState.city = luisResult.entities[city][0].replace(/^\w/, c => c.toUpperCase());
197+
let lowerCaseCity = luisResult.entities[city][0];
198+
// capitalize and set user name
199+
greetingState.city = lowerCaseCity.charAt(0).toUpperCase() + lowerCaseCity.substr(1);
198200
}
199201
});
200202
// set the new values

0 commit comments

Comments
 (0)