tmi.js
tmi.js copied to clipboard
getChannels and ircClient.channels lists redundant entries upon multiple join calls
Actual behaviour: the .channels array of the ircClient lists non-unique entries. apparently, sending multiple joins for the same channel-name leads to multiple entries in the array.
Expected behaviour: a list of unique, actually joined, channels.
Error log:
Insert your error log here
Server configuration
- Operating system: ubuntu 14.04 lts
- Node version (if applicable): 4.4.3
- NPM version (if applicable): 2.15.1
- tmi.js version: 0.0.29
@itsatony, I'm trying to reproduce this issue right now and I can't replicate it. Are you using client.getChannels() to get the current channels ?
If you could post your code that is causing this issue it would be very helpful.
Thank you!
I will close this issue, feel free to comment here if you are still experiencing this issue.
sorry, forgot to answer. so ..
client.join('#test');
-> Promise { <pending> }
client.getChannels();
-> [ '#test' ]
// ...(later)...
client.join('#test');
-> Promise { <pending> }
client.getChannels();
-> [ '#test', '#test' ]
this can be repeated endlessly... then, when parting the channel, it's still in the list.. multiple times potentially.
also, upon disconnect the channels array still has all channels listed.
my basic problem is, that the channels list feels like a list of join+part commands rather than a list of channels that the client is actually in.
btw.. it seems like a weird approach, but what i basically do to at least guarantee the uniqueness of the array is this:
ircClient.channels = [ ...new Set(ircClient.channels) ];
Thanks I will try to replicate this, if you have something like a simple script to replicate it I would really appreciate it. Not gonna lie, I'm a bit busy lately, so it might take some time.
I don't use Set, Map, WeakMap, etc.. in this module because I don't want to have to use a ton of polyfills.. as far as I know these are not compatible with IE and Safari
Reopening your issue :smile: