tmijs / tmi.js

💬 Javascript library for the Twitch Messaging Interface. (Twitch.tv)
https://tmijs.com
MIT License
1.55k stars 214 forks source link

Migrating to user-id's instead of usernames #210

Open kinsi55 opened 7 years ago

kinsi55 commented 7 years ago

As announced months before, Twitch now identifies users by a unique ID instead of their name.

Today, Twitch decided to make a breaking change before v3 API is EOL by allowing full username changes. https://blog.twitch.tv/the-hype-is-real-name-changes-are-here-c629c4697154?sf58352669=1#.7fb8dssk7

So to truly identify users you must now use the unique ID instead of the name, but tmi.js offers no possibility for that.

Apparently, user-id is missing for a lot of IRC messages, but maybe it should be pre-maturely implemented for every event(?)

https://discuss.dev.twitch.tv/t/username-changes-identifying-users/9373/20

AlcaDesign commented 7 years ago

tmi.js if giving you as much data as it receives. You have to supplement the rest.

kinsi55 commented 7 years ago

Well, e.g. as you can see the subanniversary event has a user-id emitted by IRC https://github.com/tmijs/tmi.js/blob/e680e2b32f38f8c58469c182d6667a83a9d8f988/test/events.js#L189

There is no way to get that tough from the resub event https://docs.tmijs.org/v1.1.2/Events.html#subscription

AlcaDesign commented 7 years ago

My ideal of this situation is that we change it so that every event emits an object instead. Then you just destruct for what you need:

client.on('subanniversary', ({ channel, message, userstate, months }) => {

});

Then it doesn't matter what our order of arguments are.

kinsi55 commented 7 years ago

Sounds perfect to me. Futureproof and simple to adjust to