mirror of
https://github.com/reality/dbot.git
synced 2025-01-12 13:12:41 +01:00
params argument was being passed as the quoteTree, breaking quotes FOREVER
This commit is contained in:
parent
a6024c9b7d
commit
eedbe1f287
@ -4,7 +4,7 @@ var quotes = function(dbot) {
|
|||||||
var rmAllowed = true;
|
var rmAllowed = true;
|
||||||
|
|
||||||
// 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
|
||||||
var interpolatedQuote = function(key, quoteTree, params) {
|
var interpolatedQuote = function(key, quoteTree) {
|
||||||
if(quoteTree !== undefined && quoteTree.indexOf(key) != -1) {
|
if(quoteTree !== undefined && quoteTree.indexOf(key) != -1) {
|
||||||
return '';
|
return '';
|
||||||
} else if(quoteTree === undefined) {
|
} else if(quoteTree === undefined) {
|
||||||
@ -51,7 +51,7 @@ var quotes = function(dbot) {
|
|||||||
q[1] = q[1].trim();
|
q[1] = q[1].trim();
|
||||||
key = q[1].toLowerCase();
|
key = q[1].toLowerCase();
|
||||||
if(quotes.hasOwnProperty(key)) {
|
if(quotes.hasOwnProperty(key)) {
|
||||||
dbot.say(data.channel, q[1] + ': ' + interpolatedQuote(key, params));
|
dbot.say(data.channel, q[1] + ': ' + interpolatedQuote(key));
|
||||||
} else {
|
} else {
|
||||||
dbot.say(data.channel, 'Nobody loves ' + q[1]);
|
dbot.say(data.channel, 'Nobody loves ' + q[1]);
|
||||||
}
|
}
|
||||||
@ -232,11 +232,11 @@ var quotes = function(dbot) {
|
|||||||
|
|
||||||
'~rq': function(data, params) {
|
'~rq': function(data, params) {
|
||||||
var rQuote = Object.keys(quotes).random();
|
var rQuote = Object.keys(quotes).random();
|
||||||
dbot.say(data.channel, rQuote + ': ' + interpolatedQuote(rQuote, params));
|
dbot.say(data.channel, rQuote + ': ' + interpolatedQuote(rQuote));
|
||||||
},
|
},
|
||||||
|
|
||||||
'~d': function(data, params) {
|
'~d': function(data, params) {
|
||||||
dbot.say(data.channel, data.user + ': ' + interpolatedQuote(dbot.name, params));
|
dbot.say(data.channel, data.user + ': ' + interpolatedQuote(dbot.name));
|
||||||
},
|
},
|
||||||
|
|
||||||
'~link': function(data, params) {
|
'~link': function(data, params) {
|
||||||
|
Loading…
Reference in New Issue
Block a user