forked from GitHub/dbot
ban
This commit is contained in:
parent
d9f3099b70
commit
3f13de4780
@ -36,7 +36,6 @@ var adminCommands = function(dbot) {
|
|||||||
},
|
},
|
||||||
|
|
||||||
'unload': function(data, params) {
|
'unload': function(data, params) {
|
||||||
console.log(dbot.moduleNames);
|
|
||||||
if(dbot.moduleNames.include(params[1])) {
|
if(dbot.moduleNames.include(params[1])) {
|
||||||
dbot.moduleNames[params[1]] = undefined;
|
dbot.moduleNames[params[1]] = undefined;
|
||||||
dbot.reloadModules();
|
dbot.reloadModules();
|
||||||
@ -44,6 +43,14 @@ var adminCommands = function(dbot) {
|
|||||||
} else {
|
} else {
|
||||||
dbot.say(data.channel, 'Module ' + params[1] + ' isn\'t loaded... Idiot...');
|
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]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ var quotes = function(dbot) {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/*'~rmlast': function(data, params) {
|
'~rmlast': function(data, params) {
|
||||||
if(rmAllowed == true || data.user == dbot.admin) {
|
if(rmAllowed == true || data.user == dbot.admin) {
|
||||||
var q = data.message.valMatch(/^~rmlast ([\d\w\s]*)/, 2);
|
var q = data.message.valMatch(/^~rmlast ([\d\w\s]*)/, 2);
|
||||||
if(q) {
|
if(q) {
|
||||||
@ -40,7 +40,7 @@ var quotes = function(dbot) {
|
|||||||
} 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...');
|
||||||
}
|
}
|
||||||
},*/
|
},
|
||||||
|
|
||||||
'~qcount': function(data, params) {
|
'~qcount': function(data, params) {
|
||||||
var q = data.message.valMatch(/^~qcount ([\d\w\s]*)/, 2);
|
var q = data.message.valMatch(/^~qcount ([\d\w\s]*)/, 2);
|
||||||
|
11
run.js
11
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 = jsbot.createJSBot(this.name, 'irc.aberwiki.org', 6667, this, function() {
|
||||||
this.instance.join('#realitest');
|
this.instance.join('#realitest');
|
||||||
this.instance.join('#lolhax');
|
|
||||||
this.instance.join('#itonlygetsworse');
|
|
||||||
this.instance.join('#42');
|
this.instance.join('#42');
|
||||||
|
this.instance.join('#itonlygetsworse');
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
|
|
||||||
this.moduleNames = dModules;
|
this.moduleNames = dModules;
|
||||||
@ -86,7 +85,15 @@ DBot.prototype.reloadModules = function() {
|
|||||||
if(data.channel == this.name) data.channel = data.user;
|
if(data.channel == this.name) data.channel = data.user;
|
||||||
|
|
||||||
if(this.commands.hasOwnProperty(params[0])) {
|
if(this.commands.hasOwnProperty(params[0])) {
|
||||||
|
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);
|
this.commands[params[0]](data, params);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.commands[params[0]](data, params);
|
||||||
|
}
|
||||||
this.save();
|
this.save();
|
||||||
} else {
|
} else {
|
||||||
var q = data.message.valMatch(/^~([\d\w\s]*)/, 2);
|
var q = data.message.valMatch(/^~([\d\w\s]*)/, 2);
|
||||||
|
Loading…
Reference in New Issue
Block a user