我正在尝试使用Botkit Anywhere和Node.js构建聊天机器人。我不想使用任何第三方消息平台。我参考了这个链接https://github.com/howdyai/botkit#build-your-bot,并尝试在Node.js应用程序中设置聊天机器人:
首先,将其添加到您的项目中: npm install --save botkit
然后,在您的应用程序代码中添加Botkit: var Botkit = require('botkit'); var controller = Botkit.anywhere(configuration); controller.hears('hello','direct_message', function(bot, message) { bot.reply(message,'Hello yourself!'); });
但是他们没有提到如何调用以及在现有应用程序中的何处调用此代码。
首先,将其添加到您的项目中: npm install --save botkit
然后,在您的应用程序代码中添加Botkit: var Botkit = require('botkit'); var controller = Botkit.anywhere(configuration); controller.hears('hello','direct_message', function(bot, message) { bot.reply(message,'Hello yourself!'); });
但是他们没有提到如何调用以及在现有应用程序中的何处调用此代码。