本文整理汇总了TypeScript中botbuilder.Session类的典型用法代码示例。如果您正苦于以下问题:TypeScript Session类的具体用法?TypeScript Session怎么用?TypeScript Session使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Session类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: getIlvl
private getIlvl(session: Session, args, next) {
var charData = session.dialogData.character;
console.log('getilvl', charData);
if (!charData.name) {
session.send('No name given ...');
} else if (!charData.realm) {
session.send('No realm given ...');
} else {
console.log('got data, sending it to battle net');
bnet.wow.character.items({
origin: 'eu',
realm: 'antonidas',
name: 'hoazl'
}, function (err, data) {
if (err) {
console.log('Error!', err);
session.send('An error occured ..');
} else {
console.log('got data from battle net');
session.send(data);
}
});
}
}
示例2: return
return (session: Session, args?: any) => {
const locale = session.preferredLocale();
const dialogId = `confirmation-${locale}`;
if (!bot.dialog(dialogId)) {
bot.dialog(dialogId, createLocalizedDialog(locale, bot.instrumentation));
}
session.replaceDialog(dialogId, args);
};
示例3: return
return (session: Session, args?: any) => {
const locale = session.preferredLocale();
const dialogId = `faq-${locale}`;
if (!bot.library.dialog(dialogId)) {
bot.library.dialog(dialogId, createLocalizedDialog(bot, locale));
}
session.replaceDialog(dialogId, args);
};
示例4: getSuggestedActions
function getSuggestedActions(session: Session): SuggestedActions {
const yes = session.localizer.gettext(session.preferredLocale(), 'confirmation.yesOption');
const no = session.localizer.gettext(session.preferredLocale(), 'confirmation.noOption');
const cancel = session.localizer.gettext(session.preferredLocale(), 'confirmation.cancelOption');
return SuggestedActions.create(session, [
CardAction.imBack(session, yes, yes),
CardAction.imBack(session, no, no),
CardAction.imBack(session, cancel, cancel)]);
}
示例5: getSuggestedActions
function getSuggestedActions(session: Session): SuggestedActions {
const faq = session.localizer.gettext(session.preferredLocale(), 'master.faqOption');
const feedback = session.localizer.gettext(session.preferredLocale(), 'master.feedbackOption');
const complaints = session.localizer.gettext(session.preferredLocale(), 'master.complaintsOption');
const language = session.localizer.gettext(session.preferredLocale(), 'master.languageOption');
return SuggestedActions.create(session, [
CardAction.imBack(session, faq, faq),
CardAction.imBack(session, feedback, feedback),
CardAction.imBack(session, complaints, complaints),
CardAction.imBack(session, language, language)]);
}
示例6: whatNow
(session: Session, luisResults: IIntentRecognizerResult) => {
const topIntent = luisResults.intent;
const selectedBot = bot.childBots.find(bot => `child.${bot.library.name.toLowerCase()}` === topIntent);
if (selectedBot) {
session.beginDialog(`${selectedBot.library.name}:/`);
} else {
bot.instrumentation.trackCustomEvent('MBFEvent.CustomEvent.Unknown', { text: session.message.text, luisResults: luisResults }, session);
session.send('master.unknown');
whatNow(session);
}
},
示例7: switch
(session: Session, results: IDialogResult<any>) => {
switch (results.response) {
case true:
session.send('faq.finishConfirmed');
session.endDialog();
break;
default:
session.send('faq.finishUnconfirmed');
whatNow(library, session);
break;
}
}
示例8: onBegin
function onBegin(session: Session, args: any, next: () => void) {
if (args && args.languageChanged) {
session.send('master.languageModified');
whatNow(session);
} else {
next();
}
}
示例9: function
}, function (err, data) {
if (err) {
console.log('Error!', err);
session.send('An error occured ..');
} else {
console.log('got data from battle net');
session.send(data);
}
});
示例10: createLocalizedDialog
session.preferredLocale(locale, (err: Error) => {
const dialogId = `masterRoot-${locale}`;
if (!bot.dialog(dialogId)) {
bot.dialog(dialogId, createLocalizedDialog(bot, locale));
}
session.replaceDialog(dialogId, args);
});