-
Notifications
You must be signed in to change notification settings - Fork 701
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix channel join regression and fix possibly joining parted channels #411
Conversation
text: cmd | ||
}); | ||
}, delay); | ||
delay += 1000; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could be simplified a bit;
const delay = 1000;
commands.forEach((text, idx) => {
setTimeout(() => client.input({
target: network.channels[0].id,
text,
}), delay * ++idx);
});
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Joins have to run after commands, so that won't work. I also didn't touch this code, only moved it to another file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be honest, I'm not sure the delay * ++idx
statement is something I would call "simplified"...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed with @astorije, plus apart from changing the functions to arrow functions (thus breaking older versions), it doesn't actually change much. idx*1000
would do the same, as forEach
already provide the index and thus doesn't need to be incremented.
Looks good to me, 👍 |
channels.push(new Chan({ | ||
name: chan | ||
})); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about:
channels = args.join.replace(/\,/g, " ").split(/\s+/g).map(function(chan) {
return new Chan({
name: chan,
});
});
or, if you don't want that long first line:
var join = args.join.replace(/\,/g, " ").split(/\s+/g);
channels = join.map(...)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nevermind, got ruled out in priv by @xPaw, who plans to use the channels
variable in a further PR and cannot blindly overwrite it.
👍 |
Fix channel join regression and fix possibly joining parted channels
This PR creates channels out of
join
string when creating a network to avoid reusing thisjoin
string on future reconnections.This PR also fixes a regression which was introduced in 2.0-pre: #358.