3
0
mirror of https://github.com/reality/dbot.git synced 2024-11-30 16:09:27 +01:00

Added ignore checkers to all ignorable modules with listeners, bit messy but eh.

This commit is contained in:
Luke Slater 2012-04-15 22:04:58 +01:00
parent 0062dde196
commit a600cb5da5
5 changed files with 82 additions and 61 deletions

View File

@ -1,10 +1,13 @@
var http = require('http');
var autoshorten = function(dbot) {
var name = 'autoshorten';
var dbot = dbot;
return {
'listener': function(data) {
if((dbot.db.ignores.hasOwnProperty(data.user) &&
dbot.db.ignores[data.user].include(name)) == false) {
var urlRegex = /(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig;
var urlMatches = data.message.match(urlRegex);
@ -25,11 +28,12 @@ var autoshorten = function(dbot) {
});
});
}
}
},
'on': 'PRIVMSG',
'name': 'autoshorten',
'name': name,
'ignorable': true
};

View File

@ -1,8 +1,11 @@
var puns = function(dbot) {
var names = 'puns';
var dbot = dbot;
return {
'listener': function(data) {
if((dbot.db.ignores.hasOwnProperty(data.user) &&
dbot.db.ignores[data.user].include(name)) == false) {
if(dbot.moduleNames.include('quotes')) {
if(dbot.db.quoteArrs.hasOwnProperty(data.user.toLowerCase())) {
data.message = '~q ' + data.user.toLowerCase();
@ -10,11 +13,12 @@ var puns = function(dbot) {
dbot.commands[params[0]](data, params);
}
}
}
},
'on': 'JOIN',
'name': 'puns',
'name': name,
'ignorable': true
};

View File

@ -1,4 +1,5 @@
var quotes = function(dbot) {
var name = 'quotes';
var quotes = dbot.db.quoteArrs;
var addStack = [];
var rmAllowed = true;
@ -276,6 +277,8 @@ var quotes = function(dbot) {
// For automatic quote retrieval
'listener': function(data, params) {
if((dbot.db.ignores.hasOwnProperty(data.user) &&
dbot.db.ignores[data.user].include(name)) == false) {
if(data.user == 'reality') {
var once = data.message.valMatch(/^I ([\d\w\s,'-]* once)/, 2);
} else {
@ -297,11 +300,12 @@ var quotes = function(dbot) {
dbot.instance.say(data.channel, '\'reality ' + once[1] + '.\' saved.');
}
}
}
},
'on': 'PRIVMSG',
'name': 'quotes',
'name': name,
'ignorable': true
};

View File

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

View File

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