mirror of
https://github.com/reality/dbot.git
synced 2024-12-24 19:52:36 +01:00
quote locks
This commit is contained in:
parent
1f4c3fec8f
commit
a5960b8daf
@ -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.');
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -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])) {
|
||||
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) {
|
||||
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.');
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user