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:
commit
f49c947ef2
@ -93,13 +93,18 @@ var quotes = function(dbot) {
|
|||||||
q[1] = q[1].toLowerCase();
|
q[1] = q[1].toLowerCase();
|
||||||
if(!Object.isArray(quotes[q[1]])) {
|
if(!Object.isArray(quotes[q[1]])) {
|
||||||
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]);
|
quotes[q[1]].push(q[2]);
|
||||||
addStack.push(q[1]);
|
addStack.push(q[1]);
|
||||||
rmAllowed = true;
|
rmAllowed = true;
|
||||||
dbot.say(data.channel, 'Quote saved in \'' + q[1] + '\' (' + quotes[q[1]].length + ')');
|
dbot.say(data.channel, 'Quote saved in \'' + q[1] + '\' (' + quotes[q[1]].length + ')');
|
||||||
} else {
|
} 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) {
|
'~d': function(data, params) {
|
||||||
dbot.say(data.channel, data.user + ': ' + dbot.db.quoteArrs['depressionbot'].random());
|
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