3
0
mirror of https://github.com/reality/dbot.git synced 2024-11-23 20:39:25 +01:00

Merge pull request #4 from ziaix/patch-links

Added ~link command. Links to the quote list page for that category.
This commit is contained in:
Luke Slater 2011-11-08 05:55:06 -08:00
commit f49c947ef2

View File

@ -93,13 +93,18 @@ var quotes = function(dbot) {
q[1] = q[1].toLowerCase();
if(!Object.isArray(quotes[q[1]])) {
quotes[q[1]] = [];
} else {
if (q2 in quotes[q[1]]) {
dbot.say(data.channel, 'Quote already in DB. Initiate incineration.');
return;
}
}
quotes[q[1]].push(q[2]);
addStack.push(q[1]);
rmAllowed = true;
dbot.say(data.channel, 'Quote saved in \'' + q[1] + '\' (' + quotes[q[1]].length + ')');
} else {
dbot.say(data.channel, 'Invalid syntax, initiate incineration.');
dbot.say(data.channel, 'Invalid syntax. Initiate incineration.');
}
},
@ -128,6 +133,14 @@ var quotes = function(dbot) {
'~d': function(data, params) {
dbot.say(data.channel, data.user + ': ' + dbot.db.quoteArrs['depressionbot'].random());
},
'~link': function(data, params) {
if(params[1] === undefined || !quotes.hasOwnProperty(params[1])) {
dbot.say(data.channel, 'Syntax error. Commence incineration.');
} else {
dbot.say(data.channel, 'Link to "'+params[1]+'" - http://nc.no.de:443/quotes/'+params[1]);
}
}
};