mirror of
https://github.com/reality/dbot.git
synced 2024-11-23 12:29:26 +01:00
ffs
This commit is contained in:
commit
9ed4c582e2
@ -76,61 +76,76 @@ var atheme = function(dbot) {
|
||||
this.commands['~chanmode'].regex = [/^chanmode (\+.)/, 2];
|
||||
|
||||
this.listener = function(event) {
|
||||
if(event.user === 'ChanServ') {
|
||||
var flags = event.params.match(/(\d+)\s+([^ ]+)\s+(\+\w+)\s+\((\#[\w\.]+)\)/),
|
||||
end = event.params.match(/end of \u0002(\#[\w\.]+)\u0002 flags listing/i);
|
||||
if(event.action === 'NOTICE') {
|
||||
if(event.user === 'ChanServ') {
|
||||
var flags = event.params.match(/(\d+)\s+([^ ]+)\s+(\+\w+)\s+\((\#[\w\.]+)\)/),
|
||||
end = event.params.match(/end of \u0002(\#[\w\.]+)\u0002 flags listing/i);
|
||||
|
||||
if(flags && _.has(this.flagStack[event.server], flags[4])) {
|
||||
this.flagStack[event.server][flags[4]].flags[flags[2]] = flags[3];
|
||||
} else if(end) {
|
||||
if(_.has(this.flagStack[event.server], end[1])) {
|
||||
// Parse wildcard hostmasks to nicks
|
||||
var allFlags = this.flagStack[event.server][end[1]].flags,
|
||||
hostMasks = {};
|
||||
if(flags && _.has(this.flagStack[event.server], flags[4])) {
|
||||
this.flagStack[event.server][flags[4]].flags[flags[2]] = flags[3];
|
||||
} else if(end) {
|
||||
if(_.has(this.flagStack[event.server], end[1])) {
|
||||
// Parse wildcard hostmasks to nicks
|
||||
var allFlags = this.flagStack[event.server][end[1]].flags,
|
||||
hostMasks = {};
|
||||
|
||||
_.each(allFlags, function(f, u) { // TODO: combine to one loop
|
||||
if(u.indexOf('*!*@') !== -1) {
|
||||
hostMasks[u] = f;
|
||||
delete allFlags[u];
|
||||
}
|
||||
});
|
||||
_.each(allFlags, function(f, u) { // TODO: combine to one loop
|
||||
if(u.indexOf('*!*@') !== -1) {
|
||||
hostMasks[u] = f;
|
||||
delete allFlags[u];
|
||||
}
|
||||
});
|
||||
|
||||
async.each(_.keys(hostMasks), function(hostMask, done) {
|
||||
this.api.getVHosts(event.server, hostMask.split('@')[1], function(err, users) {
|
||||
_.each(users, function(user) {
|
||||
allFlags[user] = hostMasks[hostMask];
|
||||
async.each(_.keys(hostMasks), function(hostMask, done) {
|
||||
this.api.getVHosts(event.server, hostMask.split('@')[1], function(err, users) {
|
||||
_.each(users, function(user) {
|
||||
allFlags[user] = hostMasks[hostMask];
|
||||
});
|
||||
done();
|
||||
});
|
||||
done();
|
||||
});
|
||||
}.bind(this), function() {
|
||||
console.log('DONE');
|
||||
console.log(allFlags);
|
||||
_.each(this.flagStack[event.server][end[1]].callbacks, function(callback) {
|
||||
callback(null, this.flagStack[event.server][end[1]].flags);
|
||||
}.bind(this), function() {
|
||||
_.each(this.flagStack[event.server][end[1]].callbacks, function(callback) {
|
||||
callback(null, this.flagStack[event.server][end[1]].flags);
|
||||
}.bind(this));
|
||||
delete this.flagStack[event.server][end[1]];
|
||||
}.bind(this));
|
||||
delete this.flagStack[event.server][end[1]];
|
||||
}.bind(this));
|
||||
}
|
||||
}
|
||||
} else if(event.user === 'HostServ') {
|
||||
_.each(this.hostStack[event.server], function(el, mask) {
|
||||
if(event.params.match(mask)) {
|
||||
var user = event.params.match(/- ([^ ]+)/),
|
||||
end = event.params.match(/matches for pattern/);
|
||||
|
||||
if(user) {
|
||||
this.hostStack[event.server][mask].users.push(user[1]);
|
||||
} else if(end) {
|
||||
_.each(this.hostStack[event.server][mask].callbacks, function(callback) {
|
||||
callback(null, this.hostStack[event.server][mask].users);
|
||||
}, this);
|
||||
delete this.hostStack[event.server][mask];
|
||||
}
|
||||
}
|
||||
}, this);
|
||||
} else if(event.user === 'HostServ') {
|
||||
_.each(this.hostStack[event.server], function(el, mask) {
|
||||
if(event.params.match(mask)) {
|
||||
var user = event.params.match(/- ([^ ]+)/),
|
||||
end = event.params.match(/matches for pattern/);
|
||||
|
||||
if(user) {
|
||||
this.hostStack[event.server][mask].users.push(user[1]);
|
||||
} else if(end) {
|
||||
_.each(this.hostStack[event.server][mask].callbacks, function(callback) {
|
||||
callback(null, this.hostStack[event.server][mask].users);
|
||||
}, this);
|
||||
delete this.hostStack[event.server][mask];
|
||||
}
|
||||
}
|
||||
}, this);
|
||||
}
|
||||
} else { // PRIVMSG
|
||||
var akill = event.message.match(/([^ ]+) AKILL:ADD: ([^ ]+) \(reason: (.+)(\) )\(duration: ([^,)]+)/);
|
||||
if(event.channel === '#services' && akill) {
|
||||
var channel = dbot.config.servers[server].admin_channel;
|
||||
dbot.api.report.notify('ban', 'tripsit', akill[1], channel, dbot.t('akill', {
|
||||
'host': akill[2],
|
||||
'reason': akill[3],
|
||||
'duration': akill[4]
|
||||
}));
|
||||
}
|
||||
}
|
||||
}.bind(this);
|
||||
this.on = 'NOTICE';
|
||||
this.on = ['NOTICE', 'PRIVMSG'];
|
||||
};
|
||||
|
||||
exports.fetch = function(dbot) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
{
|
||||
"stream": "http://tripsit.fm:8000",
|
||||
"announce": [ { "server": "tripsit", "name": "#tripbot" } ],
|
||||
"stream": "http://radio.tripsit.me:8000/tripradio",
|
||||
"announce": [ { "server": "tripsit", "name": "#drugs" } ],
|
||||
"outputPrefix": "\u00033radio\u000f"
|
||||
}
|
||||
|
@ -35,11 +35,14 @@ var api = function(dbot) {
|
||||
return k;
|
||||
}
|
||||
}.bind(this));
|
||||
ops = _.without(ops, undefined);
|
||||
console.log(ops);
|
||||
this.db.read('nunsubs', cName + '.' + server, function(err, nunsubs) {
|
||||
if(nunsubs) {
|
||||
_.each(nunsubs.users, function(user) {
|
||||
var uPart = user.split('.')[0];
|
||||
if(_.include(ops, uPart)) {
|
||||
console.log('removing ' + uPart);
|
||||
ops = _.without(ops, uPart);
|
||||
}
|
||||
});
|
||||
|
@ -10,6 +10,7 @@ var report = function(dbot) {
|
||||
this.internalAPI = {
|
||||
'notify': function(server, users, message) {
|
||||
async.eachSeries(users, function(nick, next) {
|
||||
console.log('sending msg to ' + nick);
|
||||
setTimeout(function() {
|
||||
dbot.say(server, nick, message);
|
||||
next();
|
||||
|
Loading…
Reference in New Issue
Block a user