3
0
mirror of https://github.com/reality/dbot.git synced 2024-11-30 16:09:27 +01:00
This commit is contained in:
Luke Slater 2011-10-09 16:15:44 +01:00
parent b278c1dd14
commit 821d8407c1

View File

@ -46,12 +46,21 @@ var adminCommands = function(dbot) {
}, },
'ban': function(data, params) { 'ban': function(data, params) {
if(dbot.db.bans[params[2]] === undefined) { if(dbot.db.bans.hasOwnProperty(params[2])) {
dbot.db.bans[params[2]] = [ params[1] ]; dbot.db.bans[params[2]] = [ params[1] ];
} else { } else {
dbot.db.bans[params[2]].push(params[1]); dbot.db.bans[params[2]].push(params[1]);
} }
dbot.say(data.channel, params[1] + ' banned from ' + params[2]); dbot.say(data.channel, params[1] + ' banned from ' + params[2]);
},
'unban': function(data, params) {
if(dbot.db.bans.hasOwnProperty(params[2]) && dbot.db.bans[params[2]].include(params[1])) {
dbot.db.bans[params[2]].splice(dbot.db.bans[params[2]].indexOf(params[1]), 1);
dbot.say(data.channel, params[1] + ' unbanned from ' + params[2]);
} else {
dbot.say(data.channel, 'It appears ' + params[1] + 'wasn\'t banned from that command, you fool.');
}
} }
}; };