mirror of
https://github.com/reality/dbot.git
synced 2024-11-27 22:39:26 +01:00
Use jsbot ignore instead of having it build into the modules
This commit is contained in:
parent
4c72bd327c
commit
5677cad1fa
@ -11,28 +11,25 @@ var autoshorten = function(dbot) {
|
||||
|
||||
return {
|
||||
'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 urlMatches = event.message.match(urlRegex);
|
||||
var urlRegex = /(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig;
|
||||
var urlMatches = event.message.match(urlRegex);
|
||||
|
||||
if(urlMatches !== null && urlMatches[0].length > 80) {
|
||||
var url = urlMatches[0]; // Only doing one, screw you.
|
||||
if(urlMatches !== null && urlMatches[0].length > 80) {
|
||||
var url = urlMatches[0]; // Only doing one, screw you.
|
||||
|
||||
// TODO: Make this use a decent URL shortener. Mine is shit.
|
||||
var options = {
|
||||
'host': 'nc.no.de',
|
||||
'port': 80,
|
||||
'path': '/mkurl?url=' + escape(url)
|
||||
};
|
||||
// TODO: Make this use a decent URL shortener. Mine is shit.
|
||||
var options = {
|
||||
'host': 'nc.no.de',
|
||||
'port': 80,
|
||||
'path': '/mkurl?url=' + escape(url)
|
||||
};
|
||||
|
||||
http.get(options, function(res) {
|
||||
res.setEncoding('utf8');
|
||||
res.on('data', function (response) {
|
||||
event.reply(dbot.t('shorten_link', {'user': event.user}) + JSON.parse(response).surl);
|
||||
});
|
||||
http.get(options, function(res) {
|
||||
res.setEncoding('utf8');
|
||||
res.on('data', function (response) {
|
||||
event.reply(dbot.t('shorten_link', {'user': event.user}) + JSON.parse(response).surl);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -5,16 +5,12 @@ var puns = function(dbot) {
|
||||
return {
|
||||
'listener': function(event) {
|
||||
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') &&
|
||||
dbot.db.quoteArrs.hasOwnProperty(event.user)) {
|
||||
event.message = '~q ' + event.user;
|
||||
event.action = 'PRIVMSG';
|
||||
event.params = event.message.split(' ');
|
||||
dbot.instance.emit(event)
|
||||
}
|
||||
if(dbot.moduleNames.include('quotes') &&
|
||||
dbot.db.quoteArrs.hasOwnProperty(event.user)) {
|
||||
event.message = '~q ' + event.user;
|
||||
event.action = 'PRIVMSG';
|
||||
event.params = event.message.split(' ');
|
||||
dbot.instance.emit(event)
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -39,25 +39,22 @@ var spelling = function(dbot) {
|
||||
|
||||
return {
|
||||
'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 otherQ = event.message.valMatch(/^([\d\w\s]*): (?:\*\*?([\d\w\s']*)|([\d\w\s']*)\*\*?)$/, 4);
|
||||
if(q) {
|
||||
correct(event, q[1] || q[2], event.user, function (e) {
|
||||
event.reply(dbot.t('spelling_self', e));
|
||||
});
|
||||
} else if(otherQ) {
|
||||
correct(event, otherQ[2] || otherQ[3], otherQ[1], function (e) {
|
||||
event.reply(dbot.t('spelling_other', e));
|
||||
});
|
||||
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);
|
||||
if(q) {
|
||||
correct(event, q[1] || q[2], event.user, function (e) {
|
||||
event.reply(dbot.t('spelling_self', e));
|
||||
});
|
||||
} else if(otherQ) {
|
||||
correct(event, otherQ[2] || otherQ[3], otherQ[1], function (e) {
|
||||
event.reply(dbot.t('spelling_other', e));
|
||||
});
|
||||
} else {
|
||||
if(last.hasOwnProperty(event.channel)) {
|
||||
last[event.channel][event.user] = event.message;
|
||||
} else {
|
||||
if(last.hasOwnProperty(event.channel)) {
|
||||
last[event.channel][event.user] = event.message;
|
||||
} else {
|
||||
last[event.channel] = { };
|
||||
last[event.channel][event.user] = event.message;
|
||||
}
|
||||
last[event.channel] = { };
|
||||
last[event.channel][event.user] = event.message;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -3,13 +3,10 @@ var youAre = function(dbot) {
|
||||
|
||||
return {
|
||||
'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') {
|
||||
event.reply(event.user + ': You\'re ' + key[2] + '.');
|
||||
}
|
||||
if(key && key[2] != "" && Number.prototype.chanceIn(1, 100) && event.user != 'aisbot') {
|
||||
event.reply(event.user + ': You\'re ' + key[2] + '.');
|
||||
}
|
||||
},
|
||||
|
||||
|
2
run.js
2
run.js
@ -53,7 +53,7 @@ var DBot = function(timers) {
|
||||
// Populate bot properties with config data
|
||||
this.name = this.config.name || 'dbox';
|
||||
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';
|
||||
|
||||
// It's the user's responsibility to fill this data structure up properly in
|
||||
|
Loading…
Reference in New Issue
Block a user