How to choose a random winner between two people

I would like to add a !duel command to Nightbot for Youtube&Discord ,
The way I want it to work is that when someone types in !duel and a user’s name, nightbot randomly selects a use
EG: !duel Qwert
Dragonslayer899 challenges qwert to a duel!
Qwert is Victorious

If someone could help me to write this command I will be very gratefull , (I can get the first part right but the random choosing is the problem)

1 Like

I added an error response in case the user fails to specify a target to duel. Just copy and paste this into your chat:

!addcom -cd=5 !duel $(eval a='$(user)';b=decodeURIComponent('$(querystring)');if(b!=''){if(Math.round(Math.random())==0){c=a;}else{c=b;}a+' challenges '+b+' to a duel! '+c+' is victorious!';}else{'Unspecified user!';})

1 Like

Thanks alot , really appreciate it man
I hope your bot matures into glorious butterfly

1 Like

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