random user without external APIs

Asked Apr 18, 2023·2 replies·Last activity 3 years ago·Open in Discord ↗
Archived from the original community forum
Things may have changed since it was written. Still stuck? Ask the community on Discord.

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?

2 replies

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

Hey @Zesty Pufferfish!

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.