【问题标题】:While deploy chat bot on Azure , Auto Welcome Message doesn't work?在 Azure 上部署聊天机器人时,自动欢迎消息不起作用?
【发布时间】:2019-09-19 09:02:38
【问题描述】:
【问题讨论】:
标签:
azure
deployment
frameworks
botframework
chatbot
【解决方案1】:
我只是将 member.id 检查的条件更改为 === 而不是 !== 并为模拟器和网络聊天修复了它。除了这些渠道之外,我的一个机器人在 Teams 中运行,在这种情况下它不会给我欢迎消息,这是我想要和期望的。这是我的 bot.js 文件中的代码。
this.onMembersAdded(async (context, next) => {
const membersAdded = context.activity.membersAdded;
for (let member of membersAdded) {
if (member.id === context.activity.recipient.id) {
await context.sendActivity(welcomeMessage);
}
}
// By calling next() you ensure that the next BotHandler is run.
await next();
});