Skip to content

Commit

Permalink
Fix bug with console removal
Browse files Browse the repository at this point in the history
  • Loading branch information
jrudess committed Dec 24, 2017
1 parent 6230b93 commit cecad06
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 20 deletions.
10 changes: 7 additions & 3 deletions cb.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,20 @@ class Cb extends site.Site {
}

updateList(nm, add) {
let update = false;
if (super.updateList({nm: nm, uid: nm}, this.config.cb, add)) {
if (add) {
this.config.cb.push(nm);
return true;
update = true;
} else if (this.config.cb.indexOf(nm) !== -1) {
this.config.cb = _.without(this.config.cb, nm);
return true;
update = true;
}
}
return false;

return Promise.try(function() {
return update;
});
}

checkStreamerState(nm) {
Expand Down
9 changes: 7 additions & 2 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,13 @@ function updateList(cmd, site, nm) {
for (let i = 0; i < SITES.length; i++) {
const siteName = SITES[i].siteName.trim().toLowerCase();
if (site === siteName) {
SITES[i].updateList(nm, cmd === "add" ? 1 : 0);
SITES[i].writeConfig();
const queries = [];
queries.push(SITES[i].updateList(nm, cmd === "add" ? 1 : 0));
Promise.all(queries).then(function(update) {
if (update) {
SITES[i].writeConfig();
}
});
}
}
}
Expand Down
21 changes: 11 additions & 10 deletions mfc.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,25 +68,26 @@ class Mfc extends site.Site {
}

updateList(nm, add) {
const me = this;

// Fetch the UID. The streamer does not have to be online for this.
return this.queryUser(nm).then((streamer) => {
let rc = false;
let update = false;
if (typeof streamer !== "undefined") {
if (super.updateList(streamer, me.config.mfc, add)) {
if (super.updateList(streamer, this.config.mfc, add)) {
this.dbgMsg("wtf");
if (add) {
me.config.mfc.push(streamer.uid);
rc = true;
} else if (this.config.cb.indexOf(nm) !== -1) {
this.dbgMsg("wtf2");
this.config.mfc.push(streamer.uid);
update = true;
} else if (this.config.mfc.indexOf(streamer.uid) !== -1) {
this.dbgMsg("wtf3");
this.config.mfc = _.without(this.config.mfc, streamer.uid);
rc = true;
update = true;
}
}
} else {
me.errMsg("Could not find " + colors.name(nm));
this.errMsg("Could not find " + colors.name(nm));
}
return rc;
return update;
});
}

Expand Down
13 changes: 8 additions & 5 deletions twitch.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,17 +48,20 @@ class Twitch extends site.Site {
}

updateList(nm, add) {
let rc = false;
if (super.updateList({nm: nm, uid: nm}, this.config.twitch, add)) {
let update = false;
if (this.super.updateList({nm: nm, uid: nm}, this.config.twitch, add)) {
if (add) {
this.config.twitch.push(nm);
rc = true;
update = true;
} else if (this.config.twitch.indexOf(nm) !== -1) {
this.config.twitch = _.without(this.config.twitch, nm);
rc = true;
update = true;
}
}
return rc;

return Promise.try(function() {
return update;
});
}

checkStreamerState(nm) {
Expand Down

0 comments on commit cecad06

Please sign in to comment.