diff options
-rw-r--r-- | news/newsbot.js | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/news/newsbot.js b/news/newsbot.js index 499f595a..55564f0f 100644 --- a/news/newsbot.js +++ b/news/newsbot.js @@ -228,10 +228,11 @@ methods.add = function (params, callback) { } } methods.del = function (params, callback) { - var slave = slaves[params[0]] - if (slave) { + var nick = params[0] + if (slaves.hasOwnProperty(nick)) { + var slave = slaves[nick] slave.client.disconnect() - delete slaves[params[0]] + delete slaves[nick] return callback(null) } else { return callback(new Error('botname not found')) |