Skip to content

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

Description

@kesor

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions