3
0
mirror of https://github.com/reality/dbot.git synced 2024-12-24 03:33:07 +01:00

quote locks

This commit is contained in:
Luke Slater 2011-10-14 13:24:18 +01:00
parent 1f4c3fec8f
commit a5960b8daf
2 changed files with 19 additions and 6 deletions

View File

@ -66,6 +66,11 @@ var adminCommands = function(dbot) {
'modehate': function(data, params) {
dbot.db.modehate.push(params[1]);
dbot.say(data.channel, 'Now modehating on ' + params[1]);
},
'lock': function(data, params) {
dbot.db.locks.push(params[1]);
dbot.say(data.channel, 'Locked ' + params[1] + ' quotes.');
}
};

View File

@ -46,18 +46,26 @@ var quotes = function(dbot) {
var q = data.message.valMatch(/^~rmlast ([\d\w\s]*)/, 2);
if(q) {
if(quotes.hasOwnProperty(q[1])) {
var quote = quotes[q[1]].pop();
rmAllowed = false;
dbot.say(data.channel, '\'' + quote + '\' removed from ' + q[1]);
if(!dbot.db.locks.include(q[1])) {
var quote = quotes[q[1]].pop();
rmAllowed = false;
dbot.say(data.channel, '\'' + quote + '\' removed from ' + q[1]);
} else {
dbot.say(data.channel, param[1] + ' is locked. Commence incineration.');
}
} else {
dbot.say(data.channel, 'No quotes exist under ' + q[1]);
}
} else {
var last = addStack.pop();
if(last) {
quotes[last].pop();
rmAllowed = false;
dbot.say(data.channel, 'Last quote removed from ' + last + '.');
if(!dbot.db.locks.include(last)) {
quotes[last].pop();
rmAllowed = false;
dbot.say(data.channel, 'Last quote removed from ' + last + '.');
} else {
dbot.say(data.channel, last + ' is locked. Commence incineration.');
}
} else {
dbot.say(data.channel, 'No quotes were added recently.');
}