From d5197fbcd6e8875eb3eb8e80b4bed16ea2c140b1 Mon Sep 17 00:00:00 2001 From: Daniel Evans Date: Mon, 12 Mar 2012 21:00:17 +0000 Subject: [PATCH] Improved interpolatedQuote --- run.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/run.js b/run.js index 0390b3f..8401192 100644 --- a/run.js +++ b/run.js @@ -64,8 +64,8 @@ var DBot = function(timers) { // Retrieve a random quote from a given category, interpolating any quote references (~~QUOTE CATEGORY~~) within it DBot.prototype.interpolatedQuote = function(key) { var quoteString = this.db.quoteArrs[key].random(); - var quoteRefs = quoteString.match(/~~([\d\w\s-]*)~~/); - if (quoteRefs) { + var quoteRefs; + while( (quoteRefs = quoteString.match(/~~([\d\w\s-]*)~~/)) ) { quoteRefs = quoteRefs.slice(1); for(var i=0;i