random user without external APIs

taking into account that !winner returns a random user from the chat,
How can I create a similar command to select a random user from the chat without having to resort to an external api?

Does anyone know how the default !winner command works?

Youtube has a live chat messages api which returns a list of users, their messages id and so on in JSON format

Hey @don_kastor!

The default !winner command works by collecting the usernames of those who spoke within the last 5 minutes, and when it’s called it picks someone at random from that list.

Nightbot could have a $(randomuser) variable that’d essentially do the same, but it doesn’t exist as of now.


There used to be a way to get a random user with an external API, but it was shut down due to Twitch changing the rules to access the endpoint.

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