NightDev Community Forums

Command to return [wins] from different platforms

Hey community!

I’m trying to create a command that returns the overall number of wins in Fortnite.
Is it possible to evaluate (to sum) the wins from different platforms?
For example:

!commands add !wins -cd=5 -ul=everyone $(urlfetch https://2g.be/pc) + $(urlfetch https://2g.be/ps)

But problem is that inserted url returns text and number of wins… Any ideas how to write the proper command?
I could use $(eval x+x) but the problem is the same :sweat_smile:
Thank you for your help!

@opticoon

!addcom -cd=5 !wins $(eval try{`$(urlfetch https://2g.be...)$(urlfetch https://2g.be...)`.match(/Wins: [0-9]+/g).map(a=>parseInt(a.split(` `)[1])).reduce((a,b)=>a+b);}catch(e){`Could not calculate the total wins!`;})

In the above command setup, you will see this string:

`$(urlfetch https://2g.be...)$(urlfetch https://2g.be...)`

Edit these URL calls to make the API requests that you need. You can add more $(urlfetch) variables to this string if necessary.

@RokettoJanpu
You’re a pure god! :sweat_smile:
IT WORKS
You just wrote ‘Kills:’ instead of ‘Wins:’ … anyway thank you for your help! Here is a full code if anyone has this problem as well:

!addcom -cd=5 !wins NAME’s wins: $(eval try{$(urlfetch https://2g.be/...)$(urlfetch https://2g.be/...).match(/Wins: [0-9]+/g).map(a=>parseInt(a.split()[1])).reduce((a,b)=>a+b);}catch(e){Could not calculate the total wins!;})

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