diff --git a/modules/command/api.js b/modules/command/api.js index 0b5dd00..cac359d 100644 --- a/modules/command/api.js +++ b/modules/command/api.js @@ -6,12 +6,14 @@ var api = function(dbot) { * Does the user have the correct access level to use the command? */ 'hasAccess': function(event, command, callback) { + if(dbot.config.debugMode) { console.log('DEBUG: command -> api -> hasAccess called') var accessNeeded = dbot.commands[command].access, allowedNicks, user = event.rUser; console.log('DEBUG: command: ' + command); console.log('DEBUG: accessNeeded: ' + accessNeeded); + } //var accessNeeded = null; if(_.isUndefined(accessNeeded) || accessNeeded == null || accessNeeded == 'user') { return callback(true); diff --git a/modules/command/command.js b/modules/command/command.js index 756ee28..6479460 100644 --- a/modules/command/command.js +++ b/modules/command/command.js @@ -13,7 +13,9 @@ var command = function(dbot) { */ this.listener = function(event) { var commandName = event.params[0]; + if(dbot.config.debugMode) { console.log('DEBUG: listener commandName: ' + commandName) + } if(commandName.charAt(0) != this.config.commandPrefix || this.config.passiveMode == true) { return; } else @@ -66,8 +68,10 @@ var command = function(dbot) { this.api.hasAccess(event, commandName, function(hasAccess) { + if(dbot.config.debugMode) { console.log('DEBUG: command -> api.hasAccess initiated') console.log('DEBUG: commandName: ' + commandName) + } dbot.api.ignore.isUserIgnoring(event.rUser, commandName, function(isIgnoring) { dbot.api.ignore.isUserBanned(event.rUser, commandName, function(isBanned) { diff --git a/modules/link/link.js b/modules/link/link.js index 1b3bdc9..4fa3743 100644 --- a/modules/link/link.js +++ b/modules/link/link.js @@ -213,7 +213,9 @@ var link = function(dbot) { var urlMatches = event.message.match(this.urlRegex); if(urlMatches !== null) { this.links[event.channel.name] = urlMatches[0]; + if(dbot.config.debugMode) { console.log('DEBUG: got a link'); + } if(this.config.autoTitle == true) { this.api.parseLink(urlMatches[0], function(result) { event.reply(result); diff --git a/modules/quotes/quotes.js b/modules/quotes/quotes.js index 096984a..9724e94 100644 --- a/modules/quotes/quotes.js +++ b/modules/quotes/quotes.js @@ -105,7 +105,9 @@ var quotes = function(dbot) { if(removeRefs) { quotes = _.filter(quotes, function(q) { + if(dbot.config.debugMode) { console.log('DEBUG (if removeRefs): ' + removeRefs + quotes + key) + } return !q.match('~~'+key+'~~'); }); } @@ -119,7 +121,9 @@ var quotes = function(dbot) { }, 'getInterpolatedQuote': function(server, channel, username, key, callback) { + if(dbot.config.debugMode) { console.log('DEBUG: ' + channel + ' ' + username + ' ' + key) + } key = key.trim().toLowerCase(), this.api.getQuote(key, function(quote) { @@ -127,19 +131,25 @@ var quotes = function(dbot) { this.internalAPI.interpolatedQuote(server, channel, username, key, quote, callback); } else { + if(dbot.config.debugMode) { console.log('DEBUG (else callback quote): ' + quote) + } callback(quote); } }.bind(this)); }, 'getQuoteCategory': function(key, callback) { + if(dbot.config.debugMode) { console.log('DEBUG: ' + key) + } var category = false, key = key.trim().toLowerCase(); this.db.search('quote_category', { 'name': key }, function(result) { + if(dbot.config.debugMode) { console.log('DEBUG: ' + key + ' ' + result) + } category = result; }, function(err) { callback(category); @@ -149,7 +159,9 @@ var quotes = function(dbot) { 'getCategoryKeys': function(callback) { var keys = []; this.db.scan('quote_category', function(result) { + if(dbot.config.debugMode) { console.log('DEBUG: ' + result) + } if(result) keys.push(result.name); }, function(err) { callback(keys);