Tried a command from a previous thread

So i wanted to add a !fight command in and when i was looking i found one thread with an answer that i tried which was… !commands add !fight $(user) fought $(urlfetch$(channel)) and $(urlfetch[0]&choices=won by KO,lost by submission). And whenever i used it, it would always tell me that it had an Error Connecting To Remote Server… Does anyone have any idea why?


The rtainc API URL that you’re calling in the second $(urlfetch) variable no longer works. But you can easily pick a random response using $(eval) like so:

!addcom -cd=5 !fight $(user) fought $(urlfetch$(channel)) and $(eval Math.floor(Math.random())?`won by KO`:`lost by submission`).

Okay thanks but do you know how to change the random user into a user that the person wants to fight i tried $(touser) but it always ends up losing ?

I’m assuming if there’s a specified user in the input, then that name will be used. But if no user is specified, then it uses a random user. This should accomplish that. Also I’ve made a slight change to the code; now there should be a 50/50 chance of winning.

!addcom -cd=5 !fight $(eval `$(user) fought ${decodeURIComponent(`$(querystring)`)||`$(urlfetch$(channel))`} and ${Math.round(Math.random())?`won by KO`:`lost by submission`}.`)

Yh that works now thank you :smiley:

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