I’ve seen another bot have a command called !fight which the user types !fight and it says something along the lines of e.g. ‘User used a gun to fight user who had a knife and lost’.
Is there a way to create a command similar to this which would say something like:
This command should work, its a combination of 2 urlfetch variables, the first one picks a random viewer, the seconds one gets the random response: !commands add !fight $(user) fought $(urlfetch http://2g.be/twitch/randomviewer.php?channel=$(channel)) and $(urlfetch https://api.rtainc.co/twitch/random?format=[0]&choices=won by KO,lost by submission).
You can add more random responses to the second urlfetch comma-separated, for example: &choices=won by KO,lost by submission,response a,response b,reponse c,response d
@xgerhard Thanks man. But a problem I have is that there is a character limit, it won’t let me add the amount of random choices I want. Is there anyway I can apply all of my random choices but not in the api link so I can bypass the character limit?
Hmm, not the most ideal situation, but you could create a long link with all the choices and make a bit.ly link from it, then put that link in the urlfetch.
@xgerhard That worked. Thanks! But also, instead of a random viewer, I would like it to be a viewer that I type in, if I didn’t type in a correct user, it would reply with a response saying :
You can use the $(touser) variable, when you type !fight testuser, it will display the testuser, but if you just type !fight, it will display your own name.
I tried that but it seems to work exactly like the $(query) variable. I would like it to give an error if you don’t type the correct name or any name at all. @xgerhard