Fixed message sending

master
lanxu 2019-11-20 22:38:03 +02:00
parent ed800dbd81
commit 912ba3b711
1 changed files with 8 additions and 2 deletions

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) {
logger.info(from + ' => ' + to + ': ' + message)
pluginManager.testPlugins(message).then(function (results) {
pluginManager.testPlugins(message).then((results) => {
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) {
logger.error('Plugin error: ', error)