3
0
mirror of https://github.com/reality/dbot.git synced 2024-11-24 04:49:25 +01:00

Use jsbot ignore instead of having it build into the modules

This commit is contained in:
Luke Slater 2012-05-25 16:45:47 +01:00
parent 4c72bd327c
commit 5677cad1fa
5 changed files with 41 additions and 54 deletions

View File

@ -11,8 +11,6 @@ var autoshorten = function(dbot) {
return { return {
'listener': function(event) { 'listener': function(event) {
if((dbot.db.ignores.hasOwnProperty(event.user) &&
dbot.db.ignores[event.user].include(name)) == false) {
var urlRegex = /(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig; var urlRegex = /(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig;
var urlMatches = event.message.match(urlRegex); var urlMatches = event.message.match(urlRegex);
@ -33,7 +31,6 @@ var autoshorten = function(dbot) {
}); });
}); });
} }
}
}, },
'on': 'PRIVMSG', 'on': 'PRIVMSG',

View File

@ -5,9 +5,6 @@ var puns = function(dbot) {
return { return {
'listener': function(event) { 'listener': function(event) {
event.user = dbot.cleanNick(event.user); event.user = dbot.cleanNick(event.user);
if((dbot.db.ignores.hasOwnProperty(event.user) &&
dbot.db.ignores[event.user].include(name)) == false) {
if(dbot.moduleNames.include('quotes') && if(dbot.moduleNames.include('quotes') &&
dbot.db.quoteArrs.hasOwnProperty(event.user)) { dbot.db.quoteArrs.hasOwnProperty(event.user)) {
event.message = '~q ' + event.user; event.message = '~q ' + event.user;
@ -15,7 +12,6 @@ var puns = function(dbot) {
event.params = event.message.split(' '); event.params = event.message.split(' ');
dbot.instance.emit(event) dbot.instance.emit(event)
} }
}
}, },
'on': 'JOIN', 'on': 'JOIN',

View File

@ -39,8 +39,6 @@ var spelling = function(dbot) {
return { return {
'listener': function(event) { 'listener': function(event) {
if((dbot.db.ignores.hasOwnProperty(event.user) &&
dbot.db.ignores[event.user].include(name)) == false) {
var q = event.message.valMatch(/^(?:\*\*?([\d\w\s']*)|([\d\w\s']*)\*\*?)$/, 3); var q = event.message.valMatch(/^(?:\*\*?([\d\w\s']*)|([\d\w\s']*)\*\*?)$/, 3);
var otherQ = event.message.valMatch(/^([\d\w\s]*): (?:\*\*?([\d\w\s']*)|([\d\w\s']*)\*\*?)$/, 4); var otherQ = event.message.valMatch(/^([\d\w\s]*): (?:\*\*?([\d\w\s']*)|([\d\w\s']*)\*\*?)$/, 4);
if(q) { if(q) {
@ -59,7 +57,6 @@ var spelling = function(dbot) {
last[event.channel][event.user] = event.message; last[event.channel][event.user] = event.message;
} }
} }
}
}, },
'on': 'PRIVMSG', 'on': 'PRIVMSG',

View File

@ -3,14 +3,11 @@ var youAre = function(dbot) {
return { return {
'listener': function(event) { 'listener': function(event) {
if((dbot.db.ignores.hasOwnProperty(event.user) &&
dbot.db.ignores[event.user].include(name)) == false) {
var key = event.message.valMatch(/(\bis\b|\bare\b)\s+([\w\s\d]*?)(\s+)?(,|\.|\band\b|$)/, 5); var key = event.message.valMatch(/(\bis\b|\bare\b)\s+([\w\s\d]*?)(\s+)?(,|\.|\band\b|$)/, 5);
if(key && key[2] != "" && Number.prototype.chanceIn(1, 100) && event.user != 'aisbot') { if(key && key[2] != "" && Number.prototype.chanceIn(1, 100) && event.user != 'aisbot') {
event.reply(event.user + ': You\'re ' + key[2] + '.'); event.reply(event.user + ': You\'re ' + key[2] + '.');
} }
}
}, },
'on': 'PRIVMSG', 'on': 'PRIVMSG',

2
run.js
View File

@ -53,7 +53,7 @@ var DBot = function(timers) {
// Populate bot properties with config data // Populate bot properties with config data
this.name = this.config.name || 'dbox'; this.name = this.config.name || 'dbox';
this.admin = this.config.admin || [ 'reality' ]; this.admin = this.config.admin || [ 'reality' ];
this.moduleNames = this.config.modules || [ 'admin', 'command', 'dice', 'js', 'kick', 'puns', 'quotes', 'spelling', 'youare' ]; this.moduleNames = this.config.modules || [ 'ignore', 'admin', 'command', 'dice', 'js', 'kick', 'puns', 'quotes', 'spelling', 'youare' ];
this.language = this.config.language || 'english'; this.language = this.config.language || 'english';
// It's the user's responsibility to fill this data structure up properly in // It's the user's responsibility to fill this data structure up properly in