lmariscal / twitchirc

Twitch Bot Development made Easier | DEPRECATED
Other
40 stars 15 forks source link

[Request] Online Time #37

Closed Poizenes closed 6 years ago

Poizenes commented 6 years ago

I've seen at any other bots a function to get the time a viewer has watched the stream. It would be very nice if you could implement such a function or a function like User#.joinedStream() or something like this. If you have another solution for this issue, it would be nice too.

mvarendorff commented 6 years ago

Do you mean the actual watchtime of the current stream or how long the user follows the channel? Either one is possible I just need to know which one you mean (although the other one would probably be put on my list for March) :)

Poizenes commented 6 years ago

I mean the actual watchtime. Of the current stream. And perhaps also the watchtime in complete would be nice. How long a user is following should can be handled with the onFollow()-Event.

mvarendorff commented 6 years ago

If you take it like that, you can handle your case with the Bot#userJoins method as well ;) There is no twitch endpoint to see how long a user is watching the stream. My implementation of this would also be store time when user joins, get time when user leaves (Bot#userParts), store difference between them and sum with any existing previous watchtime for total watchtime and store time when user joins, when requested and user didn't leave return time till now, else return time till user left or something similar.