Skip to content

Instantly share code, notes, and snippets.

@jazzedge
Created July 8, 2017 13:20
Show Gist options
  • Save jazzedge/daddffcb96a59ca04908c631e1b39ef7 to your computer and use it in GitHub Desktop.
Save jazzedge/daddffcb96a59ca04908c631e1b39ef7 to your computer and use it in GitHub Desktop.
Bot Recognizer
// Setup help system
bot.recognizer(new builder.RegExpRecognizer('HelpIntent', /^(help|options)/i));
bot.dialog('helpDialog', function (session, args) {
switch (args.action) {
default:
// args.action is '*:/help' indicating the triggerAction() was matched
session.endDialog("You can say 'flip a coin' or 'roll dice'.");
break;
case 'flipCoinHelp':
session.endDialog("Say 'heads' or 'tails'.");
break;
case 'rollDiceHelp':
session.endDialog("Say the number of dice you'd like rolled.");
break;
}
}).triggerAction({ matches: 'HelpIntent' });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment