Created
July 8, 2017 13:21
-
-
Save jazzedge/df3f81d58467e9a8c2337e6629ad97e9 to your computer and use it in GitHub Desktop.
Bot check if dialog already active
This file contains hidden or 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
// https://github.com/Microsoft/BotBuilder/blob/master/Node/examples/basics-help/apps.js | |
function switchTasks(session, args, next, alreadyActiveMessage) { | |
// Check to see if we're already active. | |
// - We're assuming that we're being called from a triggerAction() some | |
// args.action is the fully qualified dialog ID. | |
var stack = session.dialogStack(); | |
if (builder.Session.findDialogStackEntry(stack, args.action) >= 0) { | |
session.send(alreadyActiveMessage); | |
} else { | |
// Clear stack and switch tasks | |
session.clearDialogStack(); | |
next(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment