Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bot.dialog('/end', function (session) {
- session.endConversation("End Conversation");
- }).triggerAction({ matches: /^(exit)|(quit)/i });
- session.clearDialogStack()
- session.reset();
- session.endDialog();
- export interface IResetDataSettings {
- resetCommand: RegExp;
- }
- export class ResetMiddleware {
- public static data(settings: IResetDataSettings): IMiddlewareMap {
- return {
- botbuilder: (session, next) => {
- if (settings.resetCommand && session.message.text && settings.resetCommand.test(session.message.text)) {
- session.userData = {};
- session.conversationData = {};
- session.privateConversationData = {};
- session.endConversation("Your conversation state was reset.");
- } else {
- next();
- }
- }
- };
- }
- }
- this.bot.use(ResetMiddleware.data({ resetCommand: /^reset data$/i }));
- delete session.userData;
Add Comment
Please, Sign In to add comment