tmijs / tmi.js

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

partially broken and or non accurate join/part/ and names events? #281

Closed DLLDev closed 6 years ago

DLLDev commented 6 years ago

hello,

i just figured out that my bot seems never know the real amount of chatters. i made tests on many channels with more then 1000 chatters and channels with between 10 and 200 users.

it SEEMS that the join/part/names events didnt fire as much time as they should. this ldeas in an very non accurate list of chatters.

i tried and watched it for hours now and it looks very bad to me.

one some smaller channels i was like 10-50 people away from the real counter. on some bigger channels i was like 200-1000 people away from the real counter.

i logged and watched the chat counter for hours!

i made it over the api, and calculated them also manually in side the channels over browser.

the results was in most channels pretty non accurate and break my bot as its an loyalty bot.

it seems i cannot guarantee that people that a long time out (like hours) dont get points anymore. but the most worst is that a lot of people that joined in the chat seems not getting points as my bot dont get the joins/names events on these chatters.

i would understand it if we speak about a hand ful of chatters, that can be based on huge delays (that tmi have for sure)

but i saw in a lot of hours very non accurate amounts of chatters.

does anyone can reproduce this issue?

it seems there is no way to make a loyality bot that really work. is this my issue? tmi issue? or tmi.js issue?

best wishes

Dan

Server configuration

AlcaDesign commented 6 years ago

This is how Twitch has chosen to implement IRC. In channels with over 1000 chatters, it won't send the names for every user.

If there are more than 1000 chatters in a room, NAMES return only the list of operator privileges currently in the room.

You can somewhat use the slow, unsupported, and undocumented "chatters" API:

`http://tmi.twitch.tv/group/user/${channel_name}/chatters`

http://tmi.twitch.tv/group/user/ninja/chatters

{
    "_links": {},
    "chatter_count": 83418,
    "chatters": {
        "admins" :[ "name_here" ],
        "global_mods": [ "name_here" ],
        "moderators": [ "name_here" ],
        "staff": [ "name_here" ],
        "viewers": [ "name_here" ]
    },
}
DLLDev commented 6 years ago

hello AlcaDesign,

ok i got this point. i could make a initial api call when joining a channel

but is it guaranteed that i get all part and join events fired after?

i mean will i have for real an accurate list of viewers?, special when like 1000 people or more join or part in the same moment?

and with lesser then 1000 users there is/should no way to dont have accurate user lists?

cheers

Dan

AlcaDesign commented 6 years ago

A combination of NAMES, chat activity, join/part, and chatters API might be what you need to do. You could build a video extension for Twitch and use the data fro that too. I've not built or been apart of a loyalty bot so I can't give you a definite picture of how to do it.

This isn't an issue with tmi.js, closing in favor of your Twitch Dev forum post.

DLLDev commented 6 years ago

Well, i just need an accurate List of Chatters so i dont care so much about the Stream.

It seems the issue should just appear to big Channels, i will try to code some Workaround and test it again.

Thank you for your Help and Time.

Best wishes

Dan

embiem commented 6 years ago

I think AlcaDesign mentioned extensions, as every user loading an extension will fire an authorized callback in the extension which you could use to determine all the users watching the channel.

In other words, you wouldn't rely on the chat to get all users in a channel.

marcandrews commented 6 years ago

Is having users idle in a channel really loyalty? As @AlcaDesign mentioned, I think keeping track of chat activity is a better determinant of loyalty.