发送有关会话更新事件Node.js的打字指示器

时间:2018-09-12 15:01:12

标签: node.js botframework

我正在尝试在sessionUpdate上发送键入指示符,但对我来说 session.sendTyping()仅在对话框中起作用。至少我在Webchat和BotEmulator频道中尝试过,但没有成功。关于如何实现此目标的任何想法?

这是我的尝试:

bot.on('conversationUpdate', async (message) => {
if (message.membersAdded) {
    for (let identity of message.membersAdded) {
        if (identity.id === message.address.bot.id) {
            const replies = getGreetingReplies(message);
            cosmosDB.writeOnConvUpdate({ userMessage: message, botMessage: replies[0] }, message.address.conversation.id);

            bot.loadSession(message.address, async (err, session) => {
                for (let reply of replies) {
                    //var msg = new builder.Message().address(message.address).text('');
                    //msg.type = 'Typing';
                    //bot.send(msg);
                    await utilities.SendTyping(session, 3000);
                    bot.send(reply);
                }
            });

        }
    }    
}});

0 个答案:

没有答案