NightDev Community Forums

Prioritizing active users when pulling a viewer using an API

Hi there!

I created a command that calls out a random viewer from a stream a moderate for, but I want to avoid calling out any lurkers. Is there a way to prioritize active users when using an API to do this or avoid calling out lurkers altogether?

I am learning how to use Nightbot in a multitude of different ways (I’m a noob lol). I recently learned about using APIs (I think I’m using the term correctly?) and how I can randomly tag viewers in chat.

I created the following command for a friend’s stream:

BoggyBoiPow “Hey $(urlfetch https://2g.be/twitch/randomviewer.php?channel=$(channel)), gimmie your Dogecoin or else!” Oh no! Boggy has a gun and wants your cryptocurrency!! What will you do? !give or !run

Please note that !give and !run are separate commands I created.

The one issue I am running into is that Nightbot lurkers regardless of whether they said something or are inactive. I want to create a command similar to this one for another streamer I moderate for, but they’re concerned that lurkers may feel uncomfortable if they get called out. This is totally understandable. However, many active viewers shared that they’d love to participate in something like this.

Is there a way to prioritize active users over lurkers? It would be even better if lurkers were not chosen at all.

If you need clarification or I used an incorrect term, please let me know! I am always happy to learn!

Hiya, I understand your use case but this is not really possible. The API you are using just grabs the entire viewerlist of the channel and picks a random user of that list. There is no way to tell who is active or a lurker.

1 Like

Here’s a suggestion that was posted a while ago:

I feared this was the case. In my mind, if there’s a way for Nightbot to see if someone has said anything within the last x minutes or something like that, then it would work as I intended. I know if you go to Nightbot’s management page, you can see a chat log of sorts under Logs but didn’t know if we could incorporate that.

Thanks for your input!

Thank you for linking this to me, Emily! This is exactly the kind of thing I was interested in.

Haha I see your response there! I absolutely agree with you. The whole point of my original post was to see if I could avoid calling out lurkers with the commands I create. I think something like this would be a welcome addition!

1 Like