[Solved] Possible Bug with Userstate Object


I think I found a possible bug (unless this is a possible feature).
The user-state object sent with each chat message contains a display-name, but a small percentage of users (so far I have seen about 3) don’t have a “display-name”.

Objects from TMI.js (One with and one without display name.)


That’s normal if a user has never customized their name.
You need to use the username field instead when display-name is null.

They way I understand it works (and if this is wrong I hope someone corrects me), but a null or missing display-name field indicates that the user has never set their display name so Twitch Chat falls back to using their username but with a capitalised first letter in its place when displaying that user in chat.

Okay, that makes sense. I had a feeling it was that, just making sure.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.