diff --git a/modules/quotes/commands.js b/modules/quotes/commands.js index 86cf45b..6cda060 100644 --- a/modules/quotes/commands.js +++ b/modules/quotes/commands.js @@ -86,7 +86,7 @@ var commands = function(dbot) { event.reply(dbot.t('search_results', { 'category': haystack, 'needle': needle, - 'quote': matches.random(), + 'quote': matches[0], 'matches': matches.length })); } diff --git a/run.js b/run.js index 97667cb..48ad4d5 100644 --- a/run.js +++ b/run.js @@ -113,7 +113,7 @@ DBot.prototype.save = function() { // Hot-reload module files. DBot.prototype.reloadModules = function() { if(this.modules) { // Run 'onDestroy' code for each module if it exists. - this.modules.each(function(module) { + _.each(this.modules, function(module) { if(module.onDestroy) { module.onDestroy(); } diff --git a/snippets.js b/snippets.js index f8fcfe4..b552bf3 100644 --- a/snippets.js +++ b/snippets.js @@ -1,9 +1,5 @@ /*** Array ***/ -Array.prototype.random = function() { - return this[Math.floor((Math.random()*this.length))]; -}; - Array.prototype.each = function(fun) { for(var i=0;i