-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updated LKG build, unit tests, and package.json version.
- Loading branch information
Showing
15 changed files
with
306 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
var session = require('./Session'); | ||
var Message = (function () { | ||
function Message() { | ||
} | ||
Message.prototype.setLanguage = function (language) { | ||
var m = this; | ||
m.language = language; | ||
return this; | ||
}; | ||
Message.prototype.setText = function (ses, msg) { | ||
var args = []; | ||
for (var _i = 2; _i < arguments.length; _i++) { | ||
args[_i - 2] = arguments[_i]; | ||
} | ||
var m = this; | ||
args.unshift(msg); | ||
m.text = session.Session.prototype.gettext.apply(ses, args); | ||
return this; | ||
}; | ||
Message.prototype.setNText = function (ses, msg, msg_plural, count) { | ||
var m = this; | ||
m.text = ses.ngettext(msg, msg_plural, count); | ||
return this; | ||
}; | ||
Message.prototype.addAttachment = function (attachment) { | ||
var m = this; | ||
if (!m.attachments) { | ||
m.attachments = []; | ||
} | ||
m.attachments.push(attachment); | ||
return this; | ||
}; | ||
Message.prototype.setChannelData = function (data) { | ||
var m = this; | ||
m.channelData = data; | ||
return this; | ||
}; | ||
return Message; | ||
})(); | ||
exports.Message = Message; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
08fa258
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @Stevenic ,
Thanks, this validatedPrompt is a game-changer for smart dialog flows !
But ..in order to setup a 'smart' bot, I'd like the bot to answer different messages in different error cases
something like
how is it possible using this validatedPrompt ? (or : is retryPrompt modifiable from inside validator function ?)
08fa258
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's part of the reason I'm planning to replace validatedPrompt() with a whole new custom prompt system. You can't currently dynamically change the retry prompt like you'd like to. With custom prompts you'll be able to do anything you want. For now you can't use a validatedPrompt() to do what you want. You'll need to use a waterfall that calls Prompts.text() to get the users raw text input. Youll need to validate it in the next step of the waterfall and if it's invalid you'll need to reload your dialog using session.replaceDialog()
08fa258
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was afraid you'd say so !
Well, this future customPrompt is for the better good then !
For now, it would be a bit cumbersome to handle this with a waterfall dialog : replaceDialog to the start would run all the welcoming sequence again, so I should set "stepX flags" to see if welcome message for each steps must be displayed ..
so I'll stick with a generic error message in the mean time :)