mirror of
https://github.com/reality/dbot.git
synced 2024-11-23 20:39:25 +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.commands['~chanmode'].regex = [/^chanmode (\+.)/, 2];
|
||||||
|
|
||||||
this.listener = function(event) {
|
this.listener = function(event) {
|
||||||
if(event.user === 'ChanServ') {
|
if(event.action === 'NOTICE') {
|
||||||
var flags = event.params.match(/(\d+)\s+([^ ]+)\s+(\+\w+)\s+\((\#[\w\.]+)\)/),
|
if(event.user === 'ChanServ') {
|
||||||
end = event.params.match(/end of \u0002(\#[\w\.]+)\u0002 flags listing/i);
|
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])) {
|
if(flags && _.has(this.flagStack[event.server], flags[4])) {
|
||||||
this.flagStack[event.server][flags[4]].flags[flags[2]] = flags[3];
|
this.flagStack[event.server][flags[4]].flags[flags[2]] = flags[3];
|
||||||
} else if(end) {
|
} else if(end) {
|
||||||
if(_.has(this.flagStack[event.server], end[1])) {
|
if(_.has(this.flagStack[event.server], end[1])) {
|
||||||
// Parse wildcard hostmasks to nicks
|
// Parse wildcard hostmasks to nicks
|
||||||
var allFlags = this.flagStack[event.server][end[1]].flags,
|
var allFlags = this.flagStack[event.server][end[1]].flags,
|
||||||
hostMasks = {};
|
hostMasks = {};
|
||||||
|
|
||||||
_.each(allFlags, function(f, u) { // TODO: combine to one loop
|
_.each(allFlags, function(f, u) { // TODO: combine to one loop
|
||||||
if(u.indexOf('*!*@') !== -1) {
|
if(u.indexOf('*!*@') !== -1) {
|
||||||
hostMasks[u] = f;
|
hostMasks[u] = f;
|
||||||
delete allFlags[u];
|
delete allFlags[u];
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
async.each(_.keys(hostMasks), function(hostMask, done) {
|
async.each(_.keys(hostMasks), function(hostMask, done) {
|
||||||
this.api.getVHosts(event.server, hostMask.split('@')[1], function(err, users) {
|
this.api.getVHosts(event.server, hostMask.split('@')[1], function(err, users) {
|
||||||
_.each(users, function(user) {
|
_.each(users, function(user) {
|
||||||
allFlags[user] = hostMasks[hostMask];
|
allFlags[user] = hostMasks[hostMask];
|
||||||
|
});
|
||||||
|
done();
|
||||||
});
|
});
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
}.bind(this), function() {
|
}.bind(this), function() {
|
||||||
console.log('DONE');
|
|
||||||
console.log(allFlags);
|
|
||||||
_.each(this.flagStack[event.server][end[1]].callbacks, function(callback) {
|
_.each(this.flagStack[event.server][end[1]].callbacks, function(callback) {
|
||||||
callback(null, this.flagStack[event.server][end[1]].flags);
|
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));
|
}.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);
|
}.bind(this);
|
||||||
this.on = 'NOTICE';
|
this.on = ['NOTICE', 'PRIVMSG'];
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.fetch = function(dbot) {
|
exports.fetch = function(dbot) {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"stream": "http://tripsit.fm:8000",
|
"stream": "http://radio.tripsit.me:8000/tripradio",
|
||||||
"announce": [ { "server": "tripsit", "name": "#tripbot" } ],
|
"announce": [ { "server": "tripsit", "name": "#drugs" } ],
|
||||||
"outputPrefix": "\u00033radio\u000f"
|
"outputPrefix": "\u00033radio\u000f"
|
||||||
}
|
}
|
||||||
|
@ -35,11 +35,14 @@ var api = function(dbot) {
|
|||||||
return k;
|
return k;
|
||||||
}
|
}
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
|
ops = _.without(ops, undefined);
|
||||||
|
console.log(ops);
|
||||||
this.db.read('nunsubs', cName + '.' + server, function(err, nunsubs) {
|
this.db.read('nunsubs', cName + '.' + server, function(err, nunsubs) {
|
||||||
if(nunsubs) {
|
if(nunsubs) {
|
||||||
_.each(nunsubs.users, function(user) {
|
_.each(nunsubs.users, function(user) {
|
||||||
var uPart = user.split('.')[0];
|
var uPart = user.split('.')[0];
|
||||||
if(_.include(ops, uPart)) {
|
if(_.include(ops, uPart)) {
|
||||||
|
console.log('removing ' + uPart);
|
||||||
ops = _.without(ops, uPart);
|
ops = _.without(ops, uPart);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -10,6 +10,7 @@ var report = function(dbot) {
|
|||||||
this.internalAPI = {
|
this.internalAPI = {
|
||||||
'notify': function(server, users, message) {
|
'notify': function(server, users, message) {
|
||||||
async.eachSeries(users, function(nick, next) {
|
async.eachSeries(users, function(nick, next) {
|
||||||
|
console.log('sending msg to ' + nick);
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
dbot.say(server, nick, message);
|
dbot.say(server, nick, message);
|
||||||
next();
|
next();
|
||||||
|
Loading…
Reference in New Issue
Block a user