我正在使用NodeJS构建SlackBot。
我目前正在使用这个库slackbots,但问题是在初始化之后,僵尸程序没有出现在Apps类别中,但是它在SlackBot内部并且每次我输入它返回错误消息的消息:
I'm sorry, I don't understand! Sometimes I have an easier time with a few simple keywords. Or you can head to our wonderful Help Center for more assistance!
如何让机器人Hugo与Slack内部的SlackBot分开?
我是如何设置的:
var SlackBot = require('slackbots');
var bot = new SlackBot({
token: process.env.SLACK_TOKEN,
name: 'Hugo'
});
function get() {
return bot;
}
exports.get = function() {
return bot;
}
exports.send_message = function(user_ref, message) {
bot.postMessage(user_ref, message).then((data) => {
return data;
});
}
exports.get_users = function() {
var user_list = get().getUsers();
return user_list;
}
这就是我发送测试信息的方式:
var bot = require('./modules/bot.js');
bot.get().on('message', function(data) {
console.log("#######################################"); // -> debug only
console.log(data);
console.log("#######################################");
bot.send_message('USER_ID', 'test response');
});