forked from GitHub/dbot
named rmlast
This commit is contained in:
parent
c413053a7b
commit
ece8974659
@ -18,16 +18,24 @@ var quotes = function(dbot) {
|
|||||||
|
|
||||||
'~rmlast': function(data, params) {
|
'~rmlast': function(data, params) {
|
||||||
if(rmAllowed == true) {
|
if(rmAllowed == true) {
|
||||||
var last = addStack.pop();
|
var q = data.message.valMatch(/^~rmlast ([\d\w\s]*)/, 2);
|
||||||
if(last) {
|
if(q) {
|
||||||
quotes[last].pop();
|
if(quotes.hasOwnProperty(q[1])) {
|
||||||
if(quotes[last] === undefined) {
|
var quote = quotes[q[1]].pop();
|
||||||
delete quotes[last];
|
dbot.say('\'' + quote + '\' removed from ' + q[1]);
|
||||||
|
rmAllowed = false;
|
||||||
|
} else {
|
||||||
|
dbot.say(data.channel, 'No quotes exist under ' + q[1]);
|
||||||
}
|
}
|
||||||
rmAllowed = false;
|
|
||||||
dbot.say(data.channel, 'Last quote removed from ' + last + '.');
|
|
||||||
} else {
|
} else {
|
||||||
dbot.say(data.channel, 'No quotes were added recently.');
|
var last = addStack.pop();
|
||||||
|
if(last) {
|
||||||
|
quotes[last].pop();
|
||||||
|
rmAllowed = false;
|
||||||
|
dbot.say(data.channel, 'Last quote removed from ' + last + '.');
|
||||||
|
} else {
|
||||||
|
dbot.say(data.channel, 'No quotes were added recently.');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
dbot.say(data.channel, 'No spamming that shit. Try again in a few minutes...');
|
dbot.say(data.channel, 'No spamming that shit. Try again in a few minutes...');
|
||||||
|
Loading…
Reference in New Issue
Block a user