Retriave the Least Active VIP

My goal is to make a feature where an user can “steal” a VIP from the least Active VIP on channel, which is the one that haven’t watched the stream for the longest time.

For that I was trying to make a chatbot that will know when a VIP join the chat and save in a local Database the current time. So I ended up with two solutions:

  1. Get when an User joins chat and, if it’s a VIP, save on DB (Will have problems on 1k Viewers+ Streams).
  2. Get the vips online, from time to time, with the[CHANNEL_NAME]/chatters and save on DB (heard that is not really reliable)

For 1. I don’t know how to use this “onJoin” event and if it really worth it due to it’s limitations
For 2. I want to know what is the frequency that this information is updated

Are those good solutions? Any other way you may suggest? Will I have privacy issues by handling this data?

It’s not worth it

Your use case suggests logging the time of the users last message in chat.

Since it would make more sense (to me) to recycle the badge from lurkers to active chat members. And active chat members are those talking in chat, not lurking.

To get a list of VIPS you either need an internal list (which you’d have as you are giving them out) or call /vips and parse the result

Actually we were looking for a way to include the lurkers as well, hard to explain haha.

For the talking chat members your solution is perfect, but for the lurkers I know only the /chatters endpoint. Maybe I could use the chat messages as my main source of information and hit the endpoint from time to time as an addition. (Not aiming for an hour level precision, a daily log should do it). Tank You for the help, btw.

Well from a chat point perspecitve you know the last time they sent a message.

And sure you can pull chatters to see if they are connected to chat

But connected to chat is pretty useless. Since lukrers are not gonna use their VIP badges.

So for the thing I do, I basically ignore lurkers as valid targets.

has to have sent a message in the last 24 hours to be considered

This actually makes a lot of sense…

I’ll try going with the chat reading solution then. Thank you very much!

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