Skip to content
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

IRC tags with a value of 0 or 1 are ALWAYS converted to a boolean #385

Open
kesor opened this issue May 6, 2020 · 0 comments
Open

IRC tags with a value of 0 or 1 are ALWAYS converted to a boolean #385

kesor opened this issue May 6, 2020 · 0 comments

Comments

@kesor
Copy link

kesor commented May 6, 2020

tmi.js/lib/client.js

Lines 92 to 105 in ddced23

// Transform IRCv3 tags..
if(message.tags) {
var tags = message.tags;
for(var key in tags) {
if(key !== "emote-sets" && key !== "ban-duration" && key !== "bits") {
var value = tags[key];
if(_.isBoolean(value)) { value = null; }
else if(value === "1") { value = true; }
else if(value === "0") { value = false; }
else if(_.isString(value)) { value = _.unescapeIRC(value); }
tags[key] = value;
}
}
}

In some cases the original tag value is an actual integer, not a boolean. For example a resubscribe for 1 cumulative months. This is returned as a true value, which is surprising.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant