mirror of
https://github.com/reality/dbot.git
synced 2024-12-25 04:02:39 +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) {
|
'modehate': function(data, params) {
|
||||||
dbot.db.modehate.push(params[1]);
|
dbot.db.modehate.push(params[1]);
|
||||||
dbot.say(data.channel, 'Now modehating on ' + 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);
|
var q = data.message.valMatch(/^~rmlast ([\d\w\s]*)/, 2);
|
||||||
if(q) {
|
if(q) {
|
||||||
if(quotes.hasOwnProperty(q[1])) {
|
if(quotes.hasOwnProperty(q[1])) {
|
||||||
|
if(!dbot.db.locks.include(q[1])) {
|
||||||
var quote = quotes[q[1]].pop();
|
var quote = quotes[q[1]].pop();
|
||||||
rmAllowed = false;
|
rmAllowed = false;
|
||||||
dbot.say(data.channel, '\'' + quote + '\' removed from ' + q[1]);
|
dbot.say(data.channel, '\'' + quote + '\' removed from ' + q[1]);
|
||||||
|
} else {
|
||||||
|
dbot.say(data.channel, param[1] + ' is locked. Commence incineration.');
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
dbot.say(data.channel, 'No quotes exist under ' + q[1]);
|
dbot.say(data.channel, 'No quotes exist under ' + q[1]);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
var last = addStack.pop();
|
var last = addStack.pop();
|
||||||
if(last) {
|
if(last) {
|
||||||
|
if(!dbot.db.locks.include(last)) {
|
||||||
quotes[last].pop();
|
quotes[last].pop();
|
||||||
rmAllowed = false;
|
rmAllowed = false;
|
||||||
dbot.say(data.channel, 'Last quote removed from ' + last + '.');
|
dbot.say(data.channel, 'Last quote removed from ' + last + '.');
|
||||||
|
} else {
|
||||||
|
dbot.say(data.channel, last + ' is locked. Commence incineration.');
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
dbot.say(data.channel, 'No quotes were added recently.');
|
dbot.say(data.channel, 'No quotes were added recently.');
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user