diff --git a/lib/bot.js b/lib/bot.js index 606c3bb9..15ef052a 100644 --- a/lib/bot.js +++ b/lib/bot.js @@ -31,6 +31,7 @@ class Bot { this.nickname = options.nickname; this.ircOptions = options.ircOptions; this.discordToken = options.discordToken; + this.rawLog = options.rawLog === true; this.commandCharacters = options.commandCharacters || []; this.ircNickColor = options.ircNickColor !== false; // default to true this.channels = _.values(options.channelMapping); @@ -80,6 +81,7 @@ class Bot { this.invertedMapping = _.invert(this.channelMapping); this.autoSendCommands = options.autoSendCommands || []; + logger.add(logger.transports.File, { filename: './logs/log.log' }); } connect() { @@ -118,6 +120,8 @@ class Bot { } } + logger.info('Trying to connect to irc'); + logger.info(`${this.server}, ${this.nickname}`); this.ircClient = new irc.Client(this.server, this.nickname, ircOptions); this.attachListeners(); } @@ -139,6 +143,12 @@ class Bot { logger.error('Received error event from IRC', error); }); + if (this.rawLog) { + this.ircClient.on('raw', (message) => { + logger.info(message); + }); + } + this.discord.on('error', (error) => { logger.error('Received error event from Discord', error); });