3
0
mirror of https://github.com/reality/dbot.git synced 2024-11-27 22:39:26 +01:00

Merge pull request #30 from danharibo/master

Made it work better
This commit is contained in:
Luke Slater 2012-03-12 14:20:17 -07:00
commit 60ec15803c

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 // Retrieve a random quote from a given category, interpolating any quote references (~~QUOTE CATEGORY~~) within it
DBot.prototype.interpolatedQuote = function(key) { DBot.prototype.interpolatedQuote = function(key) {
var quoteString = this.db.quoteArrs[key].random(); var quoteString = this.db.quoteArrs[key].random();
var quoteRefs = quoteString.match(/~~([\d\w\s-]*)~~/); var quoteRefs;
if (quoteRefs) { while( (quoteRefs = quoteString.match(/~~([\d\w\s-]*)~~/)) ) {
quoteRefs = quoteRefs.slice(1); quoteRefs = quoteRefs.slice(1);
for(var i=0;i<quoteRefs.length;i++) { for(var i=0;i<quoteRefs.length;i++) {
var cleanRef = this.cleanNick(quoteRefs[i].trim()); var cleanRef = this.cleanNick(quoteRefs[i].trim());