3
0
mirror of https://github.com/reality/dbot.git synced 2024-11-24 04:49:25 +01:00

Improved interpolatedQuote

This commit is contained in:
Daniel Evans 2012-03-12 21:00:17 +00:00
parent 7e0d6b05cd
commit d5197fbcd6

4
run.js
View File

@ -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<quoteRefs.length;i++) {
var cleanRef = this.cleanNick(quoteRefs[i].trim());