Fixed message sending

This commit is contained in:
lanxu 2019-11-20 22:38:03 +02:00
parent ed800dbd81
commit 912ba3b711

10
app.js
View File

@ -32,9 +32,15 @@ var client = new irc.Client(config.irc.server, config.irc.nick, {
var handleMessage = function (from, to, message) { var handleMessage = function (from, to, message) {
logger.info(from + ' => ' + to + ': ' + message) logger.info(from + ' => ' + to + ': ' + message)
pluginManager.testPlugins(message).then(function (results) { pluginManager.testPlugins(message).then((results) => {
for (var i = 0; i < results.length; i++) { for (var i = 0; i < results.length; i++) {
client.say(to, results[i]) logger.info('BOT => ' + results[i].to + ': ' + message)
// TODO handle TO (nick/channel
if (results[i].to === 'nick') {
to = from
}
client.say(to, results[i].message)
} }
}, function (error) { }, function (error) {
logger.error('Plugin error: ', error) logger.error('Plugin error: ', error)