Is there a way to make the !winner command, or any alias activate multiple times in one command?

So I have to make a command that picks three random users from chat, and !winner would do just fine if except for the fact that it’s response is bulky and it would take 15 seconds to execute. Using -a=!winner to use winner as an alias command does call the command once, but at that point you might as well just type !winner as apposed to the custom command. I’ve considered API, as that could be even more atone to what I want to do, but I can’t write API myself so it doesn’t truly help me. Thanks, MGM.

It’s not possible to activate a command multiple times at once.

Do the 3 random users need to be active users? Or can they be any 3 users in the chat?
If the second case is true, then you can use Twitch’s chatters API.
Example: https://tmi.twitch.tv/group/user/imaqtpie/chatters

1 Like

Preferably chatters, but any users in chat would work fine enough. With the API, how would I go about selecting three people? I’d assume you’d make the API display 1-3 random users, and not do it through Nightbot, so can you either show me some API itself or point me towards it? Thanks!

This command selects 3 random chatters, excluding Nightbot and whoever used the command:

$(eval t=s=>s.toLowerCase();try{c=JSON.parse(r=`$(urlfetch json http://tmi.twitch.tv/group/user/$(channel)/chatters)`).chatters;a=c.moderators.concat(c.staff,c.admins,c.global_mods,c.viewers).filter(n=>![`$(user)`,"Nightbot"].some(o=>t(n)==t(o)));for(i=a.length-1;i>0;i--)[a[i],a[j]]=[a[j=Math.floor(Math.random()*(i+1))],a[i]];m="";for(i=0;i<3&&(n=a[i++]);)m+=n+" ";m||"No chatters"}catch(e){`Couldn't fetch the list of chatters: ${e.message}: ${r}`.substr(0,400)})

Thanks! Sorry for not responding sooner, but I haven’t had the chance to test it out very well until just now, and it does indeed work, and I deeply appreciate it. Again, thank you!

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