Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixed bug in JOIN/PART/KICK where crash could occur if channel name was different case than expected.
Example: if bot joins IRC channel using the channel name #channel. It creates a key self.chans["#channel"].users = {}. Since channel names are case insensitive, in some cases people joining the channel may join with #Channel, #ChAnNeL, or some other variation. Many IRCDs do not change the channel name to be consistent when broadcasting the event so the bot running irc lib will receive the irc event as :nickname JOIN :#Channel. This will cause an error during join because it looks at self.chans["#Channel"].users for the nicklist which doesn't exist.
To solve this issue all channels names are forced to lower case with message.args[0].toLowerCase() in JOIN/PART/KICK parsing. I only noticed this bug in the JOIN event but it is conceivably possible in the other two as well so I went ahead and modified the code there as well. There may be other places this could be an issue but I tried to get the events where I could foresee it being an issue.