Fixed logging and added check for whois query failure

This commit is contained in:
lanxu 2019-05-15 21:21:27 +03:00
parent e3f9491dcc
commit 68d9d39b00

11
app.js
View File

@ -27,7 +27,7 @@ var logger = new (winston.Logger)({
new (winston.transports.Console)(),
new (winston.transports.DailyRotateFile)({
filename: logDirectory + '/ircbot.log',
datePattern: '.yyyy-MM-dd',
datePattern: 'YYYY-MM-DD',
maxsize: 20000
})
]
@ -41,7 +41,7 @@ if(!config.irc.connect) {
var isConnected = false
// Start client
var client = new irc.Client(config.irc.server, config.irc.nick, {
debug: true,
debug: false,
channels: config.irc.channels,
//floodProtection: true,
//sasl: true,
@ -100,10 +100,11 @@ client.addListener('join', function(channel, who) {
for(var memberNick in members) {
var member = members[memberNick];
if(result.host.match(member.host) && result.user.match(member.user)) {
client.send('MODE', channel, '+o', result.nick);
if(typeof result.host !== 'undefined' && typeof result.user !== 'undefined') {
if(result.host.match(member.host) && result.user.match(member.user)) {
client.send('MODE', channel, '+o', result.nick);
}
}
}
});