mirror of
https://github.com/reality/dbot.git
synced 2024-11-27 14:29:29 +01:00
Added ~link command. Links to the quote list page for that category.
This commit is contained in:
parent
23653665c2
commit
bb0af1951e
@ -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]);
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user