diff --git a/modules/admin.js b/modules/admin.js index aa83e68..5898955 100644 --- a/modules/admin.js +++ b/modules/admin.js @@ -36,7 +36,6 @@ var adminCommands = function(dbot) { }, 'unload': function(data, params) { - console.log(dbot.moduleNames); if(dbot.moduleNames.include(params[1])) { dbot.moduleNames[params[1]] = undefined; dbot.reloadModules(); @@ -44,6 +43,14 @@ var adminCommands = function(dbot) { } else { dbot.say(data.channel, 'Module ' + params[1] + ' isn\'t loaded... Idiot...'); } + }, + + 'ban': function(data, params) { + if(dbot.db.bans[params[2]] === undefined) { + dbot.db.bans[params[2]] = [ params[1] ]; + } else { + dbot.db.bans[params[2]].push(params[1]); + } } }; diff --git a/modules/quotes.js b/modules/quotes.js index c60efab..a93717e 100644 --- a/modules/quotes.js +++ b/modules/quotes.js @@ -16,7 +16,7 @@ var quotes = function(dbot) { } }, - /*'~rmlast': function(data, params) { + '~rmlast': function(data, params) { if(rmAllowed == true || data.user == dbot.admin) { var q = data.message.valMatch(/^~rmlast ([\d\w\s]*)/, 2); if(q) { @@ -40,7 +40,7 @@ var quotes = function(dbot) { } else { dbot.say(data.channel, 'No spamming that shit. Try again in a few minutes...'); } - },*/ + }, '~qcount': function(data, params) { var q = data.message.valMatch(/^~qcount ([\d\w\s]*)/, 2); diff --git a/run.js b/run.js index 09aed44..237eba6 100644 --- a/run.js +++ b/run.js @@ -14,9 +14,8 @@ var DBot = function(dModules, timers) { this.instance = jsbot.createJSBot(this.name, 'irc.aberwiki.org', 6667, this, function() { this.instance.join('#realitest'); - this.instance.join('#lolhax'); - this.instance.join('#itonlygetsworse'); this.instance.join('#42'); + this.instance.join('#itonlygetsworse'); }.bind(this)); this.moduleNames = dModules; @@ -86,7 +85,15 @@ DBot.prototype.reloadModules = function() { if(data.channel == this.name) data.channel = data.user; if(this.commands.hasOwnProperty(params[0])) { - this.commands[params[0]](data, params); + if(this.moduleNames.include('admin') && this.db.bans.hasOwnProperty(params[0])) { + if(this.db.bans[params[0]].include(data.user)) + this.say(data.channel, data.user + ' is banned from using this command. Commence incineration.'); + else { + this.commands[params[0]](data, params); + } + } else { + this.commands[params[0]](data, params); + } this.save(); } else { var q = data.message.valMatch(/^~([\d\w\s]*)/, 2);