3
0
mirror of https://github.com/reality/dbot.git synced 2025-02-03 08:04:17 +01:00

now it works

This commit is contained in:
reality 2014-09-05 09:15:05 +00:00
parent 24d14e7005
commit 7cb53a8b5a

View File

@ -10,7 +10,7 @@ var atheme = function(dbot) {
this.api = { this.api = {
'getChannelFlags': function(server, channel, callback) { 'getChannelFlags': function(server, channel, callback) {
if(!_.has(this.flagStack, server)) this.flagStack[server] = {}; if(!_.has(this.flagStack, server)) this.flagStack[server] = {};
if(_.has(flagStack[server], channel)) { // Already an active flag call if(_.has(this.flagStack[server], channel)) { // Already an active flag call
this.flagStack[server][channel].callbacks.push(callback); this.flagStack[server][channel].callbacks.push(callback);
} else { } else {
this.flagStack[server][channel] = { this.flagStack[server][channel] = {
@ -52,9 +52,9 @@ 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.user === 'ChanServ') {
var flags = event.message.match(/(\d+)\s+([^ ]+)\s+(\+\w+)\s+\((\#.+)\)/), var flags = event.params.match(/(\d+)\s+([^ ]+)\s+(\+\w+)\s+\((\#\w+)\)/),
end = event.message.match(/End of (\#.+) FLAGS listing./); 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];
@ -62,7 +62,7 @@ var atheme = function(dbot) {
if(_.has(this.flagStack[event.server], end[1])) { if(_.has(this.flagStack[event.server], end[1])) {
_.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));
delete this.flagStack[event.server][end[1]]; delete this.flagStack[event.server][end[1]];
} }
} }